Rev 5326: Bring in the 'samefile' code, but expect to need to do a lot of work still. in http://bazaar.launchpad.net/~jameinel/bzr/2.2-add-symlink-183831

John Arbash Meinel john at arbash-meinel.com
Fri Jul 9 21:48:26 BST 2010


At http://bazaar.launchpad.net/~jameinel/bzr/2.2-add-symlink-183831

------------------------------------------------------------
revno: 5326 [merge]
revision-id: john at arbash-meinel.com-20100709204733-yxb4h48dpkl6s920
parent: pqm at pqm.ubuntu.com-20100628214510-y3vbugut3gjm66u6
parent: geoff.bache at jeppesen.com-20090317183608-wtldn8drbkym0r9o
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.2-add-symlink-183831
timestamp: Fri 2010-07-09 15:47:33 -0500
message:
  Bring in the 'samefile' code, but expect to need to do a lot of work still.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
  bzrlib/tests/blackbox/test_add.py test_add.py-20060518072250-857e4f86f54a30b2
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2010-06-28 21:45:10 +0000
+++ b/NEWS	2010-07-09 20:47:33 +0000
@@ -43,6 +43,9 @@
 Bug Fixes
 *********
 
+* ``bzr add`` now works if there is a symlink in the path to the
+  repository. (Geoff Bache, #183831)
+
 * ``bzr branch`` to a new repository with a default stacking policy no
   longer transfers the full history unnecessarily.
   (Andrew Bennetts, #597942)

=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py	2010-06-25 20:34:05 +0000
+++ b/bzrlib/osutils.py	2010-07-09 20:47:33 +0000
@@ -382,6 +382,9 @@
 def _mac_getcwd():
     return unicodedata.normalize('NFC', os.getcwdu())
 
+def _ident_samefile(f1, f2):
+    """If os.path.samefile doesn't exist, fake it by exact comparison."""
+    return f1 == f2
 
 # Default is to just use the python builtins, but these can be rebound on
 # particular platforms.
@@ -395,6 +398,8 @@
 basename = os.path.basename
 split = os.path.split
 splitext = os.path.splitext
+samefile = getattr(os.path, 'samefile', _ident_samefile)
+
 # These were already imported into local scope
 # mkdtemp = tempfile.mkdtemp
 # rmtree = shutil.rmtree

=== modified file 'bzrlib/tests/blackbox/test_add.py'
--- a/bzrlib/tests/blackbox/test_add.py	2010-02-23 07:43:11 +0000
+++ b/bzrlib/tests/blackbox/test_add.py	2010-07-09 20:47:33 +0000
@@ -217,3 +217,18 @@
         os.symlink(osutils.abspath('target'), 'tree/link')
         out = self.run_bzr(['add', 'tree/link'])[0]
         self.assertEquals(out, 'adding link\n')
+
+##    def test_add_with_wildcards_unicode(self):
+##        self.requireFeature(NeedsGlobExpansionFeature)
+##        self.make_branch_and_tree('.')
+##        self.build_tree([u'\u1234A', u'\u1235A', u'\u1235AA', 'cc'])
+##        self.run_bzr(['add', u'\u1234?', u'\u1235*'])
+##        self.assertEquals(self.run_bzr('unknowns')[0], 'cc\n')
+
+    def test_add_with_symlink(self):
+        self.requireFeature(tests.SymlinkFeature)
+        self.make_branch_and_tree('source')
+        self.build_tree(['source/top.txt'])
+        os.symlink('source', 'link')
+        out = self.run_bzr(['add', 'link/top.txt'])[0]
+        self.assertEquals(out, 'adding top.txt\n')



More information about the bazaar-commits mailing list