Rev 4488: --strict is now the default for push. in file:///home/vila/src/bzr/bugs/284038-push-strict/

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Jun 29 08:14:23 BST 2009


At file:///home/vila/src/bzr/bugs/284038-push-strict/

------------------------------------------------------------
revno: 4488
revision-id: v.ladeuil+lp at free.fr-20090629071423-j2z48i7oy3mv1vig
parent: pqm at pqm.ubuntu.com-20090626180331-304i6c0fz5nc54fs
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 284038-push-strict
timestamp: Mon 2009-06-29 09:14:23 +0200
message:
  --strict is now the default for push.
  
  * tests/blackbox/test_push.py:
  (TestPushStrict.test_push_default,
  TestPushStrict.test_push_bogus_config_var_ignored): --strict
  defaults to True now.
  
  * builtins.py:
  (cmd_push.run): Make --strict true by default. Handle usage in
  tree-less branches (uncovered by the test suite !).
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2009-06-26 09:24:34 +0000
+++ b/NEWS	2009-06-29 07:14:23 +0000
@@ -21,8 +21,9 @@
 New Features
 ************
 
-* ``bzr push`` now checks if uncommitted changes are present in the working
-  tree if the ``--strict`` option is used.
+* ``bzr push`` now aborts if uncommitted changes (including pending merges)
+  are present in the working tree (if one is present). The ``push_strict``
+  option can be declared in a configuration file.  option is used.
   (Vincent Ladeuil, #284038)
 
 

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2009-06-26 03:44:30 +0000
+++ b/bzrlib/builtins.py	2009-06-29 07:14:23 +0000
@@ -1057,9 +1057,9 @@
                     strict = bools[strict.lower()]
                 except KeyError:
                     strict = None
-        if strict:
+        if tree is not None and (strict is None or strict): # Default to True:
             changes = tree.changes_from(tree.basis_tree())
-            if changes.has_changed():
+            if changes.has_changed() or len(tree.get_parent_ids()) > 1:
                 raise errors.UncommittedChanges(tree)
         # Get the tip's revision_id
         revision = _get_one_revision('push', revision)

=== modified file 'bzrlib/tests/blackbox/test_push.py'
--- a/bzrlib/tests/blackbox/test_push.py	2009-06-22 08:14:24 +0000
+++ b/bzrlib/tests/blackbox/test_push.py	2009-06-29 07:14:23 +0000
@@ -603,7 +603,7 @@
 
     def test_push_default(self):
         tree = self.make_local_branch_and_tree_with_changes()
-        self.assertPushSucceeds('to')
+        self.assertPushFails('to')
 
     def test_push_no_strict_with_changes(self):
         tree = self.make_local_branch_and_tree_with_changes()
@@ -625,7 +625,7 @@
     def test_push_bogus_config_var_ignored(self):
         tree = self.make_local_branch_and_tree_with_changes()
         self.set_config_push_strict(tree, "I don't want you to be strict")
-        self.assertPushSucceeds('to')
+        self.assertPushFails('to')
 
     def test_push_no_strict_command_line_override_config(self):
         tree = self.make_local_branch_and_tree_with_changes()



More information about the bazaar-commits mailing list