Rev 3249: (bialix) Allow rename (change case of name) directory on case-insensitive in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Tue Mar 4 00:37:21 GMT 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3249
revision-id:pqm at pqm.ubuntu.com-20080304003709-35vh1eqa8tuuq548
parent: pqm at pqm.ubuntu.com-20080303194913-w6v25p1a79x3plya
parent: bialix at ukr.net-20080303230447-83vigrbk417p4tdi
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2008-03-04 00:37:09 +0000
message:
(bialix) Allow rename (change case of name) directory on case-insensitive
filesystem.
modified:
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/tests/blackbox/test_mv.py test_mv.py-20060705114902-33tkxz0o9cdshemo-1
------------------------------------------------------------
revno: 3246.1.2
revision-id:bialix at ukr.net-20080303230447-83vigrbk417p4tdi
parent: bialix at ukr.net-20080229155356-wjc96jdnisg0evah
committer: Alexander Belchenko <bialix at ukr.net>
branch nick: mv.dir.cifs
timestamp: Tue 2008-03-04 01:04:47 +0200
message:
test_mv_file_to_wrong_case_dir require feature CaseInsensitiveFilesystem
modified:
bzrlib/tests/blackbox/test_mv.py test_mv.py-20060705114902-33tkxz0o9cdshemo-1
------------------------------------------------------------
revno: 3246.1.1
revision-id:bialix at ukr.net-20080229155356-wjc96jdnisg0evah
parent: pqm at pqm.ubuntu.com-20080229011300-p50it0si2y8mbv0d
committer: Alexander Belchenko <bialix at ukr.net>
branch nick: mv.dir.cifs
timestamp: Fri 2008-02-29 17:53:56 +0200
message:
Allow rename (change case of name) directory on case-insensitive filesystem.
modified:
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/tests/blackbox/test_mv.py test_mv.py-20060705114902-33tkxz0o9cdshemo-1
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2008-02-25 07:28:29 +0000
+++ b/bzrlib/builtins.py 2008-02-29 15:53:56 +0000
@@ -534,8 +534,13 @@
if len(names_list) < 2:
raise errors.BzrCommandError("missing file argument")
tree, rel_names = tree_files(names_list)
-
- if os.path.isdir(names_list[-1]):
+
+ dest = names_list[-1]
+ isdir = os.path.isdir(dest)
+ if (isdir and not tree.case_sensitive and len(rel_names) == 2
+ and rel_names[0].lower() == rel_names[1].lower()):
+ isdir = False
+ if isdir:
# move into existing directory
for pair in tree.move(rel_names[:-1], rel_names[-1], after=after):
self.outf.write("%s => %s\n" % pair)
@@ -546,8 +551,8 @@
' directory')
tree.rename_one(rel_names[0], rel_names[1], after=after)
self.outf.write("%s => %s\n" % (rel_names[0], rel_names[1]))
-
-
+
+
class cmd_pull(Command):
"""Turn this branch into a mirror of another branch.
=== modified file 'bzrlib/tests/blackbox/test_mv.py'
--- a/bzrlib/tests/blackbox/test_mv.py 2007-11-19 22:54:30 +0000
+++ b/bzrlib/tests/blackbox/test_mv.py 2008-03-03 23:04:47 +0000
@@ -24,6 +24,7 @@
)
from bzrlib.tests import (
+ CaseInsensitiveFilesystemFeature,
SymlinkFeature,
TestCaseWithTransport,
)
@@ -124,7 +125,7 @@
os.chdir('..')
self.assertMoved('sub1/sub2/hello.txt','sub1/hello.txt')
- def test_mv_change_case(self):
+ def test_mv_change_case_file(self):
# test for bug #77740 (mv unable change filename case on Windows)
tree = self.make_branch_and_tree('.')
self.build_tree(['test.txt'])
@@ -137,6 +138,41 @@
self.assertInWorkingTree('Test.txt')
self.assertNotInWorkingTree('test.txt')
+ def test_mv_change_case_dir(self):
+ tree = self.make_branch_and_tree('.')
+ self.build_tree(['foo/'])
+ tree.add(['foo'])
+ self.run_bzr('mv foo Foo')
+ # we can't use failUnlessExists on case-insensitive filesystem
+ # so try to check shape of the tree
+ shape = sorted(os.listdir(u'.'))
+ self.assertEqual(['.bzr', 'Foo'], shape)
+ self.assertInWorkingTree('Foo')
+ self.assertNotInWorkingTree('foo')
+
+ def test_mv_change_case_dir_w_files(self):
+ tree = self.make_branch_and_tree('.')
+ self.build_tree(['foo/', 'foo/bar'])
+ tree.add(['foo'])
+ self.run_bzr('mv foo Foo')
+ # we can't use failUnlessExists on case-insensitive filesystem
+ # so try to check shape of the tree
+ shape = sorted(os.listdir(u'.'))
+ self.assertEqual(['.bzr', 'Foo'], shape)
+ self.assertInWorkingTree('Foo')
+ self.assertNotInWorkingTree('foo')
+
+ def test_mv_file_to_wrong_case_dir(self):
+ self.requireFeature(CaseInsensitiveFilesystemFeature)
+ tree = self.make_branch_and_tree('.')
+ self.build_tree(['foo/', 'bar'])
+ tree.add(['foo', 'bar'])
+ out, err = self.run_bzr('mv bar Foo', retcode=3)
+ self.assertEquals('', out)
+ self.assertEquals(
+ 'bzr: ERROR: Could not move to Foo: Foo is not versioned.\n',
+ err)
+
def test_mv_smoke_aliases(self):
# just test that aliases for mv exist, if their behaviour is changed in
# the future, then extend the tests.
More information about the bazaar-commits
mailing list