branch: externals/vc-hgcmd commit ce3670715d03cc9c07657e1b32ee7669bdb3e3d3 Author: muffinmad <andreyk....@gmail.com> Commit: muffinmad <andreyk....@gmail.com>
Find proper filename across renames on diff --- vc-hgcmd.el | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/vc-hgcmd.el b/vc-hgcmd.el index 9e004bf..7526b40 100644 --- a/vc-hgcmd.el +++ b/vc-hgcmd.el @@ -5,7 +5,7 @@ ;; Author: Andrii Kolomoiets <andreyk....@gmail.com> ;; Keywords: vc ;; URL: https://github.com/muffinmad/emacs-vc-hgcmd -;; Package-Version: 1.6 +;; Package-Version: 1.6.1 ;; Package-Requires: ((emacs "25.1")) ;; This file is NOT part of GNU Emacs. @@ -537,7 +537,7 @@ Insert output to process buffer and check if amount of data is enought to parse (?! . missing) (?? . unregistered) (?M . edited) - (? . origin)) + (?\s . origin)) "Translation for status command output.") (defconst vc-hgcmd--translation-resolve '((?U . conflict) @@ -1090,7 +1090,9 @@ Insert output to process buffer and check if amount of data is enought to parse (list "diff") (when rev1 (list "-r" rev1)) (when rev2 (list "-r" rev2)) - (unless (equal files (list default-directory)) (mapcar #'vc-hgcmd--file-relative-name files))))) + (unless (equal files (list default-directory)) + (let ((files (mapcar #'vc-hgcmd--file-relative-name files))) + (if rev2 (vc-hgcmd--file-name-at-rev files rev2) files)))))) (apply #'vc-hgcmd-command-to-buffer buffer command))) (defun vc-hgcmd-revision-completion-table (&optional _files) @@ -1103,14 +1105,20 @@ Insert output to process buffer and check if amount of data is enought to parse "\\([0-9]\\{4\\}-[0-1][0-9]-[0-3][0-9]\\)[^:]*: " )) -(defun vc-hgcmd--file-name-at-rev (file rev) - "Return filename of FILE at REV." +(defun vc-hgcmd--file-name-at-rev (files rev) + "Return filename of FILES at REV." (or (with-temp-buffer - (when (vc-hgcmd--run-command (make-vc-hgcmd--command :command (list "status" "--rev" rev "-C" file) :output-buffer (current-buffer) :wait t)) + (when (vc-hgcmd--run-command (make-vc-hgcmd--command :command (nconc (list "status" "--rev" rev "-C") files) :output-buffer (current-buffer) :wait t)) (goto-char (point-min)) - (when (search-forward-regexp "^ \\(.+\\)$" nil t) - (match-string-no-properties 1)))) - file)) + (let (result) + (while (not (eobp)) + (unless (save-excursion + (forward-line) + (and (point-at-bol) (eq (char-after) ?\s))) + (push (buffer-substring-no-properties (+ (point) 2) (line-end-position)) result)) + (forward-line)) + result))) + files)) (defun vc-hgcmd-annotate-command (file buffer &optional revision) "Annotate REVISION of FILE to BUFFER." @@ -1118,7 +1126,7 @@ Insert output to process buffer and check if amount of data is enought to parse (nconc (list "annotate" "-qdnu") (when revision (list "-r" revision)) - (list (vc-hgcmd--file-name-at-rev (vc-hgcmd--file-relative-name file) revision))))) + (vc-hgcmd--file-name-at-rev (list (vc-hgcmd--file-relative-name file)) revision)))) (declare-function vc-annotate-convert-time "vc-annotate" (&optional time))