bzr init-repo
创建一个所谓的
共享存储库
. 在共享存储库中,所有修订都存储在
.bzr
存储库的目录,以及
.bzr公司
分支本身的目录只存储分支元信息,而不是修订本身。这样,分支目录变得非常轻量级,并且分支的常见修订不会重复。
假设我们创建了一个共享存储库,并在其中创建了分支,如下所示:
bzr init-repo the-project # create shared repo
bzr init the-project/trunk # create a branch inside shared repo
cd the-project/trunk # cd to branch dir
cp -r /path/to/files/* . # copy the project's files into the branch
bzr add # tell bazaar to add everything to version control
bzr commit -m 'added files' # commit the changes (add files)
bzr branch . ../branch1 # create another branch from the current one
bzr branch . ../branch2 # create another branch from the current one
然后布局的目录将按如下方式工作:
the-project/.bzr -- only revisions are stored here, no branch info
the-project/trunk/.bzr -- only branch info is stored here, no revisions
the-project/branch1/.bzr -- only branch info is stored here, no revisions
the-project/branch2/.bzr -- only branch info is stored here, no revisions
如果您不使用共享存储库,情况将大不相同,例如:
bzr init trunk # create a repo
cd trunk # cd to repo dir
cp -r /path/to/files/* . # copy the project's files into the repo
bzr add # tell bazaar to add everything to version control
bzr commit -m 'added files' # commit the changes (add files)
bzr branch . ../branch1 # create another repo from the current one
bzr branch . ../branch2 # create another repo from the current one
在这种情况下(无共享回购),布局目录的功能如下:
trunk/.bzr -- revisions + branch info are stored here
branch1/.bzr -- revisions + branch info are stored here
branch2/.bzr -- revisions + branch info are stored here
在这种情况下,修订将在所有3个分支中复制。
bzr pull
bzr merge
.
bzr合并
在您的示例中失败,因为这两个分支(主干和另一个分支)没有共同的修订。这是因为在您从trunk分支时,它是完全空的,没有对它进行任何修改。这两个分支完全独立,绝对没有共同的修订。
正如@bialix在评论中解释的那样,仍然可以合并不相关的分支
bzr merge ../../trunk -r0..-1