Rev 5191: (vila) Don't mention --no-strict when we just issue the warning about in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Apr 28 12:52:55 BST 2010


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

------------------------------------------------------------
revno: 5191 [merge]
revision-id: pqm at pqm.ubuntu.com-20100428115252-dj0jg0on85ww9qoj
parent: pqm at pqm.ubuntu.com-20100428094023-7504mlou1qk28r9n
parent: v.ladeuil+lp at free.fr-20100428103344-e32qf3cn1avdd2cb
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2010-04-28 12:52:52 +0100
message:
  (vila) Don't mention --no-strict when we just issue the warning about
  	unclean trees
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/foreign.py              foreign.py-20081112170002-olsxmandkk8qyfuq-1
  bzrlib/mutabletree.py          mutabletree.py-20060906023413-4wlkalbdpsxi2r4y-2
  bzrlib/send.py                 send.py-20090521192735-j7cdb33ykmtmzx4w-1
  bzrlib/tests/blackbox/test_dpush.py test_dpush.py-20090108125928-st1td6le59g0vyv2-1
  bzrlib/tests/blackbox/test_push.py test_push.py-20060329002750-929af230d5d22663
  bzrlib/tests/blackbox/test_send.py test_bundle.py-20060616222707-c21c8b7ea5ef57b1
