diff options
Diffstat (limited to 'lisp/vc')
| -rw-r--r-- | lisp/vc/cvs-status.el | 2 | ||||
| -rw-r--r-- | lisp/vc/ediff-util.el | 1 | ||||
| -rw-r--r-- | lisp/vc/vc-git.el | 28 |
3 files changed, 30 insertions, 1 deletions
diff --git a/lisp/vc/cvs-status.el b/lisp/vc/cvs-status.el index dc43094796e..cf1f49cbeee 100644 --- a/lisp/vc/cvs-status.el +++ b/lisp/vc/cvs-status.el @@ -1,4 +1,4 @@ -;;; cvs-status.el --- major mode for browsing `cvs status' output -*- coding: utf-8; lexical-binding: t -*- +;;; cvs-status.el --- major mode for browsing `cvs status' output -*- lexical-binding: t -*- ;; Copyright (C) 1999-2015 Free Software Foundation, Inc. diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el index e664f9fdac3..7ef425449c1 100644 --- a/lisp/vc/ediff-util.el +++ b/lisp/vc/ediff-util.el @@ -3348,6 +3348,7 @@ Without an argument, it saves customized diff argument, if available (setq wind (ediff-get-visible-buffer-window cloned-buff)) (select-window wind) (delete-other-windows) + (or (mark) (push-mark)) (ediff-activate-mark) (split-window-vertically) (ediff-select-lowest-window) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 2f0439365e8..b5570323e03 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -974,6 +974,34 @@ or BRANCH^ (where \"^\" can be repeated)." (buffer-string)))) (defun vc-git-region-history (file buffer lfrom lto) + ;; The "git log" command below interprets the line numbers as applying + ;; to the HEAD version of the file, not to the current state of the file. + ;; So we need to look at all the local changes and adjust lfrom/lto + ;; accordingly. + ;; FIXME: Maybe this should be done in vc.el (i.e. for all backends), but + ;; since Git is the only backend to support this operation so far, it's hard + ;; to tell. + (with-temp-buffer + (vc-call-backend 'git 'diff file "HEAD" nil (current-buffer)) + (goto-char (point-min)) + (let ((last-offset 0) + (from-offset nil) + (to-offset nil)) + (while (re-search-forward + "^@@ -\\([0-9]+\\),\\([0-9]+\\) \\+\\([0-9]+\\),\\([0-9]+\\) @@" nil t) + (let ((headno (string-to-number (match-string 1))) + (headcnt (string-to-number (match-string 2))) + (curno (string-to-number (match-string 3))) + (curcnt (string-to-number (match-string 4)))) + (cl-assert (equal (- curno headno) last-offset)) + (and (null from-offset) (> curno lfrom) + (setq from-offset last-offset)) + (and (null to-offset) (> curno lto) + (setq to-offset last-offset)) + (setq last-offset + (- (+ curno curcnt) (+ headno headcnt))))) + (setq lto (- lto (or to-offset last-offset))) + (setq lfrom (- lfrom (or to-offset last-offset))))) (vc-git-command buffer 'async nil "log" "-p" ;"--follow" ;FIXME: not supported? (format "-L%d,%d:%s" lfrom lto (file-relative-name file)))) |
