Rev 2864: Fast revert too. in http://people.ubuntu.com/~robertc/baz2.0/repository
Robert Collins
robertc at robertcollins.net
Tue Oct 30 20:41:25 GMT 2007
At http://people.ubuntu.com/~robertc/baz2.0/repository
------------------------------------------------------------
revno: 2864
revision-id:robertc at robertcollins.net-20071030204117-odbfrt5u28k8ur4l
parent: robertc at robertcollins.net-20071030204056-i1pugmzelp3uu0by
parent: robertc at robertcollins.net-20071030200323-2iyytqgqcltpngta
committer: Robert Collins <robertc at robertcollins.net>
branch nick: repository
timestamp: Wed 2007-10-31 07:41:17 +1100
message:
Fast revert too.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
------------------------------------------------------------
revno: 2592.1.25.2.7.1.28.1.6.1.3.1.9.2.1.3.74.1.31.3.18.1.9.1.2.1.12.1.8.1.46.1.18.1.1.2.21.2.10.3.8.2.9.1.9.2.2.2.1
revision-id:robertc at robertcollins.net-20071030200323-2iyytqgqcltpngta
parent: pqm at pqm.ubuntu.com-20071029221703-zy7q7a0ehfvpybtn
committer: Robert Collins <robertc at robertcollins.net>
branch nick: revert
timestamp: Wed 2007-10-31 07:03:23 +1100
message:
* Revert takes out an appropriate lock when reverting to a basis tree, and
does not read the basis inventory twice. (Robert Collins)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
=== modified file 'NEWS'
--- a/NEWS 2007-10-30 18:05:32 +0000
+++ b/NEWS 2007-10-30 20:41:17 +0000
@@ -95,6 +95,9 @@
* Partial commits are now approximately 40% faster by walking over the
unselected current tree more efficiently. (Robert Collins)
+ * Revert takes out an appropriate lock when reverting to a basis tree, and
+ does not read the basis inventory twice. (Robert Collins)
+
* XML inventory serialisation takes 20% less time while being stricter about
the contents. (Robert Collins)
=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py 2007-10-22 01:23:51 +0000
+++ b/bzrlib/workingtree.py 2007-10-30 20:03:23 +0000
@@ -1960,14 +1960,29 @@
' as of bzr 0.91. Please use None (the default) instead.',
DeprecationWarning, stacklevel=2)
if old_tree is None:
- old_tree = self.basis_tree()
- conflicts = transform.revert(self, old_tree, filenames, backups, pb,
- report_changes)
- if filenames is None:
- self.set_parent_ids(self.get_parent_ids()[:1])
- resolve(self)
+ basis_tree = self.basis_tree()
+ basis_tree.lock_read()
+ old_tree = basis_tree
else:
- resolve(self, filenames, ignore_misses=True)
+ basis_tree = None
+ try:
+ conflicts = transform.revert(self, old_tree, filenames, backups, pb,
+ report_changes)
+ if filenames is None:
+ parent_trees = []
+ last_revision = self.last_revision()
+ if last_revision != NULL_REVISION:
+ if basis_tree is None:
+ basis_tree = self.basis_tree()
+ basis_tree.lock_read()
+ parent_trees.append((last_revision, basis_tree))
+ self.set_parent_trees(parent_trees)
+ resolve(self)
+ else:
+ resolve(self, filenames, ignore_misses=True)
+ finally:
+ if basis_tree is not None:
+ basis_tree.unlock()
return conflicts
def revision_tree(self, revision_id):
More information about the bazaar-commits
mailing list