Switch branches with default branch in mercurial -


in repo i'm working, created named branch @ time try different approach in issue. continued work in default branch well.

now named branch has matured speak, make branch, default one, , give different name (old) default branch.

is possible?

i've found question, mercurial: can rename branch? , can rename default branch successfully, afterwards when try rename named branch default, fails error

abort: branch of same name exists 

yes, can.

you need close branches , give them required name

ps: seems needed add -f flag branch command

sample scenario

hg init echo "123" > file hg addremove hg commit -m "init default"  hg branch new echo "new" >> file hg commit -m "init new"  hg default echo "default" >> file hg commit -m "default 2nd" hg commit --close-branch -m "close default"   hg new hg commit --close-branch -m "close new"  hg branches # none  hg log # see update if haven't saved id/hash somewhere  hg 3 # changset "close default" 1 hg branch new -f hg commit -m "new new"  hg 4 # changeset closed "new" @ hg branch default -f hg commit -m "new default" 

the result:

enter image description here

>hg log -g o  changeset:   6:af87a53292cf |  tag:         tip |  parent:      4:700a73ac7cad |  user:        ivan kurnosov |  date:        tue jun 05 17:22:27 2012 +1200 |  summary:     new default | | @  changeset:   5:4ee990605ba1 | |  branch:      new | |  parent:      3:6ebccfc3e630 | |  user:        "ivan kurnosov | |  date:        tue jun 05 17:18:01 2012 +1200 | |  summary:     new new | | o |  changeset:   4:700a73ac7cad | |  branch:      new | |  parent:      1:4a149d3fe86e | |  user:        "ivan kurnosov | |  date:        tue jun 05 17:15:18 2012 +1200 | |  summary:     close new | | | o  changeset:   3:6ebccfc3e630 | |  user:        "ivan kurnosov | |  date:        tue jun 05 17:14:49 2012 +1200 | |  summary:     close default | | | o  changeset:   2:92669a82423b | |  parent:      0:05657f61324b | |  user:        "ivan kurnosov | |  date:        tue jun 05 17:13:07 2012 +1200 | |  summary:     default 2nd | | o |  changeset:   1:4a149d3fe86e |/   branch:      new |    user:        "ivan kurnosov |    date:        tue jun 05 17:12:30 2012 +1200 |    summary:     init new | o  changeset:   0:05657f61324b    user:        "ivan kurnosov    date:        tue jun 05 17:11:51 2012 +1200    summary:     init default 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -