Rev 2739: Fix unicode handling in diff (Goffredo Baroncelli) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Tue Aug 21 18:50:57 BST 2007
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 2739
revision-id: pqm at pqm.ubuntu.com-20070821175054-6pcl32ipl9eopnqw
parent: pqm at pqm.ubuntu.com-20070821044713-ttnupbvhlsbwh1he
parent: ghigo at venice-20070819094902-59y0vno66y3etdox
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2007-08-21 18:50:54 +0100
message:
Fix unicode handling in diff (Goffredo Baroncelli)
modified:
bzrlib/diff.py diff.py-20050309040759-26944fbbf2ebbf36
bzrlib/tests/test_diff.py testdiff.py-20050727164403-d1a3496ebb12e339
------------------------------------------------------------
revno: 2725.2.1
merged: ghigo at venice-20070819094902-59y0vno66y3etdox
parent: pqm at pqm.ubuntu.com-20070817192843-0jaoxooskia72irk
committer: ghigo <ghigo at venice>
branch nick: bzr-bug-diff
timestamp: Sun 2007-08-19 11:49:02 +0200
message:
When a unicode filename is renamed, in the diff is showed a wrong result
$ bzr mv aaaèè aaaùù
$ bzr diff
=== renamed file 'aaaèè' => 'aaa\xc3\xb9\xc3\xb9'
=== modified file 'bzrlib/diff.py'
--- a/bzrlib/diff.py 2007-08-15 06:46:33 +0000
+++ b/bzrlib/diff.py 2007-08-19 09:49:02 +0000
@@ -424,7 +424,7 @@
text_modified, meta_modified) in delta.renamed:
has_changes = 1
prop_str = get_prop_change(meta_modified)
- print >>to_file, "=== renamed %s '%s' => %r%s" % (
+ print >>to_file, "=== renamed %s '%s' => '%s'%s" % (
kind, old_path.encode('utf8'),
new_path.encode('utf8'), prop_str)
old_name = '%s%s\t%s' % (old_label, old_path,
=== modified file 'bzrlib/tests/test_diff.py'
--- a/bzrlib/tests/test_diff.py 2007-07-26 21:18:35 +0000
+++ b/bzrlib/tests/test_diff.py 2007-08-19 09:49:02 +0000
@@ -498,6 +498,35 @@
self.assertContainsRe(diff, r"--- a/%s" % (omega_utf8,))
self.assertContainsRe(diff, r"\+\+\+ b/%s" % (omega_utf8,))
+ def test_unicode_filename(self):
+ """Test when the filename are unicode."""
+ self.requireFeature(UnicodeFilename)
+
+ alpha, omega = u'\u03b1', u'\u03c9'
+ autf8, outf8 = alpha.encode('utf8'), omega.encode('utf8')
+
+ tree = self.make_branch_and_tree('tree')
+ self.build_tree_contents([('tree/ren_'+alpha, 'contents\n')])
+ tree.add(['ren_'+alpha], ['file-id-2'])
+ self.build_tree_contents([('tree/del_'+alpha, 'contents\n')])
+ tree.add(['del_'+alpha], ['file-id-3'])
+ self.build_tree_contents([('tree/mod_'+alpha, 'contents\n')])
+ tree.add(['mod_'+alpha], ['file-id-4'])
+
+ tree.commit('one', rev_id='rev-1')
+
+ tree.rename_one('ren_'+alpha, 'ren_'+omega)
+ tree.remove('del_'+alpha)
+ self.build_tree_contents([('tree/add_'+alpha, 'contents\n')])
+ tree.add(['add_'+alpha], ['file-id'])
+ self.build_tree_contents([('tree/mod_'+alpha, 'contents_mod\n')])
+
+ diff = self.get_diff(tree.basis_tree(), tree)
+ self.assertContainsRe(diff,
+ "=== renamed file 'ren_%s' => 'ren_%s'\n"%(autf8, outf8))
+ self.assertContainsRe(diff, "=== added file 'add_%s'"%autf8)
+ self.assertContainsRe(diff, "=== modified file 'mod_%s'"%autf8)
+ self.assertContainsRe(diff, "=== removed file 'del_%s'"%autf8)
class TestPatienceDiffLib(TestCase):
More information about the bazaar-commits
mailing list