Rev 4564: (Jelmer) Support exporting symlinks when exporting from a working in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Jul 23 21:28:49 BST 2009


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

------------------------------------------------------------
revno: 4564 [merge]
revision-id: pqm at pqm.ubuntu.com-20090723202846-qpxxgq1j5805yrf6
parent: pqm at pqm.ubuntu.com-20090723170027-0tfrsqpe3tiqnpcb
parent: jelmer at samba.org-20090723183654-adgkw9azmfj111wy
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2009-07-23 21:28:46 +0100
message:
  (Jelmer) Support exporting symlinks when exporting from a working
  	tree.
modified:
  bzrlib/export/dir_exporter.py  dir_exporter.py-20051114235828-b51397f56bc7b117
  bzrlib/tests/test_export.py    test_export.py-20090220201010-tpbxssdnezsvu9pk-1
=== modified file 'bzrlib/export/dir_exporter.py'
--- a/bzrlib/export/dir_exporter.py	2009-03-23 14:59:43 +0000
+++ b/bzrlib/export/dir_exporter.py	2009-07-23 16:30:49 +0000
@@ -63,11 +63,12 @@
             os.mkdir(fullpath)
         elif ie.kind == "symlink":
             try:
-                os.symlink(ie.symlink_target, fullpath)
+                symlink_target = tree.get_symlink_target(ie.file_id)
+                os.symlink(symlink_target, fullpath)
             except OSError,e:
                 raise errors.BzrError(
                     "Failed to create symlink %r -> %r, error: %s"
-                    % (fullpath, self.symlink_target, e))
+                    % (fullpath, symlink_target, e))
         else:
             raise errors.BzrError("don't know how to export {%s} of kind %r" %
                (ie.file_id, ie.kind))

=== modified file 'bzrlib/tests/test_export.py'
--- a/bzrlib/tests/test_export.py	2009-04-06 14:01:16 +0000
+++ b/bzrlib/tests/test_export.py	2009-07-23 18:36:54 +0000
@@ -19,6 +19,7 @@
 
 from bzrlib import (
     export,
+    osutils,
     tests,
     )
 
@@ -34,3 +35,10 @@
         self.failUnlessExists('target/a/b')
         self.failIfExists('target/a/c')
 
+    def test_dir_export_symlink(self):
+        self.requireFeature(tests.SymlinkFeature)
+        wt = self.make_branch_and_tree('.')
+        os.symlink('source', 'link')
+        wt.add(['link'])
+        export.export(wt, 'target', format="dir")
+        self.failUnlessExists('target/link')




More information about the bazaar-commits mailing list