GNU bug report logs -
#13069
24.3.50; vc-dir: Unify git stashing and bzr shelving
Previous Next
Reported by: Jambunathan K <kjambunathan <at> gmail.com>
Date: Mon, 3 Dec 2012 15:02:01 UTC
Severity: wishlist
Found in version 24.3.50
Done: Jambunathan K <kjambunathan <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13069 in the body.
You can then email your comments to 13069 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13069
; Package
emacs
.
(Mon, 03 Dec 2012 15:02:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Jambunathan K <kjambunathan <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Mon, 03 Dec 2012 15:02:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
"Works-for-me" changes in my .emacs to uniformly shelf/unshelve changes
in git and bzr backends.
You can install the following changes and in a *vc-dir* (git/bzr) buffer
you can do
f s => stash
f S => snapshot
f p => pop
The patch uses `vc-call-backend' for each of the above operations.
There is also a `vc-stash-name' function to get the latest stash name.
The changes for "works-for-me". It would be good to have
"works-for-all" equivalent of this functionality in vanilla Emacs.
----------------------------------------------------------------------
;; Unify git stashing and bzr shelving
;; Put stash related operations on a `f' prefix.
(defvar vc-dir-stash-map
(let ((map (make-sparse-keymap)))
(define-key map "s" 'vc-stash)
(define-key map "S" 'vc-stash-snapshot)
(define-key map "p" 'vc-stash-pop)
map))
(fset 'vc-dir-stash-map vc-dir-stash-map)
(add-hook 'vc-dir-mode-hook
(lambda ()
(define-key vc-dir-mode-map "f" 'vc-dir-stash-map)))
;; Generic vc-stash callbacks.
(require 'vc)
(defun vc-stash (name)
"Stash current working tree."
(interactive "sName: ")
(let* ((vc-fileset (vc-deduce-fileset t)) ;FIXME: Why t? --Stef
(backend (car vc-fileset))
(files (cadr vc-fileset)))
(vc-call-backend backend 'stash name)))
(defun vc-stash-snapshot ()
"Take a snapshot of working tree."
(interactive)
(let* ((vc-fileset (vc-deduce-fileset t)) ;FIXME: Why t? --Stef
(backend (car vc-fileset))
(files (cadr vc-fileset)))
(vc-call-backend backend 'stash-snapshot)))
(defun vc-stash-pop ()
"Pop newest stash."
(interactive)
(let* ((vc-fileset (vc-deduce-fileset t)) ;FIXME: Why t? --Stef
(backend (car vc-fileset))
(files (cadr vc-fileset))
(name (vc-stash-name)))
(when name
(vc-call-backend backend 'stash-pop name))))
(defun vc-stash-name ()
"Name of the stash on top."
(let* ((vc-fileset (vc-deduce-fileset t)) ;FIXME: Why t? --Stef
(backend (car vc-fileset))
(files (cadr vc-fileset)))
(vc-call-backend backend 'stash-name)))
;; Bzr vc-stash callbacks.
(defalias 'vc-bzr-stash 'vc-bzr-shelve)
(defalias 'vc-bzr-stash-snapshot 'vc-bzr-shelve-snapshot)
(defalias 'vc-bzr-stash-apply 'vc-bzr-shelve-apply)
(defun vc-bzr-stash-name ()
(let* ((name (car (vc-bzr-shelve-list)))
(id (when (and name (string-match "^ +\\([0-9]+\\):" name))
(match-string 1 name))))
id))
(defun vc-bzr-stash-pop (name)
(interactive)
(vc-bzr-shelve-apply name))
;; Git vc-stash callbacks.
(defun vc-git-stash-name ()
(let* ((name (car (vc-git-stash-list)))
(id (when (and name (string-match "^ +\\({[0-9]+}\\):" name))
(match-string 1 name))))
(format "stash@%s" id)))
In GNU Emacs 24.3.50.8 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
of 2012-12-03 on debian-6.05
Bzr revision: 111072 cyd <at> gnu.org-20121203062306-87uj2za1hu2dynaj
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
Important settings:
value of $LANG: en_IN
locale-coding-system: iso-latin-1-unix
default enable-multibyte-characters: t
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13069
; Package
emacs
.
(Fri, 21 Dec 2012 03:23:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 13069 <at> debbugs.gnu.org (full text, mbox):
Jambunathan K <kjambunathan <at> gmail.com> writes:
> "Works-for-me" changes in my .emacs to uniformly shelf/unshelve changes
> in git and bzr backends.
>
> The patch uses `vc-call-backend' for each of the above operations.
> There is also a `vc-stash-name' function to get the latest stash name.
>
> The changes for "works-for-me". It would be good to have
> "works-for-all" equivalent of this functionality in vanilla Emacs.
To reduce ambiguity, could you please submit this as a proper patch
against vc-dir.el? Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13069
; Package
emacs
.
(Fri, 21 Dec 2012 04:23:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 13069 <at> debbugs.gnu.org (full text, mbox):
> (defun vc-stash (name)
> "Stash current working tree."
> (interactive "sName: ")
> (let* ((vc-fileset (vc-deduce-fileset t)) ;FIXME: Why t? --Stef
> (backend (car vc-fileset))
> (files (cadr vc-fileset)))
> (vc-call-backend backend 'stash name)))
I think we should pass `files' as well.
> "Take a snapshot of working tree."
Not sure what this means, really. Especially since the doc of "bzr
shelve --all" is not clear either about what it does (IOW in what way is
it different from "bzr shelve").
> (defun vc-stash-pop ()
> "Pop newest stash."
> (interactive)
> (let* ((vc-fileset (vc-deduce-fileset t)) ;FIXME: Why t? --Stef
> (backend (car vc-fileset))
> (files (cadr vc-fileset))
> (name (vc-stash-name)))
> (when name
> (vc-call-backend backend 'stash-pop name))))
I don't think we should impose a stack discipline. I.e. vc-stash-name
should be replaced by vc-stash-list and then vc-stash-pop should ask the
user to choose among one of the stashes.
Also the stash-pop method should take an extra arg to control whether or
not the stash should be thrown away after application. And maybe we
shouldn't have a stash-pop at all and instead of stash-apply and
stash-remove, since we'll need stash-remove anyway in order to allow
deleting a stash without applying it.
Stefan
Reply sent
to
Jambunathan K <kjambunathan <at> gmail.com>
:
You have taken responsibility.
(Fri, 15 Nov 2013 04:05:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Jambunathan K <kjambunathan <at> gmail.com>
:
bug acknowledged by developer.
(Fri, 15 Nov 2013 04:05:03 GMT)
Full text and
rfc822 format available.
Message #16 received at 13069-done <at> debbugs.gnu.org (full text, mbox):
As OP, closing it.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 13 Dec 2013 12:24:25 GMT)
Full text and
rfc822 format available.
This bug report was last modified 11 years and 249 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.