* bug#13069: 24.3.50; vc-dir: Unify git stashing and bzr shelving
2012-12-03 15:01 bug#13069: 24.3.50; vc-dir: Unify git stashing and bzr shelving Jambunathan K
@ 2002-01-01 0:37 ` Jambunathan K
2012-12-21 3:22 ` Chong Yidong
2012-12-21 4:22 ` Stefan Monnier
2 siblings, 0 replies; 4+ messages in thread
From: Jambunathan K @ 2002-01-01 0:37 UTC (permalink / raw)
To: 13069-done
As OP, closing it.
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#13069: 24.3.50; vc-dir: Unify git stashing and bzr shelving
@ 2012-12-03 15:01 Jambunathan K
2002-01-01 0:37 ` Jambunathan K
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jambunathan K @ 2012-12-03 15:01 UTC (permalink / raw)
To: 13069
"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@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
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#13069: 24.3.50; vc-dir: Unify git stashing and bzr shelving
2012-12-03 15:01 bug#13069: 24.3.50; vc-dir: Unify git stashing and bzr shelving Jambunathan K
2002-01-01 0:37 ` Jambunathan K
@ 2012-12-21 3:22 ` Chong Yidong
2012-12-21 4:22 ` Stefan Monnier
2 siblings, 0 replies; 4+ messages in thread
From: Chong Yidong @ 2012-12-21 3:22 UTC (permalink / raw)
To: Jambunathan K; +Cc: 13069
Jambunathan K <kjambunathan@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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#13069: 24.3.50; vc-dir: Unify git stashing and bzr shelving
2012-12-03 15:01 bug#13069: 24.3.50; vc-dir: Unify git stashing and bzr shelving Jambunathan K
2002-01-01 0:37 ` Jambunathan K
2012-12-21 3:22 ` Chong Yidong
@ 2012-12-21 4:22 ` Stefan Monnier
2 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2012-12-21 4:22 UTC (permalink / raw)
To: Jambunathan K; +Cc: 13069
> (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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-12-21 4:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-03 15:01 bug#13069: 24.3.50; vc-dir: Unify git stashing and bzr shelving Jambunathan K
2002-01-01 0:37 ` Jambunathan K
2012-12-21 3:22 ` Chong Yidong
2012-12-21 4:22 ` Stefan Monnier
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.