Rev 6393: (gz) Fix mix up of path encodings in dirstate when updating children of a in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

Patch Queue Manager pqm at pqm.ubuntu.com
Wed Dec 21 00:07:50 UTC 2011


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

------------------------------------------------------------
revno: 6393 [merge]
revision-id: pqm at pqm.ubuntu.com-20111221000749-jnw2o645cdjr961f
parent: pqm at pqm.ubuntu.com-20111220232724-wje5zrxmccnqhsph
parent: rory.yorke at gmail.com-20111220184804-n4eqyhp49i1t5mz1
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2011-12-21 00:07:49 +0000
message:
  (gz) Fix mix up of path encodings in dirstate when updating children of a
   moved directory (Rory Yorke)
modified:
  bzrlib/dirstate.py             dirstate.py-20060728012006-d6mvoihjb3je9peu-1
  bzrlib/tests/blackbox/test_commit.py test_commit.py-20060212094538-ae88fc861d969db0
  doc/en/release-notes/bzr-2.5.txt bzr2.5.txt-20110708125756-587p0hpw7oke4h05-1
=== modified file 'bzrlib/dirstate.py'
--- a/bzrlib/dirstate.py	2011-12-19 13:23:58 +0000
+++ b/bzrlib/dirstate.py	2011-12-21 00:07:49 +0000
@@ -1561,16 +1561,19 @@
                     else:
                         source_path = child_basename
                     if new_path_utf8:
-                        target_path = new_path_utf8 + source_path[len(old_path):]
+                        target_path = \
+                            new_path_utf8 + source_path[len(old_path_utf8):]
                     else:
-                        if old_path == '':
+                        if old_path_utf8 == '':
                             raise AssertionError("cannot rename directory to"
                                                  " itself")
-                        target_path = source_path[len(old_path) + 1:]
+                        target_path = source_path[len(old_path_utf8) + 1:]
                     adds.append((None, target_path, entry[0][2], entry[1][1], False))
                     deletes.append(
                         (source_path, target_path, entry[0][2], None, False))
-                deletes.append((old_path_utf8, new_path, file_id, None, False))
+                deletes.append(
+                    (old_path_utf8, new_path_utf8, file_id, None, False))
+
         self._check_delta_ids_absent(new_ids, delta, 1)
         try:
             # Finish expunging deletes/first half of renames.

=== modified file 'bzrlib/tests/blackbox/test_commit.py'
--- a/bzrlib/tests/blackbox/test_commit.py	2011-12-14 20:39:58 +0000
+++ b/bzrlib/tests/blackbox/test_commit.py	2011-12-20 18:47:35 +0000
@@ -855,6 +855,21 @@
         self.assertContainsRe(err,
             'Branch.*test_checkout.*appears to be bound to itself')
 
+    def test_mv_dirs_non_ascii(self):
+        """Move directory with non-ascii name and containing files.
+
+        Regression test for bug 185211.
+        """
+        tree = self.make_branch_and_tree('.')
+        self.build_tree([u'abc\xc3/', u'abc\xc3/foo'])
+
+        tree.add([u'abc\xc3/', u'abc\xc3/foo'])
+        tree.commit('checkin')
+
+        tree.rename_one(u'abc\xc3','abc')
+
+        self.run_bzr('ci -m "non-ascii mv"')
+
 
 class TestSmartServerCommit(TestCaseWithTransport):
 

=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- a/doc/en/release-notes/bzr-2.5.txt	2011-12-19 16:41:49 +0000
+++ b/doc/en/release-notes/bzr-2.5.txt	2011-12-21 00:07:49 +0000
@@ -64,6 +64,9 @@
   user email (obtained from the ``email`` configuration option or its
   default value). (Vincent Ladeuil, Jelmer Vernooij, #904550)
 
+* Prevent spurious InconsistentDelta error when committing a move of a
+  non-ascii directory with contents. (Rory Yorke, #185211)
+
 * Properly ignore '\n' in an option reference since this cannot be part of a
   config option identifier. (Vincent Ladeuil, #902125)
 




More information about the bazaar-commits mailing list