=== modified file 'NEWS'
--- a/NEWS	2010-04-28 09:40:23 +0000
+++ b/NEWS	2010-04-28 10:33:44 +0000
@@ -45,6 +45,9 @@
 * ``bzr selftest`` should not use ui.note() since it's not unicode safe.
   (Vincent Ladeuil, #563997)
 
+* Don't mention --no-strict when we just issue the warning about unclean trees.
+  (Vincent Ladeuil, #401599)
+
 * Reduce peak memory by one copy of compressed text.
   (John Arbash Meinel, #566940)
 

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2010-04-28 09:40:23 +0000
+++ b/bzrlib/builtins.py	2010-04-28 10:33:44 +0000
@@ -1132,8 +1132,10 @@
         else:
             revision_id = None
         if tree is not None and revision_id is None:
-            tree.warn_if_changed_or_out_of_date(
-                strict, 'push_strict', 'Use --no-strict to force the push.')
+            tree.check_changed_or_out_of_date(
+                strict, 'push_strict',
+                more_error='Use --no-strict to force the push.',
+                more_warning='Uncommitted changes will not be pushed.')
         # Get the stacked_on branch, if any
         if stacked_on is not None:
             stacked_on = urlutils.normalize_url(stacked_on)

=== modified file 'bzrlib/foreign.py'
--- a/bzrlib/foreign.py	2010-04-20 22:38:03 +0000
+++ b/bzrlib/foreign.py	2010-04-28 10:33:44 +0000
@@ -297,8 +297,10 @@
             source_branch = Branch.open(directory)
             source_wt = None
         if source_wt is not None:
-            source_wt.warn_if_changed_or_out_of_date(
-                strict, 'dpush_strict', 'Use --no-strict to force the push.')
+            source_wt.check_changed_or_out_of_date(
+                strict, 'dpush_strict',
+                more_error='Use --no-strict to force the push.',
+                more_warning='Uncommitted changes will not be pushed.')
         stored_loc = source_branch.get_push_location()
         if location is None:
             if stored_loc is None:

=== modified file 'bzrlib/mutabletree.py'
--- a/bzrlib/mutabletree.py	2010-04-15 06:47:06 +0000
+++ b/bzrlib/mutabletree.py	2010-04-22 14:18:17 +0000
@@ -258,7 +258,8 @@
             return False
 
     @needs_read_lock
-    def warn_if_changed_or_out_of_date(self, strict, opt_name, more_msg):
+    def check_changed_or_out_of_date(self, strict, opt_name,
+                                     more_error, more_warning):
         """Check the tree for uncommitted changes and branch synchronization.
 
         If strict is None and not set in the config files, a warning is issued.
@@ -269,25 +270,29 @@
 
         :param opt_name: strict option name to search in config file.
 
-        :param more_msg: Details about how to avoid the warnings.
+        :param more_error: Details about how to avoid the check.
+
+        :param more_warning: Details about what is happening.
         """
         if strict is None:
             strict = self.branch.get_config().get_user_option_as_bool(opt_name)
         if strict is not False:
-            err = None
+            err_class = None
             if (self.has_changes()):
-                err = errors.UncommittedChanges(self, more=more_msg)
+                err_class = errors.UncommittedChanges
             elif self.last_revision() != self.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 action with --no-strict
-                err = errors.OutOfDateTree(self, more=more_msg)
-            if err is not None:
+                err_class = errors.OutOfDateTree
+            if err_class is not None:
                 if strict is None:
+                    err = err_class(self, more=more_warning)
                     # We don't want to interrupt the user if he expressed no
                     # preference about strict.
                     trace.warning('%s', err._format())
                 else:
+                    err = err_class(self, more=more_error)
                     raise err
 
     @needs_read_lock

=== modified file 'bzrlib/send.py'
--- a/bzrlib/send.py	2010-04-12 16:54:35 +0000
+++ b/bzrlib/send.py	2010-04-22 14:18:17 +0000
@@ -111,8 +111,10 @@
                 base_revision_id = revision[0].as_revision_id(branch)
         if revision_id is None:
             if tree is not None:
-                tree.warn_if_changed_or_out_of_date(
-                    strict, 'send_strict', 'Use --no-strict to force the send.')
+                tree.check_changed_or_out_of_date(
+                    strict, 'send_strict',
+                    more_error='Use --no-strict to force the send.',
+                    more_warning='Uncommitted changes will not be sent.')
             revision_id = branch.last_revision()
         if revision_id == NULL_REVISION:
             raise errors.BzrCommandError('No revisions to submit.')

=== modified file 'bzrlib/tests/blackbox/test_dpush.py'
--- a/bzrlib/tests/blackbox/test_dpush.py	2010-04-13 06:42:19 +0000
+++ b/bzrlib/tests/blackbox/test_dpush.py	2010-04-28 10:30:48 +0000
@@ -153,24 +153,6 @@
         conf.set_user_option('dpush_strict', value)
 
     _default_command = ['dpush', '../to']
-    _default_pushed_revid = False # Doesn't aplly for dpush
-
-    def assertPushSucceeds(self, args, pushed_revid=None, with_warning=False):
-        if with_warning:
-            error_regexes = self._default_errors
-        else:
-            error_regexes = []
-        self.run_bzr(self._default_command + args,
-                     working_dir=self._default_wd, error_regexes=error_regexes)
-        if pushed_revid is None:
-            # dpush change the revids, so we need to get back to it
-            branch_from = branch.Branch.open(self._default_wd)
-            pushed_revid = branch_from.last_revision()
-        branch_to = branch.Branch.open('to')
-        repo_to = branch_to.repository
-        self.assertTrue(repo_to.has_revision(pushed_revid))
-        self.assertEqual(branch_to.last_revision(), pushed_revid)
-
 
 
 class TestDpushStrictWithoutChanges(TestDpushStrictMixin,

=== modified file 'bzrlib/tests/blackbox/test_push.py'
--- a/bzrlib/tests/blackbox/test_push.py	2010-04-15 06:47:06 +0000
+++ b/bzrlib/tests/blackbox/test_push.py	2010-04-28 10:30:48 +0000
@@ -661,27 +661,35 @@
     _default_wd = 'local'
     _default_errors = ['Working tree ".*/local/" has uncommitted '
                        'changes \(See bzr status\)\.',]
-    _default_pushed_revid = 'modified'
+    _default_additional_error = 'Use --no-strict to force the push.\n'
+    _default_additional_warning = 'Uncommitted changes will not be pushed.'
+
 
     def assertPushFails(self, args):
-        ret = self.run_bzr_error(self._default_errors,
-                                 self._default_command + args,
-                                 working_dir=self._default_wd, retcode=3)
+        out, err = self.run_bzr_error(self._default_errors,
+                                      self._default_command + args,
+                                      working_dir=self._default_wd, retcode=3)
+        self.assertContainsRe(err, self._default_additional_error)
 
-    def assertPushSucceeds(self, args, pushed_revid=None, with_warning=False):
+    def assertPushSucceeds(self, args, with_warning=False, revid_to_push=None):
         if with_warning:
             error_regexes = self._default_errors
         else:
             error_regexes = []
-        ret = self.run_bzr(self._default_command + args,
-                           working_dir=self._default_wd,
-                           error_regexes=error_regexes)
-        if pushed_revid is None:
-            pushed_revid = self._default_pushed_revid
-        tree_to = workingtree.WorkingTree.open('to')
-        repo_to = tree_to.branch.repository
-        self.assertTrue(repo_to.has_revision(pushed_revid))
-        self.assertEqual(tree_to.branch.last_revision_info()[1], pushed_revid)
+        out, err = self.run_bzr(self._default_command + args,
+                                working_dir=self._default_wd,
+                                error_regexes=error_regexes)
+        if with_warning:
+            self.assertContainsRe(err, self._default_additional_warning)
+        else:
+            self.assertNotContainsRe(err, self._default_additional_warning)
+        branch_from = branch.Branch.open(self._default_wd)
+        if revid_to_push is None:
+            revid_to_push = branch_from.last_revision()
+        branch_to = branch.Branch.open('to')
+        repo_to = branch_to.repository
+        self.assertTrue(repo_to.has_revision(revid_to_push))
+        self.assertEqual(revid_to_push, branch_to.last_revision())
 
 
 
@@ -748,13 +756,12 @@
         self._default_wd = 'checkout'
         self._default_errors = ["Working tree is out of date, please run"
                                 " 'bzr update'\.",]
-        self._default_pushed_revid = 'modified-in-local'
 
     def test_push_default(self):
         self.assertPushSucceeds([], with_warning=True)
 
     def test_push_with_revision(self):
-        self.assertPushSucceeds(['-r', 'revid:added'], pushed_revid='added')
+        self.assertPushSucceeds(['-r', 'revid:added'], revid_to_push='added')
 
     def test_push_no_strict(self):
         self.assertPushSucceeds(['--no-strict'])

=== modified file 'bzrlib/tests/blackbox/test_send.py'
--- a/bzrlib/tests/blackbox/test_send.py	2010-04-12 16:41:03 +0000
+++ b/bzrlib/tests/blackbox/test_send.py	2010-04-28 10:30:48 +0000
@@ -307,6 +307,8 @@
     _default_sent_revs = ['local']
     _default_errors = ['Working tree ".*/local/" has uncommitted '
                        'changes \(See bzr status\)\.',]
+    _default_additional_error = 'Use --no-strict to force the send.\n'
+    _default_additional_warning = 'Uncommitted changes will not be sent.'
 
     def set_config_send_strict(self, value):
         # set config var (any of bazaar.conf, locations.conf, branch.conf
@@ -315,7 +317,8 @@
         conf.set_user_option('send_strict', value)
 
     def assertSendFails(self, args):
-        self.run_send(args, rc=3, err_re=self._default_errors)
+        out, err = self.run_send(args, rc=3, err_re=self._default_errors)
+        self.assertContainsRe(err, self._default_additional_error)
 
     def assertSendSucceeds(self, args, revs=None, with_warning=False):
         if with_warning:
@@ -327,6 +330,7 @@
         out, err = self.run_send(args, err_re=err_re)
         bundling_revs = 'Bundling %d revision(s).\n' % len(revs)
         if with_warning:
+            self.assertContainsRe(err, self._default_additional_warning)
             self.assertEndsWith(err, bundling_revs)
         else:
             self.assertEquals(bundling_revs, err)




More information about the bazaar-commits mailing list