Rev 2468: Merge Martin. in http://bazaar.launchpad.net/~bzr/bzr/dirstate
Robert Collins
robertc at robertcollins.net
Tue Mar 6 07:25:36 GMT 2007
At http://bazaar.launchpad.net/~bzr/bzr/dirstate
------------------------------------------------------------
revno: 2468
revision-id: robertc at robertcollins.net-20070306072420-xfvlsmm6hw0rrqe9
parent: robertc at robertcollins.net-20070306065234-iq1i2xm003oxvaoi
parent: mbp at sourcefrog.net-20070306050546-3lujsd390sq65um0
committer: Robert Collins <robertc at robertcollins.net>
branch nick: dirstate.dogfood
timestamp: Tue 2007-03-06 18:24:20 +1100
message:
Merge Martin.
modified:
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/bzrdir.py bzrdir.py-20060131065624-156dfea39c4387cb
bzrlib/tests/bzrdir_implementations/test_bzrdir.py test_bzrdir.py-20060131065642-0ebeca5e30e30866
bzrlib/tests/test_subsume.py test_subsume.py-20060927040024-tsvh4pchajoayymg-1
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
------------------------------------------------------------
revno: 2461.1.1
merged: mbp at sourcefrog.net-20070306050546-3lujsd390sq65um0
parent: mbp at sourcefrog.net-20070306035757-8633p96f76gzzgg5
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: subtree
timestamp: Tue 2007-03-06 16:05:46 +1100
message:
Add BzrDir.retire_bzrdir and partly fix subsume
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2007-03-05 04:55:34 +0000
+++ b/bzrlib/builtins.py 2007-03-06 05:05:46 +0000
@@ -2158,7 +2158,6 @@
value_switches=True, title='Branch format'),
]
-
def run(self, url='.', format=None):
from bzrlib.upgrade import upgrade
if format is None:
=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py 2007-03-06 06:52:34 +0000
+++ b/bzrlib/bzrdir.py 2007-03-06 07:24:20 +0000
@@ -65,7 +65,7 @@
from bzrlib.weave import Weave
""")
-from bzrlib.trace import mutter
+from bzrlib.trace import mutter, note
from bzrlib.transport.local import LocalTransport
@@ -352,6 +352,25 @@
"""
raise NotImplementedError(self.create_workingtree)
+ def retire_bzrdir(self):
+ """Permanently disable the bzrdir.
+
+ This is done by renaming it to give the user some ability to recover
+ if there was a problem.
+
+ This will have horrible consequences if anyone has anything locked or
+ in use.
+ """
+ for i in xrange(10000):
+ try:
+ to_path = '.bzr.retired.%d' % i
+ self.root_transport.rename('.bzr', to_path)
+ note("renamed %s to %s"
+ % (self.root_transport.abspath('.bzr'), to_path))
+ break
+ except (errors.TransportError, IOError, errors.PathError):
+ pass
+
def destroy_workingtree(self):
"""Destroy the working tree at this BzrDir.
=== modified file 'bzrlib/tests/bzrdir_implementations/test_bzrdir.py'
--- a/bzrlib/tests/bzrdir_implementations/test_bzrdir.py 2007-03-02 08:55:16 +0000
+++ b/bzrlib/tests/bzrdir_implementations/test_bzrdir.py 2007-03-06 05:05:46 +0000
@@ -451,7 +451,6 @@
'./.bzr/repository/inventory.knit',
])
-
def test_clone_bzrdir_tree_branch_reference(self):
# a tree with a branch reference (aka a checkout)
# should stay a checkout on clone.
@@ -1329,6 +1328,14 @@
text = dir._format.get_format_description()
self.failUnless(len(text))
+ def test_retire_bzrdir(self):
+ bd = self.make_bzrdir('.')
+ # must not overwrite existing directories
+ self.build_tree(['.bzr.retired.0/', '.bzr.retired.0/junk',])
+ self.failUnlessExists('.bzr')
+ bd.retire_bzrdir()
+ self.failIfExists('.bzr')
+ self.failUnlessExists('.bzr.retired.1')
class TestBreakLock(TestCaseWithBzrDir):
=== modified file 'bzrlib/tests/test_subsume.py'
--- a/bzrlib/tests/test_subsume.py 2007-03-06 00:28:36 +0000
+++ b/bzrlib/tests/test_subsume.py 2007-03-06 05:05:46 +0000
@@ -66,8 +66,12 @@
self.assertEqual(sub_root_id, base_tree.path2id('subtree'))
self.assertEqual('file2-id', base_tree.path2id('subtree/file2'))
sub_bzrdir = bzrdir.BzrDir.open('tree/subtree')
+ # subsuming the tree removes the control directory, so you can't open
+ # the workingtree or branch
+ import pdb;pdb.set_trace()
self.assertRaises(errors.NoWorkingTree, sub_bzrdir.open_workingtree)
- sub_bzrdir.open_branch()
+ self.assertRaises(errors.NotBranchError, sub_bzrdir.open_branch)
+ self.failIfExists('tree/subtree/.bzr')
file2 = open('tree/subtree/file2', 'rb')
try:
file2_contents = file2.read()
=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py 2007-03-06 02:37:15 +0000
+++ b/bzrlib/workingtree.py 2007-03-06 05:05:46 +0000
@@ -924,6 +924,8 @@
self.inventory.add(other_root)
add_children(self.inventory, other_root)
self._write_inventory(self.inventory)
+ # normally we don't want to fetch whole repositories, but i think
+ # here we really do want to consolidate the whole thing.
for parent_id in other_tree.get_parent_ids():
self.branch.fetch(other_tree.branch, parent_id)
self.add_parent_tree_id(parent_id)
More information about the bazaar-commits
mailing list