Rev 6225: (jr) ``bzr mv`` does not crash when attempting to move the root of a branch. in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

Patch Queue Manager pqm at pqm.ubuntu.com
Tue Oct 18 14:50:22 UTC 2011


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 6225 [merge]
revision-id: pqm at pqm.ubuntu.com-20111018145022-q5crzwqjwu6z33ue
parent: pqm at pqm.ubuntu.com-20111018133223-ilue5mcvyfipjuap
parent: jriddell at canonical.com-20111018133113-toh9d2zvjwozorwi
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2011-10-18 14:50:22 +0000
message:
  (jr) ``bzr mv`` does not crash when attempting to move the root of a branch.
   (Jonathan Riddell, #809728) (Jonathan Riddell)
modified:
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/tests/blackbox/test_mv.py test_mv.py-20060705114902-33tkxz0o9cdshemo-1
  doc/en/release-notes/bzr-2.5.txt bzr2.5.txt-20110708125756-587p0hpw7oke4h05-1
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2011-10-14 13:56:45 +0000
+++ b/bzrlib/builtins.py	2011-10-18 13:31:13 +0000
@@ -884,6 +884,9 @@
         if len(names_list) < 2:
             raise errors.BzrCommandError(gettext("missing file argument"))
         tree, rel_names = WorkingTree.open_containing_paths(names_list, canonicalize=False)
+        for file_name in rel_names[0:-1]:
+            if file_name == '':
+                raise errors.BzrCommandError(gettext("can not move root of branch"))
         self.add_cleanup(tree.lock_tree_write().unlock)
         self._run(tree, names_list, rel_names, after)
 

=== modified file 'bzrlib/tests/blackbox/test_mv.py'
--- a/bzrlib/tests/blackbox/test_mv.py	2011-07-11 06:47:32 +0000
+++ b/bzrlib/tests/blackbox/test_mv.py	2011-10-17 13:40:28 +0000
@@ -187,6 +187,12 @@
         self.run_bzr('move a b')
         self.run_bzr('rename b a')
 
+    def test_mv_no_root(self):
+        tree = self.make_branch_and_tree('.')
+        self.run_bzr_error(
+            ["bzr: ERROR: can not move root of branch"],
+            'mv . a')
+
     def test_mv_through_symlinks(self):
         self.requireFeature(SymlinkFeature)
         tree = self.make_branch_and_tree('.')

=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- a/doc/en/release-notes/bzr-2.5.txt	2011-10-18 13:32:23 +0000
+++ b/doc/en/release-notes/bzr-2.5.txt	2011-10-18 14:50:22 +0000
@@ -51,6 +51,9 @@
 * ``bzr mkdir --quiet`` now does not print a line for every created
   directory. (Martin von Gagern, #869915)
 
+* ``bzr mv`` does not crash when attempting to move the root of a
+  branch. (Jonathan Riddell, #809728)
+
 * ``bzr shelve`` now use ``UIFactory.choose`` for input handling, making
   it usable when creating a custom ``UIFactory`` implementation. (Benoît
   Pierre)




More information about the bazaar-commits mailing list