branch: externals/vc-hgcmd commit e6f1105e9e93120f3acb29fd018d0a1606198ddb Author: muffinmad <andreyk....@gmail.com> Commit: muffinmad <andreyk....@gmail.com>
Use relative file names for all commands --- vc-hgcmd.el | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/vc-hgcmd.el b/vc-hgcmd.el index 392df40..57be3e3 100644 --- a/vc-hgcmd.el +++ b/vc-hgcmd.el @@ -446,7 +446,7 @@ Insert 'Running command' and display buffer text if COMMAND" "Call UPDATE-FUNCTION with status for files in DIR or FILES." ;; TODO track file renames with -C option (let ((command (if files - (nconc (list "status" "-A") files) + (nconc (list "status" "-A") (mapcar #'file-relative-name files)) (list "status" (file-relative-name dir))))) (vc-hgcmd--run-command (make-vc-hgcmd--command @@ -496,7 +496,7 @@ Insert 'Running command' and display buffer text if COMMAND" (defun vc-hgcmd-working-revision (file) "Working revision. Return repository working revision if FILE is committed." - (if (and file (eq 'added (vc-state file))) + (if (and file (eq 'added (vc-state (file-relative-name file)))) "0" (or (vc-hgcmd-command "log" "-l" "1" "-f" "-T" "{rev}") "0"))) @@ -506,7 +506,7 @@ Insert 'Running command' and display buffer text if COMMAND" (defun vc-hgcmd-mode-line-string (file) "Return a string for `vc-mode-line' to put in the mode line for FILE." - (let* ((state (vc-state file)) + (let* ((state (vc-state (file-relative-name file))) (state-echo nil) (face nil) ;; TODO allow to customize it. @@ -551,7 +551,7 @@ Insert 'Running command' and display buffer text if COMMAND" (defun vc-hgcmd-register (files &optional _comment) "Register FILES." - (apply #'vc-hgcmd-command (nconc (list "add") files))) + (apply #'vc-hgcmd-command (nconc (list "add") (mapcar #'file-relative-name files)))) (defalias 'vc-hgcmd-responsible-p 'vc-hgcmd-root) @@ -559,7 +559,7 @@ Insert 'Running command' and display buffer text if COMMAND" (defun vc-hgcmd-unregister (file) "Forget FILE." - (vc-hgcmd-command "forget" file)) + (vc-hgcmd-command "forget" (file-relative-name file))) (declare-function log-edit-extract-headers "log-edit" (headers string)) (declare-function log-edit-toggle-header "log-edit" (header value)) @@ -583,11 +583,12 @@ Insert 'Running command' and display buffer text if COMMAND" ("Amend" . vc-hgcmd--arg-amend) ("Close-branch" . vc-hgcmd--arg-close-branch)) (encode-coding-string comment 'utf-8)) - files))) + (mapcar #'file-relative-name files)))) (defun vc-hgcmd-find-revision (file rev buffer) "Put REV of FILE to BUFFER." - (apply #'vc-hgcmd-command-output-buffer buffer (if rev (list "cat" "-r" rev file) (list "cat" file)))) + (let ((file (file-relative-name file))) + (apply #'vc-hgcmd-command-output-buffer buffer (if rev (list "cat" "-r" rev file) (list "cat" file))))) (defun vc-hgcmd-checkout (file &optional rev) "Retrieve revision REV of FILE." @@ -596,7 +597,7 @@ Insert 'Running command' and display buffer text if COMMAND" (defun vc-hgcmd-revert (file &optional contents-done) "Refert FILE if not CONTENTS-DONE." (unless contents-done - (vc-hgcmd-command "revert" file))) + (vc-hgcmd-command "revert" (file-relative-name file)))) (defun vc-hgcmd-merge-branch () "Merge." @@ -623,7 +624,7 @@ Insert 'Running command' and display buffer text if COMMAND" (defun vc-hgcmd-mark-resolved (files) "Mark FILES resolved." - (apply #'vc-hgcmd-command (nconc (list "resolve" "-m") files))) + (apply #'vc-hgcmd-command (nconc (list "resolve" "-m") (mapcar #'file-relative-name files)))) (defun vc-hgcmd-print-log (files buffer &optional shortlog start-revision limit) "Put maybe SHORTLOG log of FILES to BUFFER starting with START-REVISION limited by LIMIT." @@ -637,7 +638,7 @@ Insert 'Running command' and display buffer text if COMMAND" (list (if (eq limit 1) "-r" "-b") start-revision)) (when limit (list "-l" (number-to-string limit))) (unless (or shortlog (eq limit 1)) (list "-f")) ; follow file renames - (unless (equal files (list default-directory)) files)))) + (unless (equal files (list default-directory)) (mapcar #'file-relative-name files))))) ;; If limit is 1 or vc-log-show-limit then it is initial diff and better move to working revision ;; otherwise remember point position and restore it later (let ((p (with-current-buffer buffer (unless (or (member limit (list 1 vc-log-show-limit))) (point))))) @@ -704,7 +705,7 @@ Insert 'Running command' and display buffer text if COMMAND" (list "diff") (when rev1 (list "-r" rev1)) (when rev2 (list "-r" rev2)) - (unless (equal files (list default-directory)) files)))) + (unless (equal files (list default-directory)) (mapcar #'file-relative-name files))))) (apply #'vc-hgcmd-command-output-buffer buffer command))) (defun vc-hgcmd-revision-completion-table (_files) @@ -727,7 +728,7 @@ Insert 'Running command' and display buffer text if COMMAND" (nconc (list "annotate" "-qdnuf") (when revision (list "-r" revision)) - (list file))) + (list (file-relative-name file)))) ;; hide filenames but keep it in properties (with-current-buffer buffer (let ((inhibit-read-only t)) @@ -833,7 +834,7 @@ Insert 'Running command' and display buffer text if COMMAND" (defun vc-hgcmd-delete-file (file) "Delete FILE." - (vc-hgcmd-command "remove" "--force" file)) + (vc-hgcmd-command "remove" "--force" (file-relative-name file))) (defun vc-hgcmd-rename-file (old new) "Rename file from OLD to NEW using `hg mv'." @@ -841,7 +842,7 @@ Insert 'Running command' and display buffer text if COMMAND" (defun vc-hgcmd--file-unresolved-p (file) "Return t if FILE is in conflict state." - (let ((out (vc-hgcmd-command "resolve" "-l" file))) + (let ((out (vc-hgcmd-command "resolve" "-l" (file-relative-name file)))) (and out (eq (aref out 0) ?U)))) (defun vc-hgcmd--after-save-hook ()