Mercurial > emacs
comparison lisp/vc.el @ 85165:9b4cc51391e5
Address an edge case in vc-diff. This is an experimental fix and may change.
author | Eric S. Raymond <esr@snark.thyrsus.com> |
---|---|
date | Thu, 11 Oct 2007 15:10:32 +0000 |
parents | 8ba0e30716a5 |
children | a264636b5c98 |
comparison
equal
deleted
inserted
replaced
85164:497e90db3e18 | 85165:9b4cc51391e5 |
---|---|
1983 (list backend files rev1 rev2)))) | 1983 (list backend files rev1 rev2)))) |
1984 (if (and (not rev1) rev2) | 1984 (if (and (not rev1) rev2) |
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) |
2009 "Visit revision REV of the current file in another window. | 2026 "Visit revision REV of the current file in another window. |
2010 If the current file is named `F', the revision is named `F.~REV~'. | 2027 If the current file is named `F', the revision is named `F.~REV~'. |