Rev 4724: Make all test pass by implement --strict for dpush. in file:///home/vila/src/bzr/bugs/438158-dpush-strict/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Fri Oct 2 10:11:43 BST 2009
At file:///home/vila/src/bzr/bugs/438158-dpush-strict/
------------------------------------------------------------
revno: 4724
revision-id: v.ladeuil+lp at free.fr-20091002091143-rcequ044n1hkhxz6
parent: v.ladeuil+lp at free.fr-20091002085713-fk4vvapu1dox6hn1
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 438158-dpush-strict
timestamp: Fri 2009-10-02 11:11:43 +0200
message:
Make all test pass by implement --strict for dpush.
* bzrlib/tests/blackbox/test_dpush.py:
Make all tests pass.
(TestDpush.test_dpush_wt_diff): Adjust the test.
* bzrlib/help_topics/en/configuration.txt:
(dpush_strict): Document the configuration variable.
* bzrlib/foreign.py:
(cmd_dpush.run): Check that the working tree has no changes when
strict is on.
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2009-09-29 04:51:58 +0000
+++ b/NEWS 2009-10-02 09:11:43 +0000
@@ -53,6 +53,11 @@
longer report incorrect errors about ``Missing inventory ('TREE_ROOT', ...)``
(Robert Collins, #416732)
+* ``bzr dpush`` now aborts if uncommitted changes (including pending merges)
+ are present in the working tree. The configuration option ``dpush_strict``
+ can be used to set the default for this behavior.
+ (Vincent Ladeuil, #438158)
+
* ``bzr info -v`` on a 2a format still claimed that it was a "Development
format" (John Arbash Meinel, #424392)
=== modified file 'bzrlib/foreign.py'
--- a/bzrlib/foreign.py 2009-10-02 08:57:13 +0000
+++ b/bzrlib/foreign.py 2009-10-02 09:11:43 +0000
@@ -300,6 +300,21 @@
except NoWorkingTree:
source_branch = Branch.open(directory)
source_wt = None
+ if strict is None:
+ strict = source_branch.get_config(
+ ).get_user_option_as_bool('dpush_strict')
+ if strict is None: strict = True # default value
+ if strict and source_wt is not None:
+ if (source_wt.has_changes(source_wt.basis_tree())
+ or len(source_wt.get_parent_ids()) > 1):
+ raise errors.UncommittedChanges(
+ source_wt, more='Use --no-strict to force the push.')
+ if source_wt.last_revision() != source_wt.branch.last_revision():
+ # The tree has lost sync with its branch, there is little
+ # chance that the user is aware of it but he can still force
+ # the push with --no-strict
+ raise errors.OutOfDateTree(
+ source_wt, more='Use --no-strict to force the push.')
stored_loc = source_branch.get_push_location()
if location is None:
if stored_loc is None:
=== modified file 'bzrlib/help_topics/en/configuration.txt'
--- a/bzrlib/help_topics/en/configuration.txt 2009-08-21 09:19:11 +0000
+++ b/bzrlib/help_topics/en/configuration.txt 2009-10-02 09:11:43 +0000
@@ -464,6 +464,13 @@
If present, defines the ``--strict`` option default value for checking
uncommitted changes before pushing.
+dpush_strict
+~~~~~~~~~~~~
+
+If present, defines the ``--strict`` option default value for checking
+uncommitted changes before pushing into a different VCS without any
+custom bzr metadata.
+
bound_location
~~~~~~~~~~~~~~
=== modified file 'bzrlib/tests/blackbox/test_dpush.py'
--- a/bzrlib/tests/blackbox/test_dpush.py 2009-10-02 08:57:13 +0000
+++ b/bzrlib/tests/blackbox/test_dpush.py 2009-10-02 09:11:43 +0000
@@ -125,8 +125,10 @@
newrevid = dc_tree.commit('msg')
self.build_tree_contents([("dc/foofile", "blaaaal")])
- self.check_output("", "dpush -d dc d")
+ self.check_output("", "dpush -d dc d --no-strict")
self.assertFileEqual("blaaaal", "dc/foofile")
+ # if the dummy vcs wasn't that dummy we could uncomment the line below
+ # self.assertFileEqual("blaaaa", "d/foofile")
self.check_output('modified:\n foofile\n', "status dc")
def test_diverged(self):
More information about the bazaar-commits
mailing list