How can I work both by default and branch at the same time in Hg?

OK, I'm new to the branches of Mercurial and version control in general, so I may have a fundamental misunderstanding of what is going on here - please be kind ...;)

We are a small development team (2 developers) working on a project, and we need to make quite significant changes, which can take weeks or months. At the same time, the program is used daily, so we need to regularly correct and fix it.

Due to the lengthy nature of the significant change, I created a branch with a default branch (name it dev1). I want to periodically merge changes from the default branch to the dev1 branch for reasons that I don’t need to repeat here. However, I do NOT want the changes from dev1 to be merged into the default branch until much later in development.

I tried several different ways to do this, but it always seems that merging affects both branches. After the merge, if I upgrade by default, I now have the changes from dev1 combined with the source code.

Is it possible to work with two branches using the same repository? If so, can someone tell us about the sequence of commands to use? If not, it seems to me that I would not be able to drag the dev1 branch to the main repo until it finishes, and that just doesn't seem right.

We are launching the latest version of TortoiseHg for Windows, and for the most part I like the graphical tool. Nevertheless, I am absolutely ready to give up the command line in order to perform certain tasks when necessary.

Thanks for any help, Dave

+3
source share
5 answers

It depends on which branch you created.

, , , .

, /

default dev1.

default, , . dev1.

dev1, , , , .

dev1, default, , , , ( , , , )

. , , dev1 default.

, dev1 default . default dev1, default, , default, .

dev1 ,

, default dev1 , .

default, , - . , .

dev1, , - dev1. default , , . , . , default , .

dev1, default, , , default, dev1, , .

, dev1 default, default. / default changeets dev1, default, , default, .

+2

, Mercurial.

-, ( - ), 3 "" Mercurial:

  • a 'named branch' ( hg branch)
  • ,

, hg branch. , , , (, --close-branch, ...).

:

  • dev hg up devbranch
  • dev
  • hg merge default hg merge
  • ( )

:

  • hg up default
  • ( )

:

  • hg up default
  • dev hg merge

, hg merge . , , .

: , , . , , .

hg merge .

+2
# bang on dev1
# more banging on dev1
# someone beats on default for a while
# update to dev1
hg up dev1
# bring in the changes from default
hg merge -r default
# validate successful merge
hg commit -m "merging"

dev1 .

, .

+1

:

, , dev1, .

, - . , , , .

, . , , .

, . , , , , , , ( .)

, dev1, default, dev1, default .

+1

, , ...

I use this process a lot. I find the Transplant extension very useful for named branch workflows. TortoiseHg supports it, so you can enable it in TortoiseHg variants. This allows you to choose from other branches, which is very useful - especially if you regularly make the wrong branch.

0
source

All Articles