emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-25 f4747f6: Use 'hg id' in vc-hg-previous-revision


From: Dmitry Gutov
Subject: [Emacs-diffs] emacs-25 f4747f6: Use 'hg id' in vc-hg-previous-revision
Date: Fri, 18 Dec 2015 04:59:19 +0000

branch: emacs-25
commit f4747f6c51a07522ea4d9863b20357489f03ce69
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    Use 'hg id' in vc-hg-previous-revision
    
    * lisp/vc/vc-hg.el (vc-hg-previous-revision):
    Use 'hg id' to retrieve it (bug#22032).
---
 lisp/vc/vc-hg.el |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index dd897ad..62fbfde 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -430,9 +430,13 @@ Optional arg REVISION is a revision to annotate from."
 ;;; Miscellaneous
 
 (defun vc-hg-previous-revision (_file rev)
-  (let ((newrev (1- (string-to-number rev))))
-    (when (>= newrev 0)
-      (number-to-string newrev))))
+  ;; We can't simply decrement by 1, because that revision might be
+  ;; e.g. on a different branch (bug#22032).
+  (with-temp-buffer
+    (and (eq 0
+             (vc-hg-command t nil nil "id" "-n" "-r" (concat rev "^")))
+         ;; Trim the trailing newline.
+         (buffer-substring (point-min) (1- (point-max))))))
 
 (defun vc-hg-next-revision (_file rev)
   (let ((newrev (1+ (string-to-number rev)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]