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

Laurens Holst laurens.nospam at grauw.nl
Fri Sep 20 04:43:23 CDT 2013


Op 19-09-13 23:41, Matt Mackall schreef:
> On Wed, 2013-09-18 at 21:31 -0700, Siddharth Agarwal wrote:
>> On 09/18/2013 09:29 PM, David Soria Parra wrote:
>>> I used an parameter --unshelve instead of a command due to the previous
>>> discussion on the extension. I personally don't have a preference, but
>>> it was suggested that we don't use an "unshelve" command. This way all
>>> the parameters are defined on the same command. Would you prefer
>>> "--apply" maybe?
>>>
>>> Matt and rest: Any suggestions on the UI bits?
>> I'd prefer unshelve too.
> Ok, let's look at the precedents.
>
> First, git. We generally don't usually appeal to git for UI inspiration,
> but as this particular command is modeled off of git stash, it makes
> sense. The git synopsis looks like this:
>
>         git stash list [<options>]
>         git stash show [<stash>]
>         git stash drop [-q|--quiet] [<stash>]
>         git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]
>         git stash branch <branchname> [<stash>]
>         git stash [save [--patch] [-k|--[no-]keep-index] [-q|--quiet]
>                      [-u|--include-untracked] [-a|--all] [<message>]]
>         git stash clear
>         git stash create
>
> Now let's look at 'the other shelve extension':
>
> 	hg shelve [--name x] [--append] [--all]
> 	hg shelve --list
> 	hg unshelve
>
> We've got a bunch of commands of the form foo/foos to make/list:
>
> 	tag/tags
> 	bookmark/bookmarks

Actually, you have just “bookmarks”. “bookmark” is an alias.

> 	branch/branches
>
> ..but these each have a different way to unmark:
>
> 	tag --remove (-r is rev, -d is date)
>          bookmark -d/--delete (let's fix this!)
>          hg commit --close-branch
>
> We've also got resolve and bisect which have a bunch of "subcommands":
>
> 	resolve
> 	resolve -l
> 	resolve -m/-u
> 	bisect -r/-g/-b/-s
>
> And we've got mq, which has _many_ commands, but one each for
> create/list/apply.

I think you’re notably forgetting “bundle” and “unbundle”, which is 
actually very similar in function.

> 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.
My preference is the third. It seems consistent with tag / tags and 
bundle / unbundle, and provides convenient access to the most important 
things.

If we would really want to limit the number of commands, I guess for 
“shelves” one could use the same trick that “bookmarks” does, where 
“bookmark” is simply an alias; whether to create or list them solely 
depends on whether a name is specified. So if you type “hg bookmark” it 
will list them, and if you type “hg bookmarks x” it will bookmark.

But to be honest that’s not my preference, seems a bit like a hack, a 
pure technical reason for a UI choice.

~Laurens



More information about the Mercurial-devel mailing list