Rev 3975: (Jelmer) Support symlinks with unicode characters in the symlink name. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Jan 30 18:55:47 GMT 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3975
revision-id: pqm at pqm.ubuntu.com-20090130185542-dbj7mapm1fvtwm3y
parent: pqm at pqm.ubuntu.com-20090130031028-y70uzzpad9c47v09
parent: jelmer at samba.org-20090130181241-cbb2x802djvfp6cs
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2009-01-30 18:55:42 +0000
message:
  (Jelmer) Support symlinks with unicode characters in the symlink name.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/dirstate.py             dirstate.py-20060728012006-d6mvoihjb3je9peu-1
  bzrlib/tests/tree_implementations/test_get_symlink_target.py test_get_symlink_tar-20070225165554-ickod3w3t7u0zzqh-1
  bzrlib/tests/tree_implementations/test_path_content_summary.py test_path_content_su-20070904100855-3vrwedz6akn34kl5-1
  bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
    ------------------------------------------------------------
    revno: 3949.6.6
    revision-id: jelmer at samba.org-20090130181241-cbb2x802djvfp6cs
    parent: jelmer at samba.org-20090129164644-xa3bxpnb3yp45bjo
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: unicode-symlinks
    timestamp: Fri 2009-01-30 19:12:41 +0100
    message:
      Skip unicode symlink tests on non-unicode file systems.
    modified:
      bzrlib/tests/tree_implementations/test_get_symlink_target.py test_get_symlink_tar-20070225165554-ickod3w3t7u0zzqh-1
      bzrlib/tests/tree_implementations/test_path_content_summary.py test_path_content_su-20070904100855-3vrwedz6akn34kl5-1
    ------------------------------------------------------------
    revno: 3949.6.5
    revision-id: jelmer at samba.org-20090129164644-xa3bxpnb3yp45bjo
    parent: jelmer at samba.org-20090128103825-kipwyk4apyn5khf9
    parent: pqm at pqm.ubuntu.com-20090129131703-lgus0aiclez3isj6
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: unicode-symlinks
    timestamp: Thu 2009-01-29 17:46:44 +0100
    message:
      Merge bzr.dev.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/annotate.py             annotate.py-20050922133147-7c60541d2614f022
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/fetch.py                fetch.py-20050818234941-26fea6105696365d
      bzrlib/foreign.py              foreign.py-20081112170002-olsxmandkk8qyfuq-1
      bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
      bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
      bzrlib/log.py                  log.py-20050505065812-c40ce11702fe5fb1
      bzrlib/merge.py                merge.py-20050513021216-953b65a438527106
      bzrlib/missing.py              missing.py-20050812153334-097f7097e2a8bcd1
      bzrlib/revisionspec.py         revisionspec.py-20050907152633-17567659fd5c0ddb
      bzrlib/tests/blackbox/test_annotate.py testannotate.py-20051013044000-457f44801bfa9d39
      bzrlib/tests/blackbox/test_breakin.py test_breakin.py-20070424043903-qyy6zm4pj3h4sbp3-1
      bzrlib/tests/blackbox/test_log.py test_log.py-20060112090212-78f6ea560c868e24
      bzrlib/tests/blackbox/test_missing.py test_missing.py-20051211212735-a2cf4c1840bb84c4
      bzrlib/tests/blackbox/test_serve.py test_serve.py-20060913064329-8t2pvmsikl4s3xhl-1
      bzrlib/tests/blackbox/test_shelve.py test_ls_shelf.py-20081202053526-thlo8yt0pi1cgor1-1
      bzrlib/tests/test_foreign.py   test_foreign.py-20081125004048-ywb901edgp9lluxo-1
      bzrlib/tests/test_graph.py     test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
      bzrlib/tests/test_log.py       testlog.py-20050728115707-1a514809d7d49309
      bzrlib/tests/test_merge.py     testmerge.py-20050905070950-c1b5aa49ff911024
      bzrlib/tests/test_missing.py   test_missing.py-20051212000028-694fa4f658a81f48
      bzrlib/tests/test_versionedfile.py test_versionedfile.py-20060222045249-db45c9ed14a1c2e5
      bzrlib/util/bencode.py         bencode.py-20070220044742-sltr28q21w2wzlxi-1
      bzrlib/util/tests/test_bencode.py test_bencode.py-20070713042202-qjw8rppxaz7ky6i6-1
      bzrlib/versionedfile.py        versionedfile.py-20060222045106-5039c71ee3b65490
    ------------------------------------------------------------
    revno: 3949.6.4
    revision-id: jelmer at samba.org-20090128103825-kipwyk4apyn5khf9
    parent: jelmer at samba.org-20090128103803-hqonmgfjb13mblj7
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: unicode-symlinks
    timestamp: Wed 2009-01-28 11:38:25 +0100
    message:
      Encode filenames on file system in fs encoding during tests.
    modified:
      bzrlib/tests/tree_implementations/test_get_symlink_target.py test_get_symlink_tar-20070225165554-ickod3w3t7u0zzqh-1
      bzrlib/tests/tree_implementations/test_path_content_summary.py test_path_content_su-20070904100855-3vrwedz6akn34kl5-1
    ------------------------------------------------------------
    revno: 3949.6.3
    revision-id: jelmer at samba.org-20090128103803-hqonmgfjb13mblj7
    parent: jelmer at samba.org-20090128093831-a8i03wn5zwtawzzk
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: unicode-symlinks
    timestamp: Wed 2009-01-28 11:38:03 +0100
    message:
      Fix unicode symlink handling when the C extensions are not built.
    modified:
      bzrlib/dirstate.py             dirstate.py-20060728012006-d6mvoihjb3je9peu-1
    ------------------------------------------------------------
    revno: 3949.6.2
    revision-id: jelmer at samba.org-20090128093831-a8i03wn5zwtawzzk
    parent: jelmer at samba.org-20090122204135-9kwta8oeyrrlfbp0
    parent: pqm at pqm.ubuntu.com-20090126181248-yl5ctbxc3y6nu9m4
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: unicode-symlinks
    timestamp: Wed 2009-01-28 10:38:31 +0100
    message:
      Merge bzr.dev.
    added:
      bzrlib/tests/branch_implementations/test_dotted_revno_to_revision_id.py test_dotted_revno_to-20090121014844-6x7d9jtri5sspg1o-1
      bzrlib/tests/branch_implementations/test_iter_merge_sorted_revisions.py test_merge_sorted_re-20090121004847-to3gvjwigstu93eh-1
      bzrlib/tests/branch_implementations/test_revision_id_to_dotted_revno.py test_revision_id_to_-20090122052032-g3czslif6sdqfkh3-1
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
      bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
      bzrlib/log.py                  log.py-20050505065812-c40ce11702fe5fb1
      bzrlib/merge.py                merge.py-20050513021216-953b65a438527106
      bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
      bzrlib/progress.py             progress.py-20050610070202-df9faaab791964c0
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/revisionspec.py         revisionspec.py-20050907152633-17567659fd5c0ddb
      bzrlib/tests/branch_implementations/__init__.py __init__.py-20060123013057-b12a52c3f361daf4
      bzrlib/tests/test_knit.py      test_knit.py-20051212171302-95d4c00dd5f11f2b
      bzrlib/tests/test_log.py       testlog.py-20050728115707-1a514809d7d49309
      bzrlib/tests/test_merge.py     testmerge.py-20050905070950-c1b5aa49ff911024
      bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
      bzrlib/tests/test_progress.py  test_progress.py-20060308160359-978c397bc79b7fda
      bzrlib/tests/test_ui.py        test_ui.py-20051130162854-458e667a7414af09
      bzrlib/transport/http/__init__.py http_transport.py-20050711212304-506c5fd1059ace96
      bzrlib/transport/http/_pycurl.py pycurlhttp.py-20060110060940-4e2a705911af77a6
      bzrlib/transport/http/_urllib.py _urlgrabber.py-20060113083826-0bbf7d992fbf090c
      bzrlib/transport/http/response.py _response.py-20060613154423-a2ci7hd4iw5c7fnt-1
      bzrlib/ui/__init__.py          ui.py-20050824083933-8cf663c763ba53a9
      bzrlib/ui/text.py              text.py-20051130153916-2e438cffc8afc478
      doc/developers/api-versioning.txt apiversioning.txt-20070626065626-iiihgmhgkv91uphz-1
      doc/developers/plugin-api.txt  pluginapi.txt-20080229110225-q2j5y4agqhlkjn0s-1
    ------------------------------------------------------------
    revno: 3949.6.1
    revision-id: jelmer at samba.org-20090122204135-9kwta8oeyrrlfbp0
    parent: pqm at pqm.ubuntu.com-20090120210300-641tutf1rkdn8a3n
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: bzr.dev
    timestamp: Thu 2009-01-22 21:41:35 +0100
    message:
      Support symlinks with non-ascii characters in the symlink filename.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/tests/tree_implementations/test_get_symlink_target.py test_get_symlink_tar-20070225165554-ickod3w3t7u0zzqh-1
      bzrlib/tests/tree_implementations/test_path_content_summary.py test_path_content_su-20070904100855-3vrwedz6akn34kl5-1
      bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
