Rev 2335: In status, read lock the old and new trees being used to let data caching occur. in file:///home/robertc/source/baz/dirstate/

Robert Collins robertc at robertcollins.net
Fri Feb 16 07:04:34 GMT 2007


At file:///home/robertc/source/baz/dirstate/

------------------------------------------------------------
revno: 2335
revision-id: robertc at robertcollins.net-20070216070433-1r4p40b7s3hecuks
parent: robertc at robertcollins.net-20070216065950-axser9wg4u3ta0zs
committer: Robert Collins <robertc at robertcollins.net>
branch nick: dirstate
timestamp: Fri 2007-02-16 18:04:33 +1100
message:
  In status, read lock the old and new trees being used to let data caching occur.
modified:
  bzrlib/status.py               status.py-20050505062338-431bfa63ec9b19e6
=== modified file 'bzrlib/status.py'
--- a/bzrlib/status.py	2006-12-07 20:25:00 +0000
+++ b/bzrlib/status.py	2007-02-16 07:04:33 +0000
@@ -134,31 +134,37 @@
                     raise errors.BzrCommandError(str(e))
             else:
                 new = wt
-        _raise_if_nonexistent(specific_files, old, new)
-        delta = new.changes_from(old, want_unchanged=show_unchanged,
-                              specific_files=specific_files)
-        delta.show(to_file,
-                   show_ids=show_ids,
-                   show_unchanged=show_unchanged,
-                   short_status=short)
-        short_status_letter = '?'
-        if not short:
-            short_status_letter = ''
-        list_paths('unknown', new.unknowns(), specific_files, to_file,
-                   short_status_letter)
-        conflict_title = False
-        # show the new conflicts only for now. XXX: get them from the delta.
-        for conflict in new.conflicts():
-            if not short and conflict_title is False:
-                print >> to_file, "conflicts:"
-                conflict_title = True
-            if short:
-                prefix = 'C '
-            else:
-                prefix = ' '
-            print >> to_file, "%s %s" % (prefix, conflict)
-        if new_is_working_tree and show_pending:
-            show_pending_merges(new, to_file, short)
+        old.lock_read()
+        new.lock_read()
+        try:
+            _raise_if_nonexistent(specific_files, old, new)
+            delta = new.changes_from(old, want_unchanged=show_unchanged,
+                                  specific_files=specific_files)
+            delta.show(to_file,
+                       show_ids=show_ids,
+                       show_unchanged=show_unchanged,
+                       short_status=short)
+            short_status_letter = '?'
+            if not short:
+                short_status_letter = ''
+            list_paths('unknown', new.unknowns(), specific_files, to_file,
+                       short_status_letter)
+            conflict_title = False
+            # show the new conflicts only for now. XXX: get them from the delta.
+            for conflict in new.conflicts():
+                if not short and conflict_title is False:
+                    print >> to_file, "conflicts:"
+                    conflict_title = True
+                if short:
+                    prefix = 'C '
+                else:
+                    prefix = ' '
+                print >> to_file, "%s %s" % (prefix, conflict)
+            if new_is_working_tree and show_pending:
+                show_pending_merges(new, to_file, short)
+        finally:
+            old.unlock()
+            new.unlock()
     finally:
         wt.unlock()
 



More information about the bazaar-commits mailing list