[PATCH 2 of 2 RFCv2] commands: introduce stash command

Denis Laxalde denis at laxalde.org
Wed Feb 20 02:24:41 CST 2013


Kevin Bullock a écrit :
> On Feb 19, 2013, at 4:46 AM, Denis Laxalde wrote:
>
>> Idan Kamara wrote:
>>> Referring to stashes is done either by index (as shown in --list) or name (if
>>> one was given). If neither is specified, the most recent stash is chosen.
>>
>> Wouldn't make more sense to use parent relationships to order stashes?
>> E.g., if I pop/apply a stash without specifying its name, I'd rather want the one that is on top of the closest parent of my current position than the most recent one that appeared in the repository (which might be in some unrelated branch or so).
>
> Not necessarily. I often start working on a change e.g. on the stable branch, then realize that it should really be done on default. 'stash' is a logical way to move working-directory changes across branches without having to either (a) really commit, or (b) update to the common ancestor, then up to the target head.
>
> I think picking the most recent stash is reasonable. Either way, referring to the changes explicitly by the identifier shown in --list isn't too hard.

The reason I suggested this is that this would minimize the risks of 
conflicts during unstash. A simple case where the ordering by appearance 
would (possibly) lead to conflict:
- work on head A
- stash
- work on head B, (hack, hack)
- stash
- update to head A
- unstash
This is a typical use case of stash (namely interrupted workflow for 
urgent fix). And having to explicitly name the stash to pop in such case 
seems awkward to me, whereas poping based on ancestor would just work.

-- 
Denis Laxalde


More information about the Mercurial-devel mailing list