GNU bug report logs - #13069
24.3.50; vc-dir: Unify git stashing and bzr shelving

Previous Next

Package: emacs;

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.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Jambunathan K <kjambunathan <at> gmail.com>
Subject: bug#13069: closed (Re: bug#13069: 24.3.50; vc-dir: Unify git
 stashing and bzr shelving)
Date: Fri, 15 Nov 2013 04:05:03 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#13069: 24.3.50; vc-dir: Unify git stashing and bzr shelving

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 13069 <at> debbugs.gnu.org.

-- 
13069: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13069
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Jambunathan K <kjambunathan <at> gmail.com>
To: 13069-done <at> debbugs.gnu.org
Subject: Re: bug#13069: 24.3.50; vc-dir: Unify git stashing and bzr shelving
Date: Tue, 01 Jan 2002 06:07:41 +0530
As OP, closing it.

[Message part 3 (message/rfc822, inline)]
From: Jambunathan K <kjambunathan <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; vc-dir: Unify git stashing and bzr shelving
Date: Mon, 03 Dec 2012 20:31:56 +0530
"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




This bug report was last modified 11 years and 250 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.