Commit 2412ee1a authored by Dmitry Gutov's avatar Dmitry Gutov
Browse files

* 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
parent 4c131798
2013-07-31 Dmitry Gutov <dgutov@yandex.ru>
* 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 (Bug#14989).
2013-07-31 Kan-Ru Chen <kanru@kanru.info> 2013-07-31 Kan-Ru Chen <kanru@kanru.info>
* ibuf-ext.el (ibuffer-filter-by-filename): * ibuf-ext.el (ibuffer-filter-by-filename):
......
...@@ -562,19 +562,7 @@ file(s)." ...@@ -562,19 +562,7 @@ file(s)."
(interactive (interactive
(list (if (use-region-p) (region-beginning) (point)) (list (if (use-region-p) (region-beginning) (point))
(if (use-region-p) (region-end) (point)))) (if (use-region-p) (region-end) (point))))
(let ((fr (log-view-current-tag beg)) (log-view-diff-common beg end))
(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)))
(defun log-view-diff-changeset (beg end) (defun log-view-diff-changeset (beg end)
"Get the diff between two revisions. "Get the diff between two revisions.
...@@ -589,20 +577,29 @@ considered file(s)." ...@@ -589,20 +577,29 @@ considered file(s)."
(interactive (interactive
(list (if (use-region-p) (region-beginning) (point)) (list (if (use-region-p) (region-beginning) (point))
(if (use-region-p) (region-end) (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)) (error "The %s backend does not support changeset diffs" log-view-vc-backend))
(let ((fr (log-view-current-tag beg)) (let ((to (log-view-current-tag beg))
(to (log-view-current-tag end))) (fr (log-view-current-tag end)))
(when (string-equal fr to) (when (string-equal fr to)
;; TO and FR are the same, look at the previous revision. ;; 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 (vc-diff-internal
t t (list log-view-vc-backend
;; We want to see the diff for all the files in the changeset, so ;; The value passed here should follow what
;; pass NIL for the file list. The value passed here should ;; `vc-deduce-fileset' returns. If we want to see the
;; follow what `vc-deduce-fileset' returns. ;; diff for all the files in the changeset, pass NIL for
(list log-view-vc-backend nil) ;; the file list.
to fr))) (unless whole-changeset
(if log-view-per-file-logs
(list (log-view-current-file))
log-view-vc-fileset)))
fr to)))
(provide 'log-view) (provide 'log-view)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment