From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Nicolaescu Newsgroups: gmane.emacs.bugs Subject: bug#5290: vc-bzr: improve support for shelves Date: Fri, 1 Jan 2010 20:14:52 -0800 (PST) Message-ID: <201001020414.o024EqJP005228@godzilla.ics.uci.edu> Reply-To: Dan Nicolaescu , 5290@debbugs.gnu.org NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1262405955 17344 80.91.229.12 (2 Jan 2010 04:19:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 2 Jan 2010 04:19:15 +0000 (UTC) To: bug-gnu-emacs Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jan 02 05:19:08 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NQvSF-0001Ew-KR for geb-bug-gnu-emacs@m.gmane.org; Sat, 02 Jan 2010 05:19:08 +0100 Original-Received: from localhost ([127.0.0.1]:49421 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NQvSF-0000Ku-QN for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 Jan 2010 23:19:07 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NQvSA-0000If-3J for bug-gnu-emacs@gnu.org; Fri, 01 Jan 2010 23:19:02 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NQvS0-000055-MK for bug-gnu-emacs@gnu.org; Fri, 01 Jan 2010 23:19:01 -0500 Original-Received: from [199.232.76.173] (port=36599 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NQvS0-000052-Gq for bug-gnu-emacs@gnu.org; Fri, 01 Jan 2010 23:18:52 -0500 Original-Received: from [140.186.70.43] (port=53677 helo=debbugs.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NQvS0-0001OZ-F1 for bug-gnu-emacs@gnu.org; Fri, 01 Jan 2010 23:18:52 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1NQvQD-0004j4-Ry; Fri, 01 Jan 2010 23:17:01 -0500 X-Loop: bug-gnu-emacs@gnu.org Mail-Followup-To: Dan Nicolaescu , 5290@debbugs.gnu.org Resent-From: Dan Nicolaescu Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 02 Jan 2010 04:17:01 +0000 Resent-Message-ID: Resent-Sender: bug-gnu-emacs@gnu.org X-Emacs-PR-Message: report 5290 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@debbugs.gnu.org id=B.126240581018151 (code B ref -1); Sat, 02 Jan 2010 04:17:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 Jan 2010 04:16:50 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NQvQ1-0004ii-LN for submit@debbugs.gnu.org; Fri, 01 Jan 2010 23:16:49 -0500 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NQvPz-0004id-95 for submit@debbugs.gnu.org; Fri, 01 Jan 2010 23:16:47 -0500 Original-Received: from mx10.gnu.org ([199.232.76.166]:39128) by fencepost.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NQvPw-00065w-08 for submit@debbugs.gnu.org; Fri, 01 Jan 2010 23:16:44 -0500 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NQvPu-0001K9-7K for submit@debbugs.gnu.org; Fri, 01 Jan 2010 23:16:43 -0500 Original-Received: from lists.gnu.org ([199.232.76.165]:54753) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NQvPu-0001K5-21 for submit@debbugs.gnu.org; Fri, 01 Jan 2010 23:16:42 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NQvPt-0005Iq-Mc for bug-gnu-emacs@gnu.org; Fri, 01 Jan 2010 23:16:41 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NQvPp-00058Q-HP for bug-gnu-emacs@gnu.org; Fri, 01 Jan 2010 23:16:41 -0500 Original-Received: from [199.232.76.173] (port=47837 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NQvPp-00057z-A2 for bug-gnu-emacs@gnu.org; Fri, 01 Jan 2010 23:16:37 -0500 Original-Received: from paul-mcgann-v0.ics.uci.edu ([128.195.1.147]:40395) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NQvPp-0001Bg-3v for bug-gnu-emacs@gnu.org; Fri, 01 Jan 2010 23:16:37 -0500 Original-Received: from godzilla.ics.uci.edu (godzilla.ics.uci.edu [128.195.10.101]) by paul-mcgann-v0.ics.uci.edu (8.13.8/8.13.8) with ESMTP id o024ErvD026391 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 1 Jan 2010 20:14:53 -0800 Original-Received: (from dann@localhost) by godzilla.ics.uci.edu (8.13.8+Sun/8.13.6/Submit) id o024EqJP005228; Fri, 1 Jan 2010 20:14:52 -0800 (PST) Original-Lines: 103 X-ICS-MailScanner-Information: Please send mail to helpdesk@ics.uci.edu or more information X-ICS-MailScanner-ID: o024ErvD026391 X-ICS-MailScanner: Found to be clean X-ICS-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-1.363, required 5, autolearn=disabled, ALL_TRUSTED -1.44, TW_BZ 0.08) X-ICS-MailScanner-From: dann@godzilla.ics.uci.edu X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -2.8 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list X-Spam-Score: -2.9 (--) Resent-Date: Fri, 01 Jan 2010 23:17:01 -0500 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:33844 Archived-At: The latest bzr has support for "unshelve --keep" (implemented as a result of a discussion on emacs-devel). That makes the shelves much more usable. The patch below add support for that option, and for creating snapshots of the tree as a shelf. Given that it's not a bug fix this would need a maintainer approval to get in 23.2 at this point... Index: vc-bzr.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/vc-bzr.el,v retrieving revision 1.94 diff -u -3 -p -u -p -r1.94 vc-bzr.el --- vc-bzr.el 9 Dec 2009 06:04:12 -0000 1.94 +++ vc-bzr.el 2 Jan 2010 03:58:42 -0000 @@ -722,7 +733,9 @@ stream. Standard error output is discar (define-key map "\C-k" 'vc-bzr-shelve-delete-at-point) ;; (define-key map "=" 'vc-bzr-shelve-show-at-point) ;; (define-key map "\C-m" 'vc-bzr-shelve-show-at-point) - (define-key map "A" 'vc-bzr-shelve-apply-at-point) + (define-key map "A" 'vc-bzr-shelve-apply-and-keep-at-point) + (define-key map "P" 'vc-bzr-shelve-apply-at-point) + (define-key map "S" 'vc-bzr-shelve-snapshot) map)) (defvar vc-bzr-shelve-menu-map @@ -731,8 +744,11 @@ stream. Standard error output is discar '(menu-item "Delete shelf" vc-bzr-shelve-delete-at-point :help "Delete the current shelf")) (define-key map [ap] - '(menu-item "Apply shelf" vc-bzr-shelve-apply-at-point - :help "Apply the current shelf")) + '(menu-item "Apply and keep shelf" vc-bzr-shelve-apply-and-keep-at-point + :help "Apply the current shelf and keep it")) + (define-key map [po] + '(menu-item "Apply and remove shelf (pop)" vc-bzr-shelve-apply-at-point + :help "Apply the current shelf and remove it")) ;; (define-key map [sh] ;; '(menu-item "Show shelve" vc-bzr-shelve-show-at-point ;; :help "Show the contents of the current shelve")) @@ -740,6 +756,9 @@ stream. Standard error output is discar (defvar vc-bzr-extra-menu-map (let ((map (make-sparse-keymap))) + (define-key map [bzr-sn] + '(menu-item "Shelve a snapshot" vc-bzr-shelve-snapshot + :help "Shelve the current state of the tree and keep the current state")) (define-key map [bzr-sh] '(menu-item "Shelve..." vc-bzr-shelve :help "Shelve changes")) @@ -790,7 +809,7 @@ stream. Standard error output is discar (propertize x 'face 'font-lock-variable-name-face 'mouse-face 'highlight - 'help-echo "mouse-3: Show shelve menu\nA: Apply shelf\nC-k: Delete shelf" + 'help-echo "mouse-3: Show shelve menu\nA: Apply and keep shelf\nP: Apply and remove shelf\nS: Snapshot to a shelf\nC-k: Delete shelf" 'keymap vc-bzr-shelve-map)) shelve "\n")) (concat @@ -820,11 +839,28 @@ stream. Standard error output is discar ;; (pop-to-buffer (current-buffer))) (defun vc-bzr-shelve-apply (name) - "Apply shelve NAME." - (interactive "sApply shelf: ") + "Apply shelve NAME and remove it afterwards." + (interactive "sApply (and remove) shelf: ") (vc-bzr-command "unshelve" "*vc-bzr-shelve*" 0 nil "--apply" name) (vc-resynch-buffer (vc-bzr-root default-directory) t t)) +(defun vc-bzr-shelve-apply-and-keep (name) + "Apply shelve NAME and keep it afterwards." + (interactive "sApply (and keep) shelf: ") + (vc-bzr-command "unshelve" "*vc-bzr-shelve*" 0 nil "--apply" "--keep" name) + (vc-resynch-buffer (vc-bzr-root default-directory) t t)) + +(defun vc-bzr-shelve-snapshot () + "Create a stash with the current tree state." + (interactive) + (vc-bzr-command "shelve" nil 0 nil "--all" "-m" + (let ((ct (current-time))) + (concat + (format-time-string "Snapshot on %Y-%m-%d" ct) + (format-time-string " at %H:%M" ct)))) + (vc-bzr-command "unshelve" "*vc-bzr-shelve*" 0 nil "--apply" "--keep") + (vc-resynch-buffer (vc-bzr-root default-directory) t t)) + (defun vc-bzr-shelve-list () (with-temp-buffer (vc-bzr-command "shelve" (current-buffer) 1 nil "--list" "-q") @@ -857,6 +893,10 @@ stream. Standard error output is discar (interactive) (vc-bzr-shelve-apply (vc-bzr-shelve-get-at-point (point)))) +(defun vc-bzr-shelve-apply-and-keep-at-point () + (interactive) + (vc-bzr-shelve-apply-and-keep (vc-bzr-shelve-get-at-point (point)))) + (defun vc-bzr-shelve-menu (e) (interactive "e") (vc-dir-at-event e (popup-menu vc-bzr-shelve-menu-map e)))