all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dan Nicolaescu <dann@ics.uci.edu>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: VC top of the tree diff and log
Date: Wed, 22 Jul 2009 22:43:18 -0700 (PDT)	[thread overview]
Message-ID: <200907230543.n6N5hI6p029191@godzilla.ics.uci.edu> (raw)
In-Reply-To: <jwvprc7c8eg.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sat, 11 Jul 2009 15:51:20 -0400")

Stefan Monnier <monnier@iro.umontreal.ca> writes:

  > > Key bindings:
  > > for log we could have C-x v L  (should be intuitive given that
  > > vc-print-log uses C-x v l)
  > 
  > It might be a good idea.
  > 
  > > not sure what would be a good one for diff
  > 
  > I don't understand: why not just use the capitalized = sign?

Sorry, I probably use one of those antique keyboards that don't have
such a sign...

See what I currently have.  What do you think?

Index: vc-hooks.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc-hooks.el,v
retrieving revision 1.279
diff -u -3 -p -r1.279 vc-hooks.el
--- vc-hooks.el	26 Jun 2009 23:54:00 -0000	1.279
+++ vc-hooks.el	23 Jul 2009 05:33:31 -0000
@@ -934,6 +934,7 @@ current, and kill the buffer that visits
     (define-key map "h" 'vc-insert-headers)
     (define-key map "i" 'vc-register)
     (define-key map "l" 'vc-print-log)
+    (define-key map "L" 'vc-print-root-log)
     (define-key map "m" 'vc-merge)
     (define-key map "r" 'vc-retrieve-tag)
     (define-key map "s" 'vc-create-tag)
@@ -941,6 +942,7 @@ current, and kill the buffer that visits
     (define-key map "v" 'vc-next-action)
     (define-key map "+" 'vc-update)
     (define-key map "=" 'vc-diff)
+    (define-key map "D" 'vc-root-diff)
     (define-key map "~" 'vc-revision-other-window)
     map))
 (fset 'vc-prefix-map vc-prefix-map)
@@ -969,12 +971,18 @@ current, and kill the buffer that visits
     (define-key map [vc-diff]
       '(menu-item "Compare with Base Version" vc-diff
 		  :help "Compare file set with the base version"))
+    (define-key map [vc-root-diff]
+      '(menu-item "Compare Tree with Base Version" vc-root-diff
+		  :help "Compare current tree with the base version"))
     (define-key map [vc-update-change-log]
       '(menu-item "Update ChangeLog" vc-update-change-log
 		  :help "Find change log file and add entries from recent version control logs"))
     (define-key map [vc-print-log]
       '(menu-item "Show History" vc-print-log
 		  :help "List the change log of the current file set in a window"))
+    (define-key map [vc-print-root-log]
+      '(menu-item "Show Top of the Tree History " vc-print-root-log
+		  :help "List the change log for the current tree in a window"))
     (define-key map [separator2] '("----"))
     (define-key map [vc-insert-header]
       '(menu-item "Insert Header" vc-insert-headers
Index: vc.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc.el,v
retrieving revision 1.721
diff -u -3 -p -r1.721 vc.el
--- vc.el	23 Jul 2009 05:21:36 -0000	1.721
+++ vc.el	23 Jul 2009 05:33:32 -0000
@@ -465,6 +465,9 @@
 ;;   `revert' operations itself, without calling the backend system.  The
 ;;   default implementation always returns nil.
 ;;
+;; - root (file)
+;;   Return the root of the VC controlled hierarchy for file.
+;;
 ;; - repository-hostname (dirname)
 ;;
 ;;   Return the hostname that the backend will have to contact
@@ -1592,6 +1595,33 @@ saving the buffer."
     (vc-diff-internal t (vc-deduce-fileset) nil nil (interactive-p))))
 
 ;;;###autoload
+(defun vc-root-diff (historic &optional not-urgent)
+  "Display diffs between file revisions.
+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
+      ;; FIXME: this does not work right, `vc-version-diff' ends up
+      ;; calling `vc-deduce-fileset' to find the files to diff, and
+      ;; that's not what we want here, we want the diff for the VC root dir.
+      (call-interactively 'vc-version-diff)
+    (when buffer-file-name (vc-buffer-sync not-urgent))
+    (let ((backend
+	   (cond ((derived-mode-p 'vc-dir-mode)  vc-dir-backend)
+		 (vc-mode (vc-backend buffer-file-name))))
+	  rootdir working-revision)
+      (unless backend
+	(error "Buffer is not version controlled"))
+      (setq rootdir (vc-call-backend backend 'root default-directory))
+      (setq working-revision (vc-working-revision rootdir))
+      (vc-diff-internal
+       t (list backend (list rootdir) working-revision) nil nil (interactive-p)))))
+
+;;;###autoload
 (defun vc-revision-other-window (rev)
   "Visit revision REV of the current file in another window.
 If the current file is named `F', the revision is named `F.~REV~'.
@@ -1856,6 +1886,21 @@ If WORKING-REVISION is non-nil, leave th
     (vc-print-log-internal backend files working-revision)))
 
 ;;;###autoload
+(defun vc-print-root-log ()
+  "List the change log of for the current VC controlled tree in a window."
+  (interactive)
+  (let ((backend
+	 (cond ((derived-mode-p 'vc-dir-mode)  vc-dir-backend)
+	       (vc-mode (vc-backend buffer-file-name))))
+	rootdir working-revision)
+    (unless backend
+      (error "Buffer is not version controlled"))
+    (setq rootdir (vc-call-backend backend 'root default-directory))
+    (setq working-revision (vc-working-revision rootdir))
+    (vc-print-log-internal backend (list rootdir) working-revision)))
+
+
+;;;###autoload
 (defun vc-revert ()
   "Revert working copies of the selected fileset to their repository contents.
 This asks for confirmation if the buffer contents are not identical






  reply	other threads:[~2009-07-23  5:43 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-07 18:45 VC top of the tree diff and log Dan Nicolaescu
2009-07-08  2:50 ` Miles Bader
2009-07-08 21:10   ` Dan Nicolaescu
2009-07-08 23:01     ` Miles Bader
2009-07-09  0:29       ` Dan Nicolaescu
2009-07-09  3:05         ` Miles Bader
2009-07-09  3:58           ` C-x v l in a dired buffer [was: Re: VC top of the tree diff and log] Dan Nicolaescu
2009-07-09  6:48           ` VC top of the tree diff and log Dan Nicolaescu
2009-07-16 21:38       ` Dan Nicolaescu
2009-07-18 21:45         ` Juri Linkov
2009-07-11 19:51 ` Stefan Monnier
2009-07-23  5:43   ` Dan Nicolaescu [this message]
2009-07-30  7:18     ` Dan Nicolaescu
2009-08-29 19:13       ` Dan Nicolaescu
2009-08-29 21:25         ` Stefan Monnier
2009-08-29 22:47           ` Juri Linkov
2009-08-29 23:10             ` Miles Bader
2009-09-01 21:36               ` Juri Linkov
2009-09-01 22:27                 ` Juri Linkov
2009-09-04  0:04                   ` Juri Linkov
2009-09-04  2:12                   ` Stefan Monnier
2009-08-30  6:16           ` Dan Nicolaescu
2009-09-01 21:35             ` Juri Linkov
2009-09-01 22:07               ` Dan Nicolaescu
2009-09-02  4:13                 ` Miles Bader
2009-09-02  4:34                   ` Dan Nicolaescu
2009-09-04  0:05                     ` Juri Linkov
2009-09-04  0:33                       ` Miles Bader
2009-09-01 21:41         ` Juri Linkov
2009-09-01 22:46           ` Dan Nicolaescu
2009-09-04  0:06             ` Juri Linkov
2009-12-06 22:37           ` Dan Nicolaescu
2009-09-04  0:36         ` Juri Linkov
2009-09-04  3:42           ` Miles Bader

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200907230543.n6N5hI6p029191@godzilla.ics.uci.edu \
    --to=dann@ics.uci.edu \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.