darcs

Issue 1891 darcs stash

Title darcs stash
Priority wishlist Status waiting-for
Milestone Resolved in
Superseder Nosy List dagit, dmitry.kurochkin, galbolle, kowey, mornfall, quick
Assigned To
Topics UI

Created on 2010-07-13.23:20:13 by dagit, last changed 2010-07-17.14:31:10 by kowey.

Messages
msg11740 (view) Author: dagit Date: 2010-07-13.23:20:12
git provides a 'stash' as a place to push unfinished work so that it is 
no longer in your working directory.  This is really handy when merging 
changes that will clobber your unfinished work.

In the darcs folklore, this is simply a:
darcs record -m "hey, I'm not done yet"
darcs pull
darcs amend-record --edit-description

Except, that the merge done by pull might still clobber your work.  In 
that case, you would do a 'darcs send -O' to yourself, unpull the patch, 
etc.

It would be really nice, especially for git converts, if we simply 
offered these workflows in a nice package.  Say, darcs stash/unstash.

I think as an implementation detail, in git the stash is a stack.  I 
don't know if people in practice depend on that or if they tend to use a 
stack of depth at most 1.
msg11741 (view) Author: kowey Date: 2010-07-14.08:36:55
Is there a compelling reason to make this available for 2.6.0?  Feel 
free to set it back; I'm just trying to keep the roadmap a little 
focused.

You may also want to be aware of darcs obliterate -O, which I think 
would provide a sort of stash operation when combined with record 
(unstash would then be apply + unrecord). Adding Florent to this because 
of obliterate -O.

Also note that whoever implements this should be aware of our conscious 
effort to resist new features.  See the Grumpy Old Man process described 
in http://wiki.darcs.net/Ideas.  It's fine for us to implement new 
features and change the UI, but we should make sure we've made a best 
effort to take a global and long-term view of Darcs to ensure that the 
whole user interface fits together harmoniously (rah rah, conceptual 
integrity).  Sometimes we even change the UI just so to achieve greater 
harmony.  In the long term, I want Darcs to have a reputation as being 
incredibly easy to learn and easy to use effectively.  Paying careful 
attention to conceptual integrity is a big part of this.
msg11743 (view) Author: quick Date: 2010-07-14.11:08:42
Also note that the stash concept can be accomplished by simply using 
another darcs repo.

workdir$ darcs get . ../stash
... do some work in workdir...
workdir$ darcs record -m ":INPROG: "hey, I'm not done yet"
workdir$ darcs push --no-set-default -p :INPROG ../stash
workdir$ darcs unpull -p :INPROG
workdir$ darcs pull
workdir$ darcs pull --no-set-default ../stash

The advantage here is that the stash is a normal darcs repo supporting 
all darcs functionality and "infinite stack depth".  The disadvantage 
is that you'll occasionally need to do some cleanup explicitly in the 
stash when you want to remove in-progress patches that you've done more 
work on; of course your stash could be short-lived and only exist 
during your official pull.

Using a convention (":INPROG" above) makes it easy to identify and 
match against patches of this type and a final "amend-record -m'...'" 
can be used to remove the marker when the patch is complete and 
finished.

Since darcs regex matching is simple Posix, it's hard to specify a 
negative multi-character match but if you choose the first character of 
your marker wisely then you can do simple exclusions to prevent pushing 
your INPROG patches to the rest of the world:

workdir$ darcs push -p'^[^:]'

And that's generic enough to be put in your personal prefs file.

There are other workflows as well, including using a syncdir to merge 
upstream changes (pulled first) with local workdir changes (pulled 
second), or those described in http://www.darcs.net/manual/
node5.html#SECTION00560000000000000000 depending on your preference.

This is not necessarily a vote against feature creep---it would be good 
to make useful workflows easy---but just points out some alternatives 
that might be useful for a "Darcs for Git users" cheatsheet.
msg11744 (view) Author: dagit Date: 2010-07-14.20:03:45
"In the long term, I want Darcs to have a reputation as being 
incredibly easy to learn and easy to use effectively.  Paying careful 
attention to conceptual integrity is a big part of this."

and

"Also note that the stash concept can be accomplished by simply using 
another darcs repo.

workdir$ darcs get . ../stash
... do some work in workdir...
workdir$ darcs record -m ":INPROG: "hey, I'm not done yet"
workdir$ darcs push --no-set-default -p :INPROG ../stash
workdir$ darcs unpull -p :INPROG
workdir$ darcs pull
workdir$ darcs pull --no-set-default ../stash"

As far as I'm concerned, those two quotes are compelling reasons to want a 
stash.  That list of commands is really obnoxious compared to simply, 
"darcs stash".  I need no further convincing nor do I care to convince 
others.

If the grumpy old man really dislikes this feature then so be it and close 
the ticket.
msg11745 (view) Author: mornfall Date: 2010-07-14.23:05:45
I don't think stash itself is compelling enough. I reckon that revert -
o/-O would work as good, without introducing any extra complexity. Sure, 
stash is just one little pair of commands (stash/unstash) and some 
little bit of extra logic to keep the bundles hidden somewhere under 
_darcs, and some little bit of extra logic to list/remove/etc. those 
bundles. All tasks that are more adequately served by the familiar 
filesystem commands...

The reason why revert -o/-O doesn't work for git is that it cannot 
easily apply patches out of order and needs special care when re-
applying a stash (basically a small rebase).

(-O would in this case need to create an unique stash_NN.dpatch, or 
similar, since there's no patch name...)
msg11757 (view) Author: kowey Date: 2010-07-15.12:31:28
Hmm, did not anticipate that this would trigger a discussion.

Directed to mailing list
http://lists.osuosl.org/pipermail/darcs-users/2010-July/024499.html

This ticket is now waiting on the outcome of that discussion
msg11763 (view) Author: dagit Date: 2010-07-15.21:07:19
Where is revert -O documented?

I have the beta installed but it's not listed in revert --help and revert 
doesn't respond to it.
msg11778 (view) Author: kowey Date: 2010-07-17.14:31:09
On Thu, Jul 15, 2010 at 21:07:20 +0000, Jason Dagit wrote:
> Where is revert -O documented?

It's a proposal, not a feature.  See patch303

-- 
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
For a faster response, please try +44 (0)1273 64 2905.
History
Date User Action Args
2010-07-13 23:20:13dagitcreate
2010-07-14 08:36:58koweysetnosy: + galbolle, kowey
milestone: 2.8.0 ->
messages: + msg11741
title: add new command: darcs stash -> darcs stash
2010-07-14 11:08:42quicksetnosy: + quick
messages: + msg11743
2010-07-14 20:03:46dagitsetmessages: + msg11744
2010-07-14 23:05:46mornfallsetnosy: + mornfall
messages: + msg11745
2010-07-15 12:31:29koweysetstatus: needs-implementation -> waiting-for
topic: + UI
messages: + msg11757
2010-07-15 21:07:19dagitsetmessages: + msg11763
2010-07-17 14:31:10koweysetmessages: + msg11778