=== modified file 'NEWS'
--- a/NEWS	2009-01-29 07:57:43 +0000
+++ b/NEWS	2009-01-29 16:46:44 +0000
@@ -91,6 +91,9 @@
       a new ``until_no_eintr`` helper function in ``bzrlib.osutils``.
       (Andrew Bennetts)
 
+    * Support symlinks with non-ascii characters in the symlink filename.
+      (Jelmer Vernooij, #319323)
+
     * There was a bug in how we handled resolving when a file is deleted
       in one branch, and modified in the other. If there was a criss-cross
       merge, we would cause the deletion to conflict a second time.

=== modified file 'bzrlib/dirstate.py'
--- a/bzrlib/dirstate.py	2009-01-08 05:53:19 +0000
+++ b/bzrlib/dirstate.py	2009-01-28 10:38:03 +0000
@@ -1588,7 +1588,7 @@
         #       already in memory. However, this really needs to be done at a
         #       higher level, because there either won't be anything on disk,
         #       or the thing on disk will be a file.
-        return os.readlink(abspath)
+        return os.readlink(abspath.encode(osutils._fs_enc))
 
     def get_ghosts(self):
         """Return a list of the parent tree revision ids that are ghosts."""

=== modified file 'bzrlib/tests/tree_implementations/test_get_symlink_target.py'
--- a/bzrlib/tests/tree_implementations/test_get_symlink_target.py	2007-11-01 09:52:45 +0000
+++ b/bzrlib/tests/tree_implementations/test_get_symlink_target.py	2009-01-30 18:12:41 +0000
@@ -46,3 +46,17 @@
         self.assertEqual('foo', tree.get_symlink_target('link-id'))
         self.assertEqual('../bar', tree.get_symlink_target('rel-link-id'))
         self.assertEqual('/baz/bing', tree.get_symlink_target('abs-link-id'))
+
+    def test_get_unicode_symlink_target(self):
+        self.requireFeature(tests.SymlinkFeature)
+        tree = self.make_branch_and_tree('tree')
+        try:
+            os.symlink('target',  u'tree/\u03b2_link'.encode(osutils._fs_enc))
+        except UnicodeError:
+            raise tests.TestSkipped(
+                'This platform does not support unicode file paths.')
+        tree.add([u'\u03b2_link'], ['unicode-link-id'])
+        tree.lock_read()
+        self.addCleanup(tree.unlock)
+        self.assertEqual('target', tree.get_symlink_target(u'unicode-link-id'))
+

=== modified file 'bzrlib/tests/tree_implementations/test_path_content_summary.py'
--- a/bzrlib/tests/tree_implementations/test_path_content_summary.py	2007-09-04 10:08:58 +0000
+++ b/bzrlib/tests/tree_implementations/test_path_content_summary.py	2009-01-30 18:12:41 +0000
@@ -18,7 +18,7 @@
 
 import os
 
-from bzrlib.osutils import supports_executable
+from bzrlib.osutils import supports_executable, _fs_enc
 from bzrlib.tests import SymlinkFeature, TestSkipped, TestNotApplicable
 from bzrlib.tests.tree_implementations import TestCaseWithTree
 
@@ -39,6 +39,19 @@
         summary = self._convert_tree(tree).path_content_summary('path')
         self.assertEqual(('symlink', None, None, 'target'), summary)
 
+    def test_unicode_symlink_content_summary(self):
+        self.requireFeature(SymlinkFeature)
+        tree = self.make_branch_and_tree('tree')
+        try:
+            os.symlink('target', u'tree/\u03b2-path'.encode(_fs_enc))
+        except UnicodeError:
+            raise TestSkipped(
+                'This platform does not support unicode file paths.')
+
+        tree.add([u'\u03b2-path'])
+        summary = self._convert_tree(tree).path_content_summary(u'\u03b2-path')
+        self.assertEqual(('symlink', None, None, 'target'), summary)
+
     def test_missing_content_summary(self):
         tree = self.make_branch_and_tree('tree')
         summary = self._convert_tree(tree).path_content_summary('path')

=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py	2009-01-09 06:00:28 +0000
+++ b/bzrlib/workingtree.py	2009-01-22 20:41:35 +0000
@@ -723,7 +723,7 @@
                 kind = 'tree-reference'
             return kind, None, None, None
         elif kind == 'symlink':
-            return ('symlink', None, None, os.readlink(abspath))
+            return ('symlink', None, None, os.readlink(abspath.encode(osutils._fs_enc)))
         else:
             return (kind, None, None, None)
 
@@ -945,7 +945,7 @@
         return file_id
 
     def get_symlink_target(self, file_id):
-        return os.readlink(self.id2abspath(file_id))
+        return os.readlink(self.id2abspath(file_id).encode(osutils._fs_enc))
 
     @needs_write_lock
     def subsume(self, other_tree):




More information about the bazaar-commits mailing list