aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorEric S. Raymond2007-10-11 15:13:29 +0000
committerEric S. Raymond2007-10-11 15:13:29 +0000
commit727c4443eb4bae3035dbdcb64ca6babc98e099c3 (patch)
tree86c5b323a58eed8e8ba87f83671adda30f195d87 /lisp
parent7c8d4ebbc09c3abce3372165339521feec1f533e (diff)
downloademacs-727c4443eb4bae3035dbdcb64ca6babc98e099c3.tar.gz
emacs-727c4443eb4bae3035dbdcb64ca6babc98e099c3.zip
Address an edge case in vc-diff. This is an experimental fix and may change.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/vc.el45
2 files changed, 34 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index af7283ec15c..a9cb2da7056 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -6,6 +6,9 @@
6 6
72007-10-11 Eric S. Raymond <esr@snark.thyrsus.com> 72007-10-11 Eric S. Raymond <esr@snark.thyrsus.com>
8 8
9 * vc.el: Address an edge case in vc-diff pointed out by
10 Juanma Barranquero. This is an experimental fix and may change.
11
9 * vc-hooks.el (vc-registered): Robustify this function a bit 12 * vc-hooks.el (vc-registered): Robustify this function a bit
10 against filenames with no directory component. 13 against filenames with no directory component.
11 14
diff --git a/lisp/vc.el b/lisp/vc.el
index 5505b13e49b..932f221a077 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -1985,24 +1985,41 @@ returns t if the buffer had changes, nil otherwise."
1985 (error "Not a valid revision range.")) 1985 (error "Not a valid revision range."))
1986 (vc-diff-internal backend t files rev1 rev2 (interactive-p))) 1986 (vc-diff-internal backend t files rev1 rev2 (interactive-p)))
1987 1987
1988(defun vc-contains-version-controlled-file (dir)
1989 "Return t if DIR contains a version-controlled file, nil otherwise."
1990 (catch 'found
1991 (mapc (lambda (f) (and (not (file-directory-p f)) (vc-backend f) (throw 'found 't))) (directory-files dir))
1992 nil))
1993
1988;;;###autoload 1994;;;###autoload
1989(defun vc-diff (historic) 1995(defun vc-diff (historic)
1990 "Display diffs between file revisions. 1996 "Display diffs between file revisions.
1991Normally this compares the current file and buffer with the most 1997Normally this compares the currently selected fileset with their
1992recent checked in revision of that file. This uses no arguments. With 1998working revisions. With a prefix argument HISTORIC, it reads two revision
1993a prefix argument HISTORIC, it reads the file name to use and two 1999designators specifying which revisions to compare.
1994revision designators specifying which revisions to compare." 2000
2001If no current fileset is available (that is, we are not in
2002VC-Dired mode and the visited file of the current buffer is not
2003under version control) behave specially; if there are
2004version-controlled files in the current directory, treat all
2005version-controlled files recursively beneath the current
2006directory as the selected fileset.
2007"
2008
1995 (interactive "P") 2009 (interactive "P")
1996 (if historic 2010 (cond ((not (vc-contains-version-controlled-file default-directory))
1997 (call-interactively 'vc-history-diff) 2011 (error "No version-controlled files directly beneath default directory"))
1998 (let* ((files (vc-deduce-fileset t)) 2012 (historic
1999 (first (car files)) 2013 (call-interactively 'vc-history-diff))
2000 (backend 2014 (t
2001 (cond ((file-directory-p first) 2015 (let* ((files (vc-deduce-fileset t))
2002 (vc-responsible-backend first)) 2016 (first (car files))
2003 (t 2017 (backend
2004 (vc-backend first))))) 2018 (cond ((file-directory-p first)
2005 (vc-diff-internal backend t files nil nil (interactive-p))))) 2019 (vc-responsible-backend first))
2020 (t
2021 (vc-backend first)))))
2022 (vc-diff-internal backend t files nil nil (interactive-p))))))
2006 2023
2007;;;###autoload 2024;;;###autoload
2008(defun vc-revision-other-window (rev) 2025(defun vc-revision-other-window (rev)