summaryrefslogtreecommitdiff
path: root/lisp/vc/log-view.el
diff options
context:
space:
mode:
authorDmitry Gutov <dgutov@yandex.ru>2013-07-31 15:22:10 +0300
committerDmitry Gutov <dgutov@yandex.ru>2013-07-31 15:22:10 +0300
commit2412ee1af63c6cc8f4a85919cc78e59cb6ec83e3 (patch)
tree1be683d823d01e50d6677bf703672901b24d3c1c /lisp/vc/log-view.el
parent4c131798b5ab25557bfbc9a8b94c05fcdd195069 (diff)
downloademacs-2412ee1af63c6cc8f4a85919cc78e59cb6ec83e3.tar.gz
emacs-2412ee1af63c6cc8f4a85919cc78e59cb6ec83e3.tar.bz2
emacs-2412ee1af63c6cc8f4a85919cc78e59cb6ec83e3.zip
* lisp/vc/log-view.el (log-view-diff): Extract `log-view-diff-common',
use it. (log-view-diff-changeset): Same. (log-view-diff-common): Call backend command `previous-revision' to find out the previous revision, in both cases. Swap the variables `to' and `fr', so that `fr' usually refers to the earlier revision. Fixes: debbugs:14989
Diffstat (limited to 'lisp/vc/log-view.el')
-rw-r--r--lisp/vc/log-view.el43
1 files changed, 20 insertions, 23 deletions
diff --git a/lisp/vc/log-view.el b/lisp/vc/log-view.el
index de103c0cdb6..be985866532 100644
--- a/lisp/vc/log-view.el
+++ b/lisp/vc/log-view.el
@@ -562,19 +562,7 @@ file(s)."
(interactive
(list (if (use-region-p) (region-beginning) (point))
(if (use-region-p) (region-end) (point))))
- (let ((fr (log-view-current-tag beg))
- (to (log-view-current-tag end)))
- (when (string-equal fr to)
- (save-excursion
- (goto-char end)
- (log-view-msg-next)
- (setq to (log-view-current-tag))))
- (vc-diff-internal
- t (list log-view-vc-backend
- (if log-view-per-file-logs
- (list (log-view-current-file))
- log-view-vc-fileset))
- to fr)))
+ (log-view-diff-common beg end))
(defun log-view-diff-changeset (beg end)
"Get the diff between two revisions.
@@ -589,20 +577,29 @@ considered file(s)."
(interactive
(list (if (use-region-p) (region-beginning) (point))
(if (use-region-p) (region-end) (point))))
- (when (eq (vc-call-backend log-view-vc-backend 'revision-granularity) 'file)
+ (log-view-diff-common beg end t))
+
+(defun log-view-diff-common (beg end &optional whole-changeset)
+ (when (and whole-changeset
+ (eq (vc-call-backend log-view-vc-backend 'revision-granularity)
+ 'file))
(error "The %s backend does not support changeset diffs" log-view-vc-backend))
- (let ((fr (log-view-current-tag beg))
- (to (log-view-current-tag end)))
+ (let ((to (log-view-current-tag beg))
+ (fr (log-view-current-tag end)))
(when (string-equal fr to)
;; TO and FR are the same, look at the previous revision.
- (setq to (vc-call-backend log-view-vc-backend 'previous-revision nil fr)))
+ (setq fr (vc-call-backend log-view-vc-backend 'previous-revision nil fr)))
(vc-diff-internal
- t
- ;; We want to see the diff for all the files in the changeset, so
- ;; pass NIL for the file list. The value passed here should
- ;; follow what `vc-deduce-fileset' returns.
- (list log-view-vc-backend nil)
- to fr)))
+ t (list log-view-vc-backend
+ ;; The value passed here should follow what
+ ;; `vc-deduce-fileset' returns. If we want to see the
+ ;; diff for all the files in the changeset, pass NIL for
+ ;; the file list.
+ (unless whole-changeset
+ (if log-view-per-file-logs
+ (list (log-view-current-file))
+ log-view-vc-fileset)))
+ fr to)))
(provide 'log-view)