From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Nicolaescu Newsgroups: gmane.emacs.devel Subject: Re: VC top of the tree diff and log Date: Wed, 22 Jul 2009 22:43:18 -0700 (PDT) Message-ID: <200907230543.n6N5hI6p029191@godzilla.ics.uci.edu> References: <200907071845.n67IjHUH004088@godzilla.ics.uci.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1248327933 17758 80.91.229.12 (23 Jul 2009 05:45:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 23 Jul 2009 05:45:33 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 23 07:45:26 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MTr7M-0004kG-MS for ged-emacs-devel@m.gmane.org; Thu, 23 Jul 2009 07:45:25 +0200 Original-Received: from localhost ([127.0.0.1]:41456 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MTr7L-0002EJ-Vt for ged-emacs-devel@m.gmane.org; Thu, 23 Jul 2009 01:45:24 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MTr7D-0002EE-L0 for emacs-devel@gnu.org; Thu, 23 Jul 2009 01:45:15 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MTr77-0002E2-Nc for emacs-devel@gnu.org; Thu, 23 Jul 2009 01:45:13 -0400 Original-Received: from [199.232.76.173] (port=41204 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MTr77-0002Dz-G3 for emacs-devel@gnu.org; Thu, 23 Jul 2009 01:45:09 -0400 Original-Received: from barrelv2.ics.uci.edu ([128.195.1.114]:41477) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1MTr76-0007FW-Uu for emacs-devel@gnu.org; Thu, 23 Jul 2009 01:45:09 -0400 Original-Received: from godzilla.ics.uci.edu (godzilla.ics.uci.edu [128.195.10.101]) by barrelv2.ics.uci.edu (8.13.8+Sun/8.13.8) with ESMTP id n6N5hJj9012006; Wed, 22 Jul 2009 22:43:19 -0700 (PDT) Original-Received: (from dann@localhost) by godzilla.ics.uci.edu (8.13.8+Sun/8.13.6/Submit) id n6N5hI6p029191; Wed, 22 Jul 2009 22:43:18 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Sat, 11 Jul 2009 15:51:20 -0400") Original-Lines: 134 X-ICS-MailScanner-Information: Please contact the ISP for more information X-ICS-MailScanner-ID: n6N5hJj9012006 X-ICS-MailScanner: Found to be clean X-ICS-MailScanner-SpamCheck: not spam, SpamAssassin (score=-1.44, required 5, autolearn=disabled, ALL_TRUSTED -1.44) X-ICS-MailScanner-From: dann@godzilla.ics.uci.edu X-detected-operating-system: by monty-python.gnu.org: Solaris 10 (beta) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:113037 Archived-At: Stefan Monnier 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