[PATCH 2 of 2 V3] switch: add a switch extension to easily move between branches (issue4420)

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Mar 9 11:48:18 EST 2016

On 03/09/2016 09:37 AM, liscju wrote:
> # HG changeset patch
> # User liscju <piotr.listkiewicz at gmail.com>
> # Date 1456130672 -3600
> #      Mon Feb 22 09:44:32 2016 +0100
> # Node ID b78377e2f386bd13aa617c257c11e69c1aec34a7
> # Parent  99d42ff5175af8e03eedb8515395d89c0132319c
> switch: add a switch extension to easily move between branches (issue4420)
> This extension allows to switch between branches easily, with
> saving and restoring working changes using shelve extension.
> So far this extension is a first  proposal of solution and i am looking
> forward to opinions,code review and help.

I'm not sold on this yet. Can't people run update on shelve by themselve?

In all cases, It should probably live has a third party extension for a 
while and see if it get traction there.

> Without argument switch command shows possible switch destination -
> other branches. With one argument it shelves current changes, updates
> to given branch and try to unshelve changes. If there are merge
> conflicts while unshelving, it saves current switch state, gives user
> opportunity to resolve conflicts and tries again when user invoke
> switch --continue.
> It also gives user chance to abort this operation with switch --abort,
> that aborts shelve operation, updates to previous node and unshelves
> last saved shelve. This operation relies on current behaviour of shelve
> abort that doesn't do any cleanup of old shelves, so last shelved file
> is always available after running shelve --abort.
> This implementation marks new/missing files as added/removed before
> shelving - this behaviour seems resonable to me but im looking forward
> to opinions about it, especially because it is preserving *.orig files.
> I have doubts if switch should clean them, and if should then
> is cleaning all files with orig extension save. Im looking forward to
> opinions about it.

Urg, we should do the same thing than shelve here. Either shelve is 
doing the right thing and we should rely on it, or shelve is doing 
something wrong and we should fix it.

> This solution also needs adding locking and transactions, i need
> help in those issues because i have very little understanding how
> locking/transactions works.

You need locking, but I'm not sure why you need transaction here, you 
are not adding anything to the store, are you? It seems like you are 
just changing the working copy parent and content.

Pierre-Yves David

More information about the Mercurial-devel mailing list