Monotonically increasing bazaar trunk revision num

2019-07-24 20:03发布

问题:

I'm still figuring out how bazaar's revision numbering works. The workflow our team uses is basically:

bzr branch lp:project/trunk
# code,code,code
bzr commit ...
# code,code,code
bzr commit ...
bzr merge
# resolve, resolve, resolve
bzr push lp:project/trunk

I'd prefer it if the trunk revision numbering was stable and increased monotonically with each push. However, as I understand it, whoever does bzr merge; bzr push lp:project/trunk ends up renumbering the revision history of the trunk to whatever their local branch revision numbering was. This makes things very confusing for the team, because "trunk, revision 705" may change over time.

We could use global ids, but it's a little awkward to work with a long string like foo@example.com-20110224160420-nnob0vg2vdk0yjow.

Is there any way to arrange our workflow so that the trunk revision numbering scheme is stable and increases monotonically?

回答1:

On the trunk on your central server, edit <yourbranch>/.bzr/branch/branch.conf or ~/.bazaar/locations.conf or ~/.bazaar/bazaar.conf

add append_revisions_only=True

This branch's existing revision order will not change any more.

http://doc.bazaar.canonical.com/beta/en/user-reference/configuration-help.html#append-revisions-only

Edit: For launchpad you can try the following as John Arbash Meinel said:

At the moment, the only way to get a branch with that option is during "bzr init".

bzr init --append-revisions-only

So you could:

1) have launchpad delete the existing branch

2) bzr init --append-revisions-only lp:...

3) bzr push lp:...

Not exactly optimal.

The other way to do it is to use sftp and do:

sftp bazaar.launchpad.net

cd ~user/project/branch/.bzr/branch get branch.conf

Then outside of sftp, edit the file to add append_revisions_only = True

put branch.conf

https://lists.ubuntu.com/archives/bazaar/2008q3/046797.html