Rev 3228: Add a converter for format 7 branches. in http://people.ubuntu.com/~robertc/baz2.0/shallow-branch
Robert Collins
robertc at robertcollins.net
Thu Feb 14 04:42:32 GMT 2008
At http://people.ubuntu.com/~robertc/baz2.0/shallow-branch
------------------------------------------------------------
revno: 3228
revision-id:robertc at robertcollins.net-20080214044227-pq3gtz42jh3xug6j
parent: robertc at robertcollins.net-20080214020803-7d2spy97gxqd8yd9
committer: Robert Collins <robertc at robertcollins.net>
branch nick: StackableBranch
timestamp: Thu 2008-02-14 15:42:27 +1100
message:
Add a converter for format 7 branches.
modified:
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/bzrdir.py bzrdir.py-20060131065624-156dfea39c4387cb
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py 2008-02-14 00:40:32 +0000
+++ b/bzrlib/branch.py 2008-02-14 04:42:27 +0000
@@ -2168,3 +2168,13 @@
except NoSuchFile:
pass
branch.set_bound_location(None)
+
+
+class Converter6to7(object):
+ """Perform an in-place upgrade of format 6 to format 7"""
+
+ def convert(self, branch):
+ branch.control_files.put_utf8('stacked-on', '\n')
+ # update target format
+ new_branch.control_files.put_utf8('format',
+ format.get_format_string())
=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py 2008-02-14 00:40:32 +0000
+++ b/bzrlib/bzrdir.py 2008-02-14 04:42:27 +0000
@@ -2354,10 +2354,17 @@
# InterXFormat lookups
# Avoid circular imports
from bzrlib import branch as _mod_branch
- if (branch._format.__class__ is _mod_branch.BzrBranchFormat5 and
- self.target_format.get_branch_format().__class__ is
- _mod_branch.BzrBranchFormat6):
+ old_new = (branch._format.__class__,
+ self.target_format.get_branch_format().__class__)
+ if (old_new ==
+ (_mod_branch.BzrBranchFormat5, _mod_branch.BzrBranchFormat6)):
branch_converter = _mod_branch.Converter5to6()
+ elif (old_new ==
+ (_mod_branch.BzrBranchFormat6, _mod_branch.BzrBranchFormat7)):
+ branch_converter = _mod_branch.Converter6to7()
+ else:
+ branch_converter = None
+ if branch_converter is not None:
branch_converter.convert(branch)
try:
tree = self.bzrdir.open_workingtree(recommend_upgrade=False)
More information about the bazaar-commits
mailing list