开发者

How to properly merge two bzr branches?

开发者 https://www.devze.com 2023-03-17 21:37 出处:网络
I work with two branches of the same project. Both of them were created by me many months ago. I am the only developer of this project. I return to this project after a long period ofneglect.

I work with two branches of the same project. Both of them were created by me many months ago. I am the only developer of this project. I return to this project after a long period of neglect.

My original intent (as far as I remember what I had on my mind ~2 years ago) was to have a single (shared) repository without working trees and have the main trunk branch as well as several experimental ones (as needed). I ended up with two branches - the first one is the "production branch" and the second one was created to test experimental features. Following are the outputs of bzr info issued inside the two branches:

Branch 1

C:\My\Proj\path\qwerty>bzr info
Lightweight checkout (format: 2a)
Location:
  light checkout root: .
   checkout of branch: C:/My/Proj/path/qwertyBazaarRepo/trunk
    shared repository: C:/My/Proj/path/qwertyBazaarRepo

Related branches:
  parent branch: .
  submit branch: C:/My/Proj/path/ExperimentalQwerty

C:\My\Proj\path\qwerty>

Branch 2

C:\My\Proj\path\ExperimentalQwerty>bzr info
Standalone tree (format: 2a)
Location:
  branch root: .

Related branches:
  parent branch: C:/开发者_StackOverflow社区My/Proj/path/qwertyBazaarRepo/trunk
  submit branch: C:/My/Proj/path/qwertyBazaarRepo/trunk

I would like to merge several files of the two branches (so that they become identical in all these two and any subsequent branches). What is the best approach of doing this?

P.S. For visual examination of the changes/merges I would like to use kdiff3


Actually your 1st location is lightweight checkout of branch C:/My/Proj/path/qwertyBazaarRepo/trunk and it indeed uses shared repository. The second location is standalone branch.

To compare history of 2 branches use either bzr missing path/to/other/branch command or bzr qlog path/to/branch1 path/to/branch2.

If you don't want to merge history, but only changes, then you can use either kdiff3 directly on 2 trees and manually merge changes, or use bzr merge path/to/file command to merge individual files, run merge from your trunk branch (1st location).

To merge changes from several files, you can run bzr merge FILE several times without committing after each merge, but for all subsequent merges you must use --force command-line option, i.e. bzr merge --force FILE.

Also, you can use bzr shelve after merge to remove changes you don't want to be there.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号