This is an archive of the discontinued Mercurial Phabricator instance.

branch: allow changing branch name to existing name if possible
ClosedPublic

Authored by pulkit on Jan 19 2018, 9:39 AM.

Details

Summary

With the functionality added in previous patch we can change branches of a
revision but not everytime even if it's possible to do so. For example cosider
the following case:

o 3 added a (foo)
o 2 added b (foo)
o 1 added c (bar)
o 0 added d (bar)

Here if I want to change the branch of rev 2,3 to bar, it was not possible and
it will say, "a branch with same name exists".

This patch allows us to change branch of 2,3 to bar. The underlying logic for
changing branch finds the changesets from the revs passed which have no parents
in revs. We only support revsets which have only one such root, so to support
this we check whether the parent of the root has the same name as that of the
new name and if so, we can use the new name to change branches.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

pulkit created this revision.Jan 19 2018, 9:39 AM
durin42 accepted this revision.Jan 19 2018, 3:00 PM
This revision is now accepted and ready to land.Jan 19 2018, 3:00 PM
This revision was automatically updated to reflect the committed changes.