Rev 4558: Fix a trivial bug that should have been caught earlier. :) in http://bazaar.launchpad.net/~jameinel/bzr/1.18-relpath-394227

John Arbash Meinel john at arbash-meinel.com
Thu Jul 23 17:01:28 BST 2009


At http://bazaar.launchpad.net/~jameinel/bzr/1.18-relpath-394227

------------------------------------------------------------
revno: 4558
revision-id: john at arbash-meinel.com-20090723160117-k7wgyommqlgz6jzb
parent: john at arbash-meinel.com-20090723155822-0p7yliadtdyd6tb3
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 1.18-relpath-394227
timestamp: Thu 2009-07-23 11:01:17 -0500
message:
  Fix a trivial bug that should have been caught earlier. :)
  
  I forgot to reverse the subdir list.
-------------- next part --------------
=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py	2009-07-22 16:41:48 +0000
+++ b/bzrlib/osutils.py	2009-07-23 16:01:17 +0000
@@ -1050,7 +1050,7 @@
             s.append(tail)
 
     if s:
-        return pathjoin(*s)
+        return pathjoin(*reversed(s))
     else:
         return ''
 

=== modified file 'bzrlib/tests/test_osutils.py'
--- a/bzrlib/tests/test_osutils.py	2009-07-22 16:41:48 +0000
+++ b/bzrlib/tests/test_osutils.py	2009-07-23 16:01:17 +0000
@@ -632,6 +632,11 @@
         subdir = cwd + '/subdir'
         self.assertEqual('subdir', osutils.relpath(cwd, subdir))
 
+    def test_deep_relpath(self):
+        cwd = osutils.getcwd()
+        subdir = cwd + '/sub/subsubdir'
+        self.assertEqual('sub/subsubdir', osutils.relpath(cwd, subdir))
+
     def test_not_relative(self):
         self.assertRaises(errors.PathNotChild,
                           osutils.relpath, 'C:/path', 'H:/path')



More information about the bazaar-commits mailing list