Comment 7 for bug 322807

Revision history for this message
Jason Spashett (jspashett) wrote :

In _cicp_canonical_relpath (osutils.py)

This is done:
return current[len(abs_base)+1:]

Can we not just use os.path.split instead?

>>> import os
>>> os.path.split("t:/fish")
('t:/', 'fish')
>>> os.path.split("t:/and/chips/fish")
('t:/and/chips', 'fish')
>>> os.path.split("fish")
('', 'fish')
>>>

C:\bzr\bazaar\trunk>bzr diff
=== modified file 'bzrlib/osutils.py'
--- bzrlib/osutils.py 2009-07-23 16:01:17 +0000
+++ bzrlib/osutils.py 2009-10-02 23:15:55 +0000
@@ -1093,7 +1093,7 @@
             # the target of a move, for example).
             current = pathjoin(current, bit, *list(bit_iter))
             break
- return current[len(abs_base)+1:]
+ return os.path.split(current)[1]

 # XXX - TODO - we need better detection/integration of case-insensitive
 # file-systems; Linux often sees FAT32 devices (or NFS-mounted OSX