Rev 4623: Define --interactive usage. in file:///home/vila/src/bzr/experimental/conflict-manager/

Vincent Ladeuil v.ladeuil+lp at free.fr
Fri Oct 16 14:41:20 BST 2009


At file:///home/vila/src/bzr/experimental/conflict-manager/

------------------------------------------------------------
revno: 4623
revision-id: v.ladeuil+lp at free.fr-20091016134119-lph6s0v463k6jv1e
parent: v.ladeuil+lp at free.fr-20091016132537-c70i3b2uxyoth0hc
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: description
timestamp: Fri 2009-10-16 15:41:19 +0200
message:
  Define --interactive usage.
  
  * bzrlib/tests/blackbox/test_conflicts.py:
  (TestResolve.test_resolve_interactive_all,
  TestResolve.test_resolve_interactive_with_no_files,
  TestResolve.test_resolve_interactive_with_too_much_files):
  Test --interactive error cases.
  
  * bzrlib/conflicts.py:
  (cmd_resolve.run): Define --interactive usage as incompatible with
  --all and requiring a single file argument.
-------------- next part --------------
=== modified file 'bzrlib/conflicts.py'
--- a/bzrlib/conflicts.py	2009-10-16 13:25:37 +0000
+++ b/bzrlib/conflicts.py	2009-10-16 13:41:19 +0000
@@ -94,12 +94,19 @@
             Option('interactive', help='Dialog-based resolution'),
             ]
     def run(self, file_list=None, all=False, interactive=False):
+        if all and interactive:
+            raise errors.BzrCommandError(
+                '--all and --interactive are mutually exclusive')
         if all:
             if file_list:
                 raise errors.BzrCommandError("If --all is specified,"
                                              " no FILE may be provided")
             tree = workingtree.WorkingTree.open_containing('.')[0]
             resolve(tree)
+        elif interactive:
+            if file_list is None or len(file_list) != 1:
+                raise errors.BzrCommandError(
+                    '--interactive requires a single FILE parameter')
         else:
             tree, file_list = builtins.tree_files(file_list)
             if file_list is None:

=== modified file 'bzrlib/tests/blackbox/test_conflicts.py'
--- a/bzrlib/tests/blackbox/test_conflicts.py	2009-10-16 13:13:47 +0000
+++ b/bzrlib/tests/blackbox/test_conflicts.py	2009-10-16 13:41:19 +0000
@@ -18,6 +18,7 @@
 
 from bzrlib import (
     conflicts,
+    errors,
     tests,
     workingtree,
     )
@@ -122,3 +123,15 @@
 
     def test_resolve_interactive(self):
         out, err = self.run_bzr('resolve --interactive mydir2', retcode=0)
+
+    def test_resolve_interactive_all(self):
+        self.run_bzr_error(['--all and --interactive are mutually exclusive'],
+                          ['resolve', '--interactive', '--all'])
+
+    def test_resolve_interactive_with_no_files(self):
+        self.run_bzr_error(['--interactive requires a single FILE parameter'],
+                          ['resolve', '--interactive'])
+
+    def test_resolve_interactive_with_too_much_files(self):
+        self.run_bzr_error(['--interactive requires a single FILE parameter'],
+                          ['resolve', '--interactive', 'foo', 'bar'])



More information about the bazaar-commits mailing list