Rev 2438: add missing _must_be_locked and a better message in file:///home/mbp/bzr/Work/subtree/

Martin Pool mbp at sourcefrog.net
Mon Mar 5 05:06:03 GMT 2007


------------------------------------------------------------
revno: 2438
revision-id: mbp at sourcefrog.net-20070305050600-4oib0crvql5oiedd
parent: mbp at sourcefrog.net-20070305045534-pqrd3x4sy71x6ttw
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: subtree
timestamp: Mon 2007-03-05 16:06:00 +1100
message:
  add missing _must_be_locked and a better message
modified:
  bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
  bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
=== modified file 'bzrlib/transform.py'
--- a/bzrlib/transform.py	2007-03-05 04:55:34 +0000
+++ b/bzrlib/transform.py	2007-03-05 05:06:00 +0000
@@ -1137,8 +1137,8 @@
     file_trans_id = {}
     top_pb = bzrlib.ui.ui_factory.nested_progress_bar()
     pp = ProgressPhase("Build phase", 2, top_pb)
-#    if tree.inventory.root is not None:
-#        wt.set_root_id(tree.inventory.root.file_id)
+    if tree.inventory.root is not None:
+        wt.set_root_id(tree.inventory.root.file_id)
     tt = TreeTransform(wt)
     divert = set()
     try:
@@ -1174,7 +1174,9 @@
                         if kind == 'directory':
                             reparent = True
                 if entry.parent_id not in file_trans_id:
-                    raise repr(entry.parent_id)
+                    raise AssertionError(
+                        'entry %s parent id %r is not in file_trans_id %r'
+                        % (entry, entry.parent_id, file_trans_id))
                 parent_id = file_trans_id[entry.parent_id]
                 file_trans_id[file_id] = new_by_entry(tt, entry, parent_id,
                                                       tree)

=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2007-03-05 04:55:34 +0000
+++ b/bzrlib/workingtree_4.py	2007-03-05 05:06:00 +0000
@@ -1439,6 +1439,10 @@
                 self._dirstate_locked = True
         self._locked += 1
 
+    def _must_be_locked(self):
+        if not self._locked:
+            raise errors.ObjectNotLocked(self)
+
     @needs_read_lock
     def path2id(self, path):
         """Return the id for path in this tree."""




More information about the bazaar-commits mailing list