Rev 2752: Add CommitBuilder.abort(). in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Aug 28 04:26:08 BST 2007


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 2752
revision-id: pqm at pqm.ubuntu.com-20070828032606-yp46hkvcaan2ew9b
parent: pqm at pqm.ubuntu.com-20070828025141-7uqv78dhm5n8qvnx
parent: jelmer at samba.org-20070828015842-omg7ss93kt0m3ryz
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2007-08-28 04:26:06 +0100
message:
  Add CommitBuilder.abort().
modified:
  bzrlib/commit.py               commit.py-20050511101309-79ec1a0168e0e825
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/tests/repository_implementations/test_commit_builder.py test_commit_builder.py-20060606110838-76e3ra5slucqus81-1
    ------------------------------------------------------------
    revno: 2749.3.1
    merged: jelmer at samba.org-20070828015842-omg7ss93kt0m3ryz
    parent: pqm at pqm.ubuntu.com-20070828012914-ghechpk19ejwk5um
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: bzr.dev
    timestamp: Tue 2007-08-28 03:58:42 +0200
    message:
      Add CommitBuilder.abort().
=== modified file 'bzrlib/commit.py'
--- a/bzrlib/commit.py	2007-08-15 11:24:06 +0000
+++ b/bzrlib/commit.py	2007-08-28 01:58:42 +0000
@@ -316,8 +316,7 @@
                 # Add revision data to the local branch
                 self.rev_id = self.builder.commit(self.message)
             except:
-                # perhaps this should be done by the CommitBuilder ?
-                self.work_tree.branch.repository.abort_write_group()
+                self.builder.abort()
                 raise
 
             # Upload revision data to the master.

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2007-08-23 21:36:56 +0000
+++ b/bzrlib/repository.py	2007-08-28 01:58:42 +0000
@@ -2136,6 +2136,11 @@
         self.repository.commit_write_group()
         return self._new_revision_id
 
+    def abort(self):
+        """Abort the commit that is being built.
+        """
+        self.repository.abort_write_group()
+
     def revision_tree(self):
         """Return the tree that was just committed.
 

=== modified file 'bzrlib/tests/repository_implementations/test_commit_builder.py'
--- a/bzrlib/tests/repository_implementations/test_commit_builder.py	2007-08-01 00:20:37 +0000
+++ b/bzrlib/tests/repository_implementations/test_commit_builder.py	2007-08-28 01:58:42 +0000
@@ -56,6 +56,17 @@
         finally:
             tree.unlock()
 
+    def test_abort(self):
+        tree = self.make_branch_and_tree(".")
+        tree.lock_write()
+        try:
+            builder = tree.branch.get_commit_builder([])
+            self.record_root(builder, tree)
+            builder.finish_inventory()
+            builder.abort()
+        finally:
+            tree.unlock()
+
     def test_commit_message(self):
         tree = self.make_branch_and_tree(".")
         tree.lock_write()




More information about the bazaar-commits mailing list