Skip to contentSkip to conversation

stg branch -r instructions

DISCUSSION David Kågedal 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

It isn't easy to figure out how to rename a branch in stg from looking at the help texts.

Usage: stg branch [options] branch-name [commit-id]

...

-r, --rename rename an existing development branch

So, how do I rename branch A to B?

Reading the source, it appears that you write

stg branch -r A B

so, the usage string is wrong. In fact, the described usage string is only for the default action to create a new branch.

The optparse library doesn't really make it easy to describe these kinds of options-as-subcommands, so I don't have a patch to fix it right away. I'm not even sure how the result should look.

Maybe it would have been better to have separate stg subcommands?

stg branch NAME [COMMIT]
stg list-branches
stg rename-branch OLD NEW
... etc ...

Signature · 1 line
David Kågedal
#1 lore raw
Quoted 2 lines · David Kågedal

so, the usage string is wrong. In fact, the described usage string is only for the default action to create a new branch.

Yes, this is far from pretty.

Quoted 6 lines

Maybe it would have been better to have separate stg subcommands?

stg branch NAME [COMMIT]
stg list-branches
stg rename-branch OLD NEW
... etc ...

My first thought was another level of subcommands:

stg branch NAME [COMMIT]
stg branch list
stg branch rename OLD NEW

But this would create ambiguities -- how do I create a branch called "list"?. One could go with something like

stg branch NAME [COMMIT]
stg branch/list
stg branch/rename OLD NEW

but this is highly non-standard, and would probably confuse every single new user. Perhaps with dashes instead:

stg branch NAME [COMMIT]
stg branch-list
stg branch-rename OLD NEW

Which is essentially what you proposed, but with more regular (and more tab-completion-friendly) names.

Signature · 2 lines
Karl Hasselström, [email protected]
      www.treskal.com/kalle