diff options
| author | Dmitry Gutov | 2015-12-18 06:58:49 +0200 |
|---|---|---|
| committer | Dmitry Gutov | 2015-12-18 06:59:03 +0200 |
| commit | f4747f6c51a07522ea4d9863b20357489f03ce69 (patch) | |
| tree | 2fd39fcadb13a2ebf9b45df0c996bcc676531dfe | |
| parent | ecce24b34ba51f10d2a729bf5496a1cbec0bf329 (diff) | |
| download | emacs-f4747f6c51a07522ea4d9863b20357489f03ce69.tar.gz emacs-f4747f6c51a07522ea4d9863b20357489f03ce69.zip | |
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).
| -rw-r--r-- | 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 dd897adc59c..62fbfde5f87 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." | |||
| 430 | ;;; Miscellaneous | 430 | ;;; Miscellaneous |
| 431 | 431 | ||
| 432 | (defun vc-hg-previous-revision (_file rev) | 432 | (defun vc-hg-previous-revision (_file rev) |
| 433 | (let ((newrev (1- (string-to-number rev)))) | 433 | ;; We can't simply decrement by 1, because that revision might be |
| 434 | (when (>= newrev 0) | 434 | ;; e.g. on a different branch (bug#22032). |
| 435 | (number-to-string newrev)))) | 435 | (with-temp-buffer |
| 436 | (and (eq 0 | ||
| 437 | (vc-hg-command t nil nil "id" "-n" "-r" (concat rev "^"))) | ||
| 438 | ;; Trim the trailing newline. | ||
| 439 | (buffer-substring (point-min) (1- (point-max)))))) | ||
| 436 | 440 | ||
| 437 | (defun vc-hg-next-revision (_file rev) | 441 | (defun vc-hg-next-revision (_file rev) |
| 438 | (let ((newrev (1+ (string-to-number rev))) | 442 | (let ((newrev (1+ (string-to-number rev))) |