[PATCH 3 of 5] shelve: use an --unshelve parameter instead of a command

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Sep 20 10:09:23 CDT 2013


On 09/19/2013 11:41 PM, Matt Mackall wrote:

> We've got a bunch of commands of the form foo/foos to make/list:
>
> 	tag/tags
> 	bookmark/bookmarks
> 	branch/branches

Note that:

1) There is only one `bookmarks` command. `bookmark` works as a short forms

2) The <COMMAND>/<COMMAND>s forms block the use of short form on the 
command line:

hg: command 'bran' is ambiguous:
     branch branches

> So I think there are three possibilities which are really consistent
> with our existing UI:
>
> a) one command with suboptions (like resolve)
>
> 	hg shelve [name]
> 	hg shelve -l/--list
> 	hg shelve -u/--unshelve (or -p/--pop) [name]
>
> b) two commands (like tags/bookmarks)
>
> 	hg shelve [name]
> 	hg shelves
> 	hg shelve --u [name]
>
> c) three commands (like mq)
>
> 	hg shelve [name]
> 	hg shelves
> 	hg unshelve [name]
>
> My preference is for the first. If a year from now, we discover everyone
> wants unshelve and/or shelves, we can add that. But it's bit harder to
> take commands away.
This discussions seems to lack a summary of the action that shelve do:

A) Two main actions:

     1. create a shelve
     2. apply a shelve

B) Two secondary action

     1. list/view shelve (including output of a shelve content)
     2. delete shelve

(i dunno how git manage to build 8 commands from there)

The initial proposal was:

     - hg shelve: create, list, delete-all
     - hg unshelve: apply

 From there the proposal of moving all actions in a single command made 
some sense.

However I (and some other people) would expect `unshelve` commands And a 
lot of people have made valid argument for it. But what do we do from 
secondary actions if we have two commands ?

I cannot see strong arguments to keep them only on the shelve creation 
command (except it's named shelve)

So I see 3 new options

1) We could have both command hold them:

     hg shelve: create (list, delete)
     hg unshelve: apply (list, delete)

     pro: simple and explicit
     con: two commands for the same thing sounds weird

2) We could have a single command with both action at the same level 
(like resolve)

     hg shelves: (list of shelve (safe, no-op action by default))
     hg shelves --create (-c)
     hg shelves --apply (-a)
     hg shelves --delete (-d)
     hg shelve --export (-e)

    pro: single command.
    con: I always hated resolve UI.

3) introduce a third level of command in mercurial (hg <concept> <action>):

     hg shelve list
     hg shelve create
     hg shelve apply
     hg shelve delete
     hg shelve export

     pro: Other things in mercurial could use this concept.
     con: I'm feeling the burning eyes on Matt on me.


Note: If I undertand correctly, the current UI lack:
     - export of a single shelve as patch
     - delete of a single shelve


-- 
Pierre-Yves David



More information about the Mercurial-devel mailing list