diff options
| author | Alexandre Julliard | 2009-03-13 20:04:11 +0000 |
|---|---|---|
| committer | Alexandre Julliard | 2009-03-13 20:04:11 +0000 |
| commit | 4537363ca5f2b030f14549ba25608d367ce7d2f1 (patch) | |
| tree | 83b2c124ed0d4c63323517eeb3d3154cba5e13f1 | |
| parent | 75aeb229d2845da22444244cb489ec9695bfe725 (diff) | |
| download | emacs-4537363ca5f2b030f14549ba25608d367ce7d2f1.tar.gz emacs-4537363ca5f2b030f14549ba25608d367ce7d2f1.zip | |
* vc-git.el (vc-git-previous-revision, vc-git-next-revision):
Fall back to original commit if vc-git-symbolic-commit fails to
find a symbolic name.
(vc-git-symbolic-commit): Don't limit search to tags. Treat
"undefined" as an error. (Bug #2110)
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/vc-git.el | 66 |
2 files changed, 42 insertions, 32 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 49e62d952b7..21c19c8b95b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2009-03-13 Alexandre Julliard <julliard@winehq.org> | ||
| 2 | |||
| 3 | * vc-git.el (vc-git-previous-revision, vc-git-next-revision): | ||
| 4 | Fall back to original commit if vc-git-symbolic-commit fails to | ||
| 5 | find a symbolic name. | ||
| 6 | (vc-git-symbolic-commit): Don't limit search to tags. Treat | ||
| 7 | "undefined" as an error. (Bug #2110) | ||
| 8 | |||
| 1 | 2009-03-13 D. Goel <deego3@gmail.com> | 9 | 2009-03-13 D. Goel <deego3@gmail.com> |
| 2 | 10 | ||
| 3 | * ibuf-ext.el: | 11 | * ibuf-ext.el: |
diff --git a/lisp/vc-git.el b/lisp/vc-git.el index 64d598c271a..9155fba053f 100644 --- a/lisp/vc-git.el +++ b/lisp/vc-git.el | |||
| @@ -576,19 +576,19 @@ or BRANCH^ (where \"^\" can be repeated)." | |||
| 576 | (defun vc-git-previous-revision (file rev) | 576 | (defun vc-git-previous-revision (file rev) |
| 577 | "Git-specific version of `vc-previous-revision'." | 577 | "Git-specific version of `vc-previous-revision'." |
| 578 | (if file | 578 | (if file |
| 579 | (let ((default-directory (file-name-directory (expand-file-name file))) | 579 | (let* ((default-directory (file-name-directory (expand-file-name file))) |
| 580 | (file (file-name-nondirectory file))) | 580 | (file (file-name-nondirectory file)) |
| 581 | (vc-git-symbolic-commit | 581 | (prev-rev (with-temp-buffer |
| 582 | (with-temp-buffer | 582 | (and |
| 583 | (and | 583 | (vc-git--out-ok "rev-list" "-2" rev "--" file) |
| 584 | (vc-git--out-ok "rev-list" "-2" rev "--" file) | 584 | (goto-char (point-max)) |
| 585 | (goto-char (point-max)) | 585 | (bolp) |
| 586 | (bolp) | 586 | (zerop (forward-line -1)) |
| 587 | (zerop (forward-line -1)) | 587 | (not (bobp)) |
| 588 | (not (bobp)) | 588 | (buffer-substring-no-properties |
| 589 | (buffer-substring-no-properties | 589 | (point) |
| 590 | (point) | 590 | (1- (point-max))))))) |
| 591 | (1- (point-max))))))) | 591 | (or (vc-git-symbolic-commit prev-rev) prev-rev)) |
| 592 | (with-temp-buffer | 592 | (with-temp-buffer |
| 593 | (and | 593 | (and |
| 594 | (vc-git--out-ok "rev-parse" (concat rev "^")) | 594 | (vc-git--out-ok "rev-parse" (concat rev "^")) |
| @@ -609,18 +609,19 @@ or BRANCH^ (where \"^\" can be repeated)." | |||
| 609 | (bobp) | 609 | (bobp) |
| 610 | (buffer-substring-no-properties | 610 | (buffer-substring-no-properties |
| 611 | (point) | 611 | (point) |
| 612 | (1- (point-max))))))) | 612 | (1- (point-max)))))) |
| 613 | (and current-rev | 613 | (next-rev |
| 614 | (vc-git-symbolic-commit | 614 | (and current-rev |
| 615 | (with-temp-buffer | 615 | (with-temp-buffer |
| 616 | (and | 616 | (and |
| 617 | (vc-git--out-ok "rev-list" "HEAD" "--" file) | 617 | (vc-git--out-ok "rev-list" "HEAD" "--" file) |
| 618 | (goto-char (point-min)) | 618 | (goto-char (point-min)) |
| 619 | (search-forward current-rev nil t) | 619 | (search-forward current-rev nil t) |
| 620 | (zerop (forward-line -1)) | 620 | (zerop (forward-line -1)) |
| 621 | (buffer-substring-no-properties | 621 | (buffer-substring-no-properties |
| 622 | (point) | 622 | (point) |
| 623 | (progn (forward-line 1) (1- (point)))))))))) | 623 | (progn (forward-line 1) (1- (point))))))))) |
| 624 | (or (vc-git-symbolic-commit next-rev) next-rev))) | ||
| 624 | 625 | ||
| 625 | (defun vc-git-delete-file (file) | 626 | (defun vc-git-delete-file (file) |
| 626 | (vc-git-command nil 0 file "rm" "-f" "--")) | 627 | (vc-git-command nil 0 file "rm" "-f" "--")) |
| @@ -731,13 +732,14 @@ The difference to vc-do-command is that this function always invokes `git'." | |||
| 731 | "Translate COMMIT string into symbolic form. | 732 | "Translate COMMIT string into symbolic form. |
| 732 | Returns nil if not possible." | 733 | Returns nil if not possible." |
| 733 | (and commit | 734 | (and commit |
| 734 | (with-temp-buffer | 735 | (let ((name (with-temp-buffer |
| 735 | (and | 736 | (and |
| 736 | (vc-git--out-ok "name-rev" "--name-only" "--tags" commit) | 737 | (vc-git--out-ok "name-rev" "--name-only" commit) |
| 737 | (goto-char (point-min)) | 738 | (goto-char (point-min)) |
| 738 | (= (forward-line 2) 1) | 739 | (= (forward-line 2) 1) |
| 739 | (bolp) | 740 | (bolp) |
| 740 | (buffer-substring-no-properties (point-min) (1- (point-max))))))) | 741 | (buffer-substring-no-properties (point-min) (1- (point-max))))))) |
| 742 | (and name (not (string= name "undefined")) name)))) | ||
| 741 | 743 | ||
| 742 | (provide 'vc-git) | 744 | (provide 'vc-git) |
| 743 | 745 | ||