diff options
| author | Andy Moreton | 2017-09-30 16:21:39 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2017-09-30 16:21:39 +0300 |
| commit | 4a755ed42158b6a165bfd689e2d974d0ccda7530 (patch) | |
| tree | a3c786c4ceb5d1be28e9856c93cbecce6d711725 | |
| parent | cb93a6ce72c5d238c6f120192aaba1554363dfe9 (diff) | |
| download | emacs-4a755ed42158b6a165bfd689e2d974d0ccda7530.tar.gz emacs-4a755ed42158b6a165bfd689e2d974d0ccda7530.zip | |
Avoid assertions in vc-hg.el on MS-Windows
* lisp/vc/vc-hg.el (vc-hg--pcre-to-elisp-re)
(vc-hg--slurp-hgignore, vc-hg--read-repo-requirements)
(vc-hg-state-fast): Use file-name-absolute-p and directory-name-p
instead of relying on Unix file-name syntax. This avoids
assertion violations on MS-Windows.
| -rw-r--r-- | lisp/vc/vc-hg.el | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index 7a04a543773..99c8869ae06 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el | |||
| @@ -687,7 +687,8 @@ PREFIX is the directory name of the directory against which these | |||
| 687 | patterns are rooted. We understand only a subset of PCRE syntax; | 687 | patterns are rooted. We understand only a subset of PCRE syntax; |
| 688 | if we don't understand a construct, we signal | 688 | if we don't understand a construct, we signal |
| 689 | `vc-hg-unsupported-syntax'." | 689 | `vc-hg-unsupported-syntax'." |
| 690 | (cl-assert (string-match "^/\\(.*/\\)?$" prefix)) | 690 | (cl-assert (and (file-name-absolute-p prefix) |
| 691 | (directory-name-p prefix))) | ||
| 691 | (let ((parts nil) | 692 | (let ((parts nil) |
| 692 | (i 0) | 693 | (i 0) |
| 693 | (anchored nil) | 694 | (anchored nil) |
| @@ -875,7 +876,8 @@ if we don't understand a construct, we signal | |||
| 875 | (defun vc-hg--slurp-hgignore (repo) | 876 | (defun vc-hg--slurp-hgignore (repo) |
| 876 | "Read hg ignore patterns from REPO. | 877 | "Read hg ignore patterns from REPO. |
| 877 | REPO must be the directory name of an hg repository." | 878 | REPO must be the directory name of an hg repository." |
| 878 | (cl-assert (string-match "^/\\(.*/\\)?$" repo)) | 879 | (cl-assert (and (file-name-absolute-p repo) |
| 880 | (directory-name-p repo))) | ||
| 879 | (let* ((hgignore (concat repo ".hgignore")) | 881 | (let* ((hgignore (concat repo ".hgignore")) |
| 880 | (vc-hg--hgignore-patterns nil) | 882 | (vc-hg--hgignore-patterns nil) |
| 881 | (vc-hg--hgignore-filenames nil)) | 883 | (vc-hg--hgignore-filenames nil)) |
| @@ -930,7 +932,8 @@ FILENAME must be the file's true absolute name." | |||
| 930 | (concat repo repo-relative-filename)))) | 932 | (concat repo repo-relative-filename)))) |
| 931 | 933 | ||
| 932 | (defun vc-hg--read-repo-requirements (repo) | 934 | (defun vc-hg--read-repo-requirements (repo) |
| 933 | (cl-assert (string-match "^/\\(.*/\\)?$" repo)) | 935 | (cl-assert (and (file-name-absolute-p repo) |
| 936 | (directory-name-p repo))) | ||
| 934 | (let* ((requires-filename (concat repo ".hg/requires"))) | 937 | (let* ((requires-filename (concat repo ".hg/requires"))) |
| 935 | (and (file-exists-p requires-filename) | 938 | (and (file-exists-p requires-filename) |
| 936 | (with-temp-buffer | 939 | (with-temp-buffer |
| @@ -1001,7 +1004,8 @@ hg binary." | |||
| 1001 | ;; dirstate must exist | 1004 | ;; dirstate must exist |
| 1002 | (not (progn | 1005 | (not (progn |
| 1003 | (setf repo (expand-file-name repo)) | 1006 | (setf repo (expand-file-name repo)) |
| 1004 | (cl-assert (string-match "^/\\(.*/\\)?$" repo)) | 1007 | (cl-assert (and (file-name-absolute-p repo) |
| 1008 | (directory-name-p repo))) | ||
| 1005 | (setf dirstate (concat repo ".hg/dirstate")) | 1009 | (setf dirstate (concat repo ".hg/dirstate")) |
| 1006 | (setf dirstate-attr (file-attributes dirstate)))) | 1010 | (setf dirstate-attr (file-attributes dirstate)))) |
| 1007 | ;; Repository must be in an understood format | 1011 | ;; Repository must be in an understood format |