Mercurial > hg-stable
view tests/test-revset-dirstate-parents.t @ 35746:e5b6ba786d83
branch: allow changing branch name to existing name if possible
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.
Differential Revision: https://phab.mercurial-scm.org/D1913
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Fri, 19 Jan 2018 18:45:20 +0530 |
parents | 7bbc4e113e5f |
children |
line wrap: on
line source
$ HGENCODING=utf-8 $ export HGENCODING $ try() { > hg debugrevspec --debug $@ > } $ log() { > hg log --template '{rev}\n' -r "$1" > } $ hg init repo $ cd repo $ try 'p1()' (func (symbol 'p1') None) * set: <baseset []> $ try 'p2()' (func (symbol 'p2') None) * set: <baseset []> $ try 'parents()' (func (symbol 'parents') None) * set: <baseset+ []> null revision $ log 'p1()' $ log 'p2()' $ log 'parents()' working dir with a single parent $ echo a > a $ hg ci -Aqm0 $ log 'p1()' 0 $ log 'tag() and p1()' $ log 'p2()' $ log 'parents()' 0 $ log 'tag() and parents()' merge in progress $ echo b > b $ hg ci -Aqm1 $ hg up -q 0 $ echo c > c $ hg ci -Aqm2 $ hg merge -q $ log 'p1()' 2 $ log 'p2()' 1 $ log 'tag() and p2()' $ log 'parents()' 1 2 $ cd ..