diff options
| author | Eric S. Raymond | 2007-10-11 15:13:29 +0000 |
|---|---|---|
| committer | Eric S. Raymond | 2007-10-11 15:13:29 +0000 |
| commit | 727c4443eb4bae3035dbdcb64ca6babc98e099c3 (patch) | |
| tree | 86c5b323a58eed8e8ba87f83671adda30f195d87 | |
| parent | 7c8d4ebbc09c3abce3372165339521feec1f533e (diff) | |
| download | emacs-727c4443eb4bae3035dbdcb64ca6babc98e099c3.tar.gz emacs-727c4443eb4bae3035dbdcb64ca6babc98e099c3.zip | |
Address an edge case in vc-diff. This is an experimental fix and may change.
| -rw-r--r-- | lisp/ChangeLog | 3 | ||||
| -rw-r--r-- | lisp/vc.el | 45 |
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 | ||
| 7 | 2007-10-11 Eric S. Raymond <esr@snark.thyrsus.com> | 7 | 2007-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. |
| 1991 | Normally this compares the current file and buffer with the most | 1997 | Normally this compares the currently selected fileset with their |
| 1992 | recent checked in revision of that file. This uses no arguments. With | 1998 | working revisions. With a prefix argument HISTORIC, it reads two revision |
| 1993 | a prefix argument HISTORIC, it reads the file name to use and two | 1999 | designators specifying which revisions to compare. |
| 1994 | revision designators specifying which revisions to compare." | 2000 | |
| 2001 | If no current fileset is available (that is, we are not in | ||
| 2002 | VC-Dired mode and the visited file of the current buffer is not | ||
| 2003 | under version control) behave specially; if there are | ||
| 2004 | version-controlled files in the current directory, treat all | ||
| 2005 | version-controlled files recursively beneath the current | ||
| 2006 | directory 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) |