Rev 3284: uncommit --local in an unbound branch raises the same exception as commit --local in http://bzr.arbash-meinel.com/branches/bzr/1.4-dev/uncommit_local

John Arbash Meinel john at arbash-meinel.com
Thu Mar 20 15:12:32 GMT 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.4-dev/uncommit_local

------------------------------------------------------------
revno: 3284
revision-id: john at arbash-meinel.com-20080320151005-z9lajjy69m20of17
parent: john at arbash-meinel.com-20080316104737-e7ffkpet97tkd9js
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: uncommit_local
timestamp: Thu 2008-03-20 10:10:05 -0500
message:
  uncommit --local in an unbound branch raises the same exception as commit --local
modified:
  bzrlib/tests/test_uncommit.py  test_uncommit.py-20080316104338-y3gxu67g5m2qih10-1
  bzrlib/uncommit.py             uncommit.py-20050626215513-5ec509fa425b305c
-------------- next part --------------
=== modified file 'bzrlib/tests/test_uncommit.py'
--- a/bzrlib/tests/test_uncommit.py	2008-03-16 10:44:11 +0000
+++ b/bzrlib/tests/test_uncommit.py	2008-03-20 15:10:05 +0000
@@ -89,3 +89,10 @@
         self.assertEqual((2, history[1]), tree.branch.last_revision_info())
         self.assertEqual(history[0], child.last_revision())
         self.assertEqual((1, history[0]), child.branch.last_revision_info())
+
+    def test_uncommit_unbound_local(self):
+        tree, history = self.make_linear_tree()
+
+        # If this tree isn't bound, local=True raises an exception
+        self.assertRaises(errors.LocalRequiresBoundBranch,
+            uncommit.uncommit, tree.branch, tree=tree, local=True)

=== modified file 'bzrlib/uncommit.py'
--- a/bzrlib/uncommit.py	2008-03-16 10:44:11 +0000
+++ b/bzrlib/uncommit.py	2008-03-20 15:10:05 +0000
@@ -20,7 +20,10 @@
 
 import os
 
-from bzrlib import revision as _mod_revision
+from bzrlib import (
+    errors,
+    revision as _mod_revision,
+    )
 from bzrlib.branch import Branch
 from bzrlib.errors import BoundBranchOutOfDate
 
@@ -48,6 +51,8 @@
 
         if local:
             master = None
+            if branch.get_bound_location() is None:
+                raise errors.LocalRequiresBoundBranch()
         else:
             master = branch.get_master_branch()
             if master is not None:



More information about the bazaar-commits mailing list