Rev 4470: bundle-revisions should support --strict too. in file:///home/vila/src/bzr/bugs/206577-send-strict/

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Jun 29 10:47:16 BST 2009


At file:///home/vila/src/bzr/bugs/206577-send-strict/

------------------------------------------------------------
revno: 4470
revision-id: v.ladeuil+lp at free.fr-20090629094716-lwjbd7qvzlj2kqgf
parent: v.ladeuil+lp at free.fr-20090629084920-t0sfp4z9dnd496si
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 206577-send-strict
timestamp: Mon 2009-06-29 11:47:16 +0200
message:
  bundle-revisions should support --strict too.
  
  * bzrlib/tests/blackbox/test_send.py:
  (TestSendBase): Rely on class attributes to set default values.
  (TestBundleStrictWithoutChanges): Test command-line option handling.
  
  * bzrlib/builtins.py:
  (cmd_bundle_revisions): Add --strict option.
-------------- next part --------------
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2009-06-26 18:13:41 +0000
+++ b/bzrlib/builtins.py	2009-06-29 09:47:16 +0000
@@ -4958,6 +4958,9 @@
                type=unicode),
         Option('output', short_name='o', help='Write directive to this file.',
                type=unicode),
+        Option('strict',
+               help='Refuse to bundle revisions if there are'
+               ' uncommitted changes in the working tree.'),
         'revision',
         RegistryOption('format',
                        help='Use the specified output format.',
@@ -4971,14 +4974,14 @@
 
     def run(self, submit_branch=None, public_branch=None, no_bundle=False,
             no_patch=False, revision=None, remember=False, output=None,
-            format=None, **kwargs):
+            format=None, strict=None, **kwargs):
         if output is None:
             output = '-'
         from bzrlib.send import send
         return send(submit_branch, revision, public_branch, remember,
                          format, no_bundle, no_patch, output,
                          kwargs.get('from', '.'), None, None, None,
-                         self.outf)
+                         self.outf, strict=strict)
 
 
 class cmd_tag(Command):

=== modified file 'bzrlib/tests/blackbox/test_send.py'
--- a/bzrlib/tests/blackbox/test_send.py	2009-06-29 08:49:20 +0000
+++ b/bzrlib/tests/blackbox/test_send.py	2009-06-29 09:47:16 +0000
@@ -52,8 +52,12 @@
 
 class TestSendBase(tests.TestCaseWithTransport):
 
-    def run_send(self, args, cmd=None, rc=0, wd='branch', err_re=None):
-        if cmd is None: cmd = ['send', '-o-']
+    _default_command = ['send', '-o-']
+    _default_wd = 'branch'
+
+    def run_send(self, args, cmd=None, rc=0, wd=None, err_re=None):
+        if cmd is None: cmd = self._default_command
+        if wd is None: wd = self._default_wd
         if err_re is None: err_re = []
         return self.run_bzr(cmd + args, retcode=rc,
                             working_dir=wd,
@@ -285,6 +289,9 @@
 
 class TestSendStrict(TestSendBase):
 
+    _default_command = ['send', '-o-', '../parent']
+    _default_wd = 'local'
+
     def make_parent_and_local_branches(self):
         # Create a 'parent' branch as the base
         self.parent_tree = bzrdir.BzrDir.create_standalone_workingtree('parent')
@@ -297,12 +304,6 @@
         self.build_tree_contents([('local/file', 'local')])
         self.local_tree.commit('second commit', rev_id='local')
 
-    def run_send(self, args, cmd=None, rc=0, wd='local', err_re=None):
-        if cmd is None: cmd = ['send', '../parent', '-o-']
-        if err_re is None: err_re = []
-        return super(TestSendStrict, self).run_send(
-            args, cmd=cmd, rc=rc, wd=wd, err_re=err_re)
-
     def set_config_send_strict(self, value):
         # set config var (any of bazaar.conf, locations.conf, branch.conf
         # should do)
@@ -405,3 +406,8 @@
         self.set_config_send_strict('false')
         self.assertSendSucceeds(['local'], [])
         self.assertSendFails(['--strict'])
+
+
+class TestBundleStrictWithoutChanges(TestSendStrictWithoutChanges):
+
+    _default_command = ['bundle-revisions', '../parent']



More information about the bazaar-commits mailing list