Commit 4a755ed4 authored by Andy Moreton's avatar Andy Moreton Committed by Eli Zaretskii

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.
parent cb93a6ce
...@@ -687,7 +687,8 @@ PREFIX is the directory name of the directory against which these ...@@ -687,7 +687,8 @@ PREFIX is the directory name of the directory against which these
patterns are rooted. We understand only a subset of PCRE syntax; patterns are rooted. We understand only a subset of PCRE syntax;
if we don't understand a construct, we signal if we don't understand a construct, we signal
`vc-hg-unsupported-syntax'." `vc-hg-unsupported-syntax'."
(cl-assert (string-match "^/\\(.*/\\)?$" prefix)) (cl-assert (and (file-name-absolute-p prefix)
(directory-name-p prefix)))
(let ((parts nil) (let ((parts nil)
(i 0) (i 0)
(anchored nil) (anchored nil)
...@@ -875,7 +876,8 @@ if we don't understand a construct, we signal ...@@ -875,7 +876,8 @@ if we don't understand a construct, we signal
(defun vc-hg--slurp-hgignore (repo) (defun vc-hg--slurp-hgignore (repo)
"Read hg ignore patterns from REPO. "Read hg ignore patterns from REPO.
REPO must be the directory name of an hg repository." REPO must be the directory name of an hg repository."
(cl-assert (string-match "^/\\(.*/\\)?$" repo)) (cl-assert (and (file-name-absolute-p repo)
(directory-name-p repo)))
(let* ((hgignore (concat repo ".hgignore")) (let* ((hgignore (concat repo ".hgignore"))
(vc-hg--hgignore-patterns nil) (vc-hg--hgignore-patterns nil)
(vc-hg--hgignore-filenames nil)) (vc-hg--hgignore-filenames nil))
...@@ -930,7 +932,8 @@ FILENAME must be the file's true absolute name." ...@@ -930,7 +932,8 @@ FILENAME must be the file's true absolute name."
(concat repo repo-relative-filename)))) (concat repo repo-relative-filename))))
(defun vc-hg--read-repo-requirements (repo) (defun vc-hg--read-repo-requirements (repo)
(cl-assert (string-match "^/\\(.*/\\)?$" repo)) (cl-assert (and (file-name-absolute-p repo)
(directory-name-p repo)))
(let* ((requires-filename (concat repo ".hg/requires"))) (let* ((requires-filename (concat repo ".hg/requires")))
(and (file-exists-p requires-filename) (and (file-exists-p requires-filename)
(with-temp-buffer (with-temp-buffer
...@@ -1001,7 +1004,8 @@ hg binary." ...@@ -1001,7 +1004,8 @@ hg binary."
;; dirstate must exist ;; dirstate must exist
(not (progn (not (progn
(setf repo (expand-file-name repo)) (setf repo (expand-file-name repo))
(cl-assert (string-match "^/\\(.*/\\)?$" repo)) (cl-assert (and (file-name-absolute-p repo)
(directory-name-p repo)))
(setf dirstate (concat repo ".hg/dirstate")) (setf dirstate (concat repo ".hg/dirstate"))
(setf dirstate-attr (file-attributes dirstate)))) (setf dirstate-attr (file-attributes dirstate))))
;; Repository must be in an understood format ;; Repository must be in an understood format
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment