From 1c6c854ec7faf9184115245c7e300df89f1795bc Mon Sep 17 00:00:00 2001 From: Christoph Scholtes Date: Wed, 20 Apr 2011 14:33:09 -0300 Subject: [PATCH] * lisp/vc/vc.el (vc-diff-build-argument-list-internal) (vc-version-ediff, vc-ediff): New functions. (vc-version-diff): Use vc-diff-build-argument-list-internal. * doc/emacs/maintaining.texi (Old Revisions): Add paragraph on new function vc-ediff. * etc/NEWS: Document new function `vc-ediff'. --- doc/emacs/ChangeLog | 191 +++++++++++++++++++------------------ doc/emacs/maintaining.texi | 7 ++ etc/ChangeLog | 4 + etc/NEWS | 3 + lisp/ChangeLog | 6 ++ lisp/vc/vc.el | 118 ++++++++++++++++------- 6 files changed, 200 insertions(+), 129 deletions(-) diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 47aa395c730..d20c529f043 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,8 @@ +2011-04-20 Christoph Scholtes + + * maintaining.texi (Old Revisions): Add paragraph on new function + vc-ediff. + 2011-03-26 Chong Yidong * display.texi (Auto Scrolling): Fix scroll-up/scroll-down confusion. @@ -22,8 +27,8 @@ 2011-03-09 Eli Zaretskii - * ack.texi (Acknowledgments): Convert to ISO-8859-1 encoding. Use - Texinfo @-commands for non Latin-1 characters. + * ack.texi (Acknowledgments): Convert to ISO-8859-1 encoding. + Use Texinfo @-commands for non Latin-1 characters. * makefile.w32-in (MAKEINFO_OPTS): Add --enable-encoding. @@ -231,8 +236,8 @@ (Old Revisions): Document revert-buffer for vc-diff. (Log Buffer): Promote to a subsection. Document header lines. - * macos.texi (Mac / GNUstep Basics): Document - ns-right-alternate-modifier. + * macos.texi (Mac / GNUstep Basics): + Document ns-right-alternate-modifier. * emacs.texi (Top): Update node listing. @@ -553,8 +558,8 @@ mail-self-blind, mail-default-reply-to, and mail-archive-file-name in favor of mail-default-headers. Ad index entries for user-full-name and user-mail-address. - (Citing Mail): Update changes in Message mode behavior. Document - mail-yank-prefix. + (Citing Mail): Update changes in Message mode behavior. + Document mail-yank-prefix. (Mail Signature): New node, moved from Mail Misc. (Mail Aliases): Mail abbrevs are the default with Message mode. (Mail Methods): Note that Message mode is now the default. @@ -724,8 +729,8 @@ * files.texi (Visiting): * buffers.texi (Buffers): Max buffer size is now 512 MB. - * frames.texi (Cut/Paste Other App): Document - save-interprogram-paste-before-kill. + * frames.texi (Cut/Paste Other App): + Document save-interprogram-paste-before-kill. * killing.texi (Kill Options): New node. @@ -813,8 +818,8 @@ * entering.texi (Exiting): C-z is now bound to suspend-frame. * custom.texi (Init Examples): Replace Rumseld with Cheny (Bug#3519). - (Key Bindings): Reference Init Rebinding in introductory text. Shift - some of the introduction to Keymaps node. + (Key Bindings): Reference Init Rebinding in introductory text. + Shift some of the introduction to Keymaps node. (Keymaps): Simplify. (Local Keymaps): Simplify. Move binding example to Init Rebinding. (Minibuffer Maps): Remove mention of Mocklisp. @@ -1080,8 +1085,8 @@ * misc.texi (Interactive Shell, Saving Emacs Sessions) (Shell History Copying, Terminal emulator): Copyedits. - * xresources.texi (Resources): Simplify descriptions. Shorten - description of editres, which is not very useful these days. + * xresources.texi (Resources): Simplify descriptions. + Shorten description of editres, which is not very useful these days. (Table of Resources): Document fontBackend resource. * trouble.texi (Quitting): Add other undo bindings to table. @@ -1102,8 +1107,8 @@ (Enabling Multibyte): Remove obsolete discussion. Copyedits. (Language Environments): Add language environments new to Emacs 23. (Multibyte Conversion): Node deleted. - (Coding Systems): Remove obsolete unify-8859-on-decoding-mode. Don't - mention obsolete emacs-mule coding system. + (Coding Systems): Remove obsolete unify-8859-on-decoding-mode. + Don't mention obsolete emacs-mule coding system. (Output Coding): Copyedits. * emacs.texi (Top): Update node listing. @@ -1159,8 +1164,8 @@ * mini.texi (Completion Commands): Describe Emacs 23 completion rules. (Completion Options): Document read-file-name-completion-ignore-case, - read-buffer-completion-ignore-case, and completion-styles. Remove - description of partial-completion-mode. + read-buffer-completion-ignore-case, and completion-styles. + Remove description of partial-completion-mode. 2009-03-14 Glenn Morris @@ -1582,8 +1587,8 @@ * files.texi (Visiting): Document new behavior of confirm-nonexistent-file-or-buffer. - * buffers.texi (Select Buffer): Document - confirm-nonexistent-file-or-buffer. + * buffers.texi (Select Buffer): + Document confirm-nonexistent-file-or-buffer. * picture-xtra.texi (Picture Mode): Use picture-mode instead of edit-picture. @@ -1708,8 +1713,8 @@ * dired.texi (Dired): Mention C-x C-d too. (Dired Enter): Document M-n in the Dired minibuffer. - (Dired Navigation): Explain dired-goto-file more clearly. Document - dired-isearch-filenames. + (Dired Navigation): Explain dired-goto-file more clearly. + Document dired-isearch-filenames. (Dired Deletion): Remove unnecessary "expunged" terminology. (Flagging Many Files): & is now rebound to `% &'. (Shell Commands in Dired): Document dired-do-async-shell-command. @@ -1731,8 +1736,8 @@ open-paren-in-column-0-is-defun-start more concisely. (Which Function, Program Indent, Info Lookup): Minor edits. (Basic Indent): If region is active, TAB indents the region. - (Multi-line Indent): If region is active, TAB indents the region. Note - that indent-region is useful when Transient Mark mode is off. + (Multi-line Indent): If region is active, TAB indents the region. + Note that indent-region is useful when Transient Mark mode is off. (Matching): The delimiter at the cursor is highlighted---the character changes color. (Symbol Completion): Link to Completion node. @@ -1761,12 +1766,12 @@ 2008-10-31 Chong Yidong - * misc.texi (Document View): Renamed from Document Files, moved here + * misc.texi (Document View): Rename from Document Files, moved here from files.texi. - * files.texi (Version Control): Moved to maintaining.texi. Subnodes - moved as well. - (Document Files): Moved to misc.texi. + * files.texi (Version Control): Move to maintaining.texi. + Subnodes moved as well. + (Document Files): Move to misc.texi. * maintaining.texi (Change Log): Document log-edit-insert-changelog and vc-update-change-log. @@ -1782,8 +1787,8 @@ 2008-10-31 Chong Yidong - * building.texi (Compilation Mode): Document - compilation-auto-jump-to-first-error. + * building.texi (Compilation Mode): + Document compilation-auto-jump-to-first-error. (Debuggers): Lower GUD subsections to subsubsections. (Starting GUD): Add cindex. (Lisp Interaction): Note that scratch is no longer the initial buffer. @@ -1801,8 +1806,8 @@ * emacs.texi (Top): Update node listings. - * misc.texi (Emacs Server): Rewrite. Document daemon-mode. Don't - mention obsolete emacs.bash script. + * misc.texi (Emacs Server): Rewrite. Document daemon-mode. + Don't mention obsolete emacs.bash script. (Invoking emacsclient): Rewrite, moving optional arguments to emacsclient Options. (emacsclient Options): New node. Document server-use-tcp and @@ -1842,7 +1847,7 @@ 2008-10-22 Tassilo Horn - * emacs.texi (Acknowledgments): Added myself to Acknowledgments + * emacs.texi (Acknowledgments): Add myself to Acknowledgments section. 2008-10-21 Chong Yidong @@ -1877,15 +1882,15 @@ crucial to using distributed version control systems. (Comparing Files): Note that diff uses the minibuffer, and that the output is shown using Diff mode. - (Diff Mode): Explain what "patch" and "hunk" mean. Document - diff-update-on-the-fly, diff-refine-hunk, and + (Diff Mode): Explain what "patch" and "hunk" mean. + Document diff-update-on-the-fly, diff-refine-hunk, and diff-show-trailing-whitespaces. (File Archives): Add rar support. * major.texi (Choosing Modes): Make mode selection sequence more obvious by describing the steps in order of priority. Note that - magic-mode-alist is nil by default. Document - magic-fallback-mode-alist. + magic-mode-alist is nil by default. + Document magic-fallback-mode-alist. 2008-10-20 Chong Yidong @@ -1944,8 +1949,8 @@ 2008-10-12 Chong Yidong * mini.texi (Minibuffer File): Add xref to File Names. - (Minibuffer File): Add discussion of `~' in file names. Add - insert-default-directory index reference. + (Minibuffer File): Add discussion of `~' in file names. + Add insert-default-directory index reference. * files.texi (File Names): Reorganize description. (Visiting): Add xref to Mode Line. Copyedits. @@ -1990,8 +1995,8 @@ * msdog-xtra.texi (MS-DOS Printing, MS-DOS and MULE): No need to create cpNNN coding systems anymore. (MS-DOS and MULE): Don't mention code-pages.el. Don't mention support - for unibyte mode. Don't mention line-drawing characters. Don't - mention dos-unsupported-char-glyph. + for unibyte mode. Don't mention line-drawing characters. + Don't mention dos-unsupported-char-glyph. 2008-09-25 Chong Yidong @@ -2022,12 +2027,12 @@ * kmacro.texi (Basic Keyboard Macro): Make F3 and F4 the preferred interface for defining macros. Simplify examples. Note that C-g quits macro definitions. - (Keyboard Macro Counter): Document using F3 to insert counter. Give - usage example. + (Keyboard Macro Counter): Document using F3 to insert counter. + Give usage example. (Keyboard Macro Query): Organize query responses in a table. - * fixit.texi (Fixit): Favor C-/ keybinding for undo throughout. Link - to Erasing node. + * fixit.texi (Fixit): Favor C-/ keybinding for undo throughout. + Link to Erasing node. (Undo): Reorganize paragraphs for logical flow. Move keybinding rationale to a footnote. (Kill Errors): Remove node, due to redundancy with Erasing. @@ -2229,8 +2234,8 @@ * display.texi (Visual Line Mode): New node. * basic.texi (Inserting Text): Move DEL to deletion node. - (Moving Point): Add additional alternative key bindings. Describe - line-move-visual. + (Moving Point): Add additional alternative key bindings. + Describe line-move-visual. (Erasing): Describe DEL. (Basic Undo, Blank Lines, Arguments): Copyedit. (Continuation Lines): Mention Visual Line mode. @@ -2349,8 +2354,8 @@ 2008-06-04 Miles Bader - * display.texi (Temporary Face Changes): Add - `adjust-buffer-face-height'. Rewrite description of + * display.texi (Temporary Face Changes): + Add `adjust-buffer-face-height'. Rewrite description of `increase-buffer-face-height' and `decrease-default-face-height' now that they aren't bound by default. @@ -2514,8 +2519,8 @@ (Replace, Unconditional Replace, Other Repeating Search): Describe Transient Mark mode as the default. - * text.texi (Words, Pages, Fill Commands, HTML Mode): Describe - Transient Mark mode as the default. + * text.texi (Words, Pages, Fill Commands, HTML Mode): + Describe Transient Mark mode as the default. (Paragraphs): Describe how M-h behaves when region is active. * trouble.texi (Quitting): Clarify effects of C-g. @@ -2661,8 +2666,8 @@ 2007-11-10 Paul Pogonyshev - * search.texi (Query Replace): Mention - `query-replace-show-replacement'. + * search.texi (Query Replace): + Mention `query-replace-show-replacement'. 2007-11-09 Nick Roberts @@ -3015,8 +3020,8 @@ 2007-04-20 David Koppelman - * display.texi (Highlight Interactively): Document - hi-lock-file-patterns-policy. + * display.texi (Highlight Interactively): + Document hi-lock-file-patterns-policy. 2007-04-20 Martin Rudalics @@ -3574,8 +3579,8 @@ 2006-08-10 Richard Stallman * text.texi (Format Faces): Substantial rewrites to deal - with face merging. Empty regions don't count. Clarify - face property inheritance. + with face merging. Empty regions don't count. + Clarify face property inheritance. 2006-08-08 Romain Francoise @@ -4034,7 +4039,7 @@ of emacs-xtra.texi. Convert each @chapter into @section, @section into @subsection, etc. - * emacs-xtra.texi (MS-DOS): Renamed from "MS-DOG". All references + * emacs-xtra.texi (MS-DOS): Rename from "MS-DOG". All references updated. * msdog.texi (Microsoft Windows): Rename from "Emacs and Microsoft @@ -4071,7 +4076,7 @@ (Comparing Files): Delete what duplicates new node. (Files): Put Diff Mode in menu. - * misc.texi (Diff Mode): Moved to files.texi. + * misc.texi (Diff Mode): Move to files.texi. * emacs.texi (Top): Update menu for Diff Mode. @@ -4997,8 +5002,8 @@ 2005-11-01 Nick Roberts - * building.texi (Other GDB User Interface Buffers): Describe - the command gdb-use-inferior-io-buffer. + * building.texi (Other GDB User Interface Buffers): + Describe the command gdb-use-inferior-io-buffer. 2005-10-31 Romain Francoise @@ -5036,8 +5041,8 @@ 2005-10-25 Nick Roberts - * building.texi (GDB Graphical Interface): Describe - gdb-mouse-until. + * building.texi (GDB Graphical Interface): + Describe gdb-mouse-until. 2005-10-23 Richard M. Stallman @@ -5104,7 +5109,7 @@ 2005-10-09 Jan Djärv - * cmdargs.texi (Icons X): Removed options -i, -itype, --icon-type, + * cmdargs.texi (Icons X): Remove options -i, -itype, --icon-type, added -nb, --no-bitmap-icon. 2005-10-07 Nick Roberts @@ -5141,16 +5146,16 @@ emulation and related variables. (Mac International): Mention Central European and Cyrillic support. Now `keyboard-coding-system' is dynamically changed. - Add description about coding system for selection. Add - description about language environment. - (Mac Environment Variables): Mention - `~/.MacOSX/environment.plist'. Give example of command line + Add description about coding system for selection. + Add description about language environment. + (Mac Environment Variables): + Mention `~/.MacOSX/environment.plist'. Give example of command line arguments. Add Preferences support. (Mac Directories): Explicitly state that this node is for Mac OS Classic only. - (Mac Font Specs): Mention specification for scalable fonts. List - supported charsets. Add preferred way of creating fontsets. Add - description about `mac-allow-anti-aliasing'. + (Mac Font Specs): Mention specification for scalable fonts. + List supported charsets. Add preferred way of creating fontsets. + Add description about `mac-allow-anti-aliasing'. (Mac Functions): Add descriptions about `mac-set-file-creator', `mac-get-file-creator', `mac-set-file-type', `mac-get-file-type', and `mac-get-preference'. @@ -5312,8 +5317,8 @@ 2005-07-16 Eli Zaretskii * display.texi (Standard Faces): Explain that customization of - `menu' face has no effect on w32 and with GTK. Add - cross-references. + `menu' face has no effect on w32 and with GTK. + Add cross-references. * cmdargs.texi (General Variables): Clarify the default location of $HOME on w32 systems. @@ -5325,8 +5330,8 @@ 2005-07-08 Kenichi Handa - * mule.texi (Recognize Coding): Recommend - revert-buffer-with-coding-system instead of revert-buffer. + * mule.texi (Recognize Coding): + Recommend revert-buffer-with-coding-system instead of revert-buffer. 2005-07-07 Richard M. Stallman @@ -5374,12 +5379,12 @@ 2005-06-23 Richard M. Stallman - * anti.texi (Antinews): Renamed show-nonbreak-escape to + * anti.texi (Antinews): Rename show-nonbreak-escape to nobreak-char-display. * emacs.texi (Top): Update detailed node listing. - * display.texi (Text Display): Renamed show-nonbreak-escape + * display.texi (Text Display): Rename show-nonbreak-escape to nobreak-char-display and no-break-space to nobreak-space. (Standard Faces): Split up the list of standard faces and put it in a separate node. Add nobreak-space and @@ -5391,8 +5396,8 @@ 2005-06-23 Kenichi Handa - * mule.texi (International): List all supported scripts. Adjust - text for that leim is now included in the normal Emacs + * mule.texi (International): List all supported scripts. + Adjust text for that leim is now included in the normal Emacs distribution. (Language Environments): List all language environments. Intlfonts contains fonts for most supported scripts, not all.. @@ -5634,8 +5639,8 @@ * ack.texi (Acknowledgments): Delete info about iso-acc.el. - * dired.texi (Misc Dired Features): Document - dired-compare-directories. + * dired.texi (Misc Dired Features): + Document dired-compare-directories. * files.texi (Filesets): New node. (File Conveniences): Document Image mode. @@ -6023,8 +6028,8 @@ 2005-03-19 Eli Zaretskii - * anti.texi (Antinews): Refer to Emacs 21.4, not 21.3. Update - copyright years. + * anti.texi (Antinews): Refer to Emacs 21.4, not 21.3. + Update copyright years. 2005-03-14 Nick Roberts @@ -6231,7 +6236,7 @@ (Scrolling): For C-l, don't presume text terminal. (Horizontal Scrolling): Simplify intro. (Follow Mode): Clarify. - (Cursor Display): Moved before Display Custom. + (Cursor Display): Move before Display Custom. (Display Custom): Explain no-redraw-on-reenter is for text terminals. Doc default-tab-width. Doc line truncation more thoroughly. @@ -6401,8 +6406,8 @@ cross-references to mailutils documentation. Describe various methods of specifying mailbox names, user names and user passwords for rmail. - (Remote Mailboxes): New section. Describe - how movemail handles remote mailboxes. Describe configuration + (Remote Mailboxes): New section. + Describe how movemail handles remote mailboxes. Describe configuration options used to control its behavior. (Other Mailbox Formats): Explain handling of various mailbox formats. @@ -6576,8 +6581,8 @@ 2004-11-10 Andre Spiegel * files.texi (Version Control): Rewrite the introduction about - version systems, mentioning the new ones that we support. Thanks - to Alex Ott, Karl Fogel, Stefan Monnier, and David Kastrup for + version systems, mentioning the new ones that we support. + Thanks to Alex Ott, Karl Fogel, Stefan Monnier, and David Kastrup for suggestions. 2004-11-03 Jan Djärv @@ -7072,8 +7077,8 @@ 2004-02-21 Juri Linkov - * cmdargs.texi (Action Arguments): Add alias --find-file. Add - --directory, --help, --version. Move text about command-line-args + * cmdargs.texi (Action Arguments): Add alias --find-file. + Add --directory, --help, --version. Move text about command-line-args to Command Arguments. (Initial Options): Add @cindex for --script. Fix @cindex for -q. Add --no-desktop. Add alias --no-multibyte, --no-unibyte. @@ -7093,7 +7098,7 @@ 2004-01-24 Richard M. Stallman - * emacs.texi (Acknowledgments): Renamed from Acknowledgements. + * emacs.texi (Acknowledgments): Rename from Acknowledgements. Include it only @ifnotinfo. Patch the preceding and following node headers to point to each other. @@ -7176,8 +7181,8 @@ 2003-09-24 Luc Teirlinck - * cmdargs.texi (Font X): Mention new default font. More - fully describe long font names, wildcard patterns and the + * cmdargs.texi (Font X): Mention new default font. + More fully describe long font names, wildcard patterns and the problems involved. (Result of discussion on emacs-devel.) 2003-09-22 Luc Teirlinck @@ -7199,8 +7204,8 @@ * screen.texi (Mode Line): Say that POS comes before LINE. Mention `size-indication-mode'. - * display.texi (Optional Mode Line): Document - `size-indication-mode'. + * display.texi (Optional Mode Line): + Document `size-indication-mode'. * basic.texi (Position Info): Mention `size-indication-mode'. 2003-09-07 Luc Teirlinck diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index d311104ddd7..bc7484b0557 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -744,6 +744,13 @@ is neither visiting a version-controlled file nor a VC directory buffer, these commands generate a diff of all registered files in the current directory and its subdirectories. +@findex vc-ediff +The function @code{vc-ediff} works like @code{vc-diff} and provides a way to +visually compare two revisions of a file an Ediff session, @pxref{Top, Ediff, +ediff, The Ediff Manual}. It compares the file associated with the current +buffer with the last repository revision. To compare two arbitrary revisions +of the current file, call @code{vc-ediff} with a prefix argument. + @vindex vc-diff-switches @vindex vc-rcs-diff-switches @kbd{C-x v =} works by running a variant of the @code{diff} utility diff --git a/etc/ChangeLog b/etc/ChangeLog index b9e409e8783..002dfaf7fd5 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2011-04-08 Christoph Scholtes + + * NEWS: Document new function `vc-ediff'. + 2011-04-06 Juanma Barranquero * NEWS: New variable `revert-buffer-in-progress-p'. diff --git a/etc/NEWS b/etc/NEWS index 69540fa1f54..bc85b3223ed 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -672,6 +672,9 @@ use this to display the full log entry for the revision at point. **** Packages using Log View mode can enable this functionality by binding `log-view-expanded-log-entry-function' to a suitable function. +*** New command `vc-ediff' allows visual comparison of two revisions +of a file similar to `vc-diff', but using ediff backend. + ** Miscellaneous --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d019eca95c9..0f6608d2fc1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2011-04-20 Christoph Scholtes + + * vc/vc.el (vc-diff-build-argument-list-internal) + (vc-version-ediff, vc-ediff): New functions. + (vc-version-diff): Use vc-diff-build-argument-list-internal. + 2011-04-20 Stefan Monnier * emacs-lisp/byte-opt.el (byte-decompile-bytecode-1): Remove dead code, diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 7f55ffdbdad..06abde21d4f 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -653,6 +653,7 @@ (require 'vc-hooks) (require 'vc-dispatcher) +(require 'ediff) (eval-when-compile (require 'cl) @@ -1617,45 +1618,48 @@ returns t if the buffer had changes, nil otherwise." nil nil initial-input nil default) (read-string prompt initial-input nil default)))) +(defun vc-diff-build-argument-list-internal () + "Build argument list for calling internal diff functions." + (let* ((vc-fileset (vc-deduce-fileset t)) ;FIXME: why t? --Stef + (files (cadr vc-fileset)) + (backend (car vc-fileset)) + (first (car files)) + (rev1-default nil) + (rev2-default nil)) + (cond + ;; someday we may be able to do revision completion on non-singleton + ;; filesets, but not yet. + ((/= (length files) 1) + nil) + ;; if it's a directory, don't supply any revision default + ((file-directory-p first) + nil) + ;; if the file is not up-to-date, use working revision as older revision + ((not (vc-up-to-date-p first)) + (setq rev1-default (vc-working-revision first))) + ;; if the file is not locked, use last and previous revisions as defaults + (t + (setq rev1-default (vc-call-backend backend 'previous-revision first + (vc-working-revision first))) + (when (string= rev1-default "") (setq rev1-default nil)) + (setq rev2-default (vc-working-revision first)))) + ;; construct argument list + (let* ((rev1-prompt (if rev1-default + (concat "Older revision (default " + rev1-default "): ") + "Older revision: ")) + (rev2-prompt (concat "Newer revision (default " + (or rev2-default "current source") "): ")) + (rev1 (vc-read-revision rev1-prompt files backend rev1-default)) + (rev2 (vc-read-revision rev2-prompt files backend rev2-default))) + (when (string= rev1 "") (setq rev1 nil)) + (when (string= rev2 "") (setq rev2 nil)) + (list files rev1 rev2)))) + ;;;###autoload (defun vc-version-diff (files rev1 rev2) "Report diffs between revisions of the fileset in the repository history." - (interactive - (let* ((vc-fileset (vc-deduce-fileset t)) ;FIXME: why t? --Stef - (files (cadr vc-fileset)) - (backend (car vc-fileset)) - (first (car files)) - (rev1-default nil) - (rev2-default nil)) - (cond - ;; someday we may be able to do revision completion on non-singleton - ;; filesets, but not yet. - ((/= (length files) 1) - nil) - ;; if it's a directory, don't supply any revision default - ((file-directory-p first) - nil) - ;; if the file is not up-to-date, use working revision as older revision - ((not (vc-up-to-date-p first)) - (setq rev1-default (vc-working-revision first))) - ;; if the file is not locked, use last and previous revisions as defaults - (t - (setq rev1-default (vc-call-backend backend 'previous-revision first - (vc-working-revision first))) - (when (string= rev1-default "") (setq rev1-default nil)) - (setq rev2-default (vc-working-revision first)))) - ;; construct argument list - (let* ((rev1-prompt (if rev1-default - (concat "Older revision (default " - rev1-default "): ") - "Older revision: ")) - (rev2-prompt (concat "Newer revision (default " - (or rev2-default "current source") "): ")) - (rev1 (vc-read-revision rev1-prompt files backend rev1-default)) - (rev2 (vc-read-revision rev2-prompt files backend rev2-default))) - (when (string= rev1 "") (setq rev1 nil)) - (when (string= rev2 "") (setq rev2 nil)) - (list files rev1 rev2)))) + (interactive (vc-diff-build-argument-list-internal)) ;; All that was just so we could do argument completion! (when (and (not rev1) rev2) (error "Not a valid revision range")) @@ -1680,6 +1684,48 @@ saving the buffer." (vc-diff-internal t (vc-deduce-fileset t) nil nil (called-interactively-p 'interactive)))) +;;;###autoload +(defun vc-version-ediff (files rev1 rev2) + "Show differences between revisions of the fileset in the +repository history using ediff." + (interactive (vc-diff-build-argument-list-internal)) + ;; All that was just so we could do argument completion! + (when (and (not rev1) rev2) + (error "Not a valid revision range")) + + (message "%s" (format "Finding changes in %s..." (vc-delistify files))) + + ;; Functions ediff-(vc|rcs)-internal use "" instead of nil. + (when (null rev1) (setq rev1 "")) + (when (null rev2) (setq rev2 "")) + + (cond + ;; FIXME We only support running ediff on one file for now. + ;; We could spin off an ediff session per file in the file set. + ((= (length files) 1) + (ediff-load-version-control) + (find-file (car files)) + (funcall + (intern (format "ediff-%S-internal" ediff-version-control-package)) + rev1 rev2 nil)) + (t + (error "More than one file is not supported")))) + +;;;###autoload +(defun vc-ediff (historic &optional not-urgent) + "Display diffs between file revisions using ediff. +Normally this compares the currently selected fileset with their +working revisions. With a prefix argument HISTORIC, it reads two revision +designators specifying which revisions to compare. + +The optional argument NOT-URGENT non-nil means it is ok to say no to +saving the buffer." + (interactive (list current-prefix-arg t)) + (if historic + (call-interactively 'vc-version-ediff) + (when buffer-file-name (vc-buffer-sync not-urgent)) + (vc-version-ediff (cadr (vc-deduce-fileset t)) nil nil))) + ;;;###autoload (defun vc-root-diff (historic &optional not-urgent) "Display diffs between VC-controlled whole tree revisions. -- 2.39.2