mercurial/util.py
changeset 3651 48768b1ab23c
parent 3632 4cfb72bcb978
child 3673 eb0b4a2d70a9
equal deleted inserted replaced
3650:6f6696962986 3651:48768b1ab23c
   205 
   205 
   206 _globchars = {'[': 1, '{': 1, '*': 1, '?': 1}
   206 _globchars = {'[': 1, '{': 1, '*': 1, '?': 1}
   207 
   207 
   208 def pathto(n1, n2):
   208 def pathto(n1, n2):
   209     '''return the relative path from one place to another.
   209     '''return the relative path from one place to another.
   210     this returns a path in the form used by the local filesystem, not hg.'''
   210     n1 should use os.sep to separate directories
       
   211     n2 should use "/" to separate directories
       
   212     returns an os.sep-separated path.
       
   213     '''
   211     if not n1: return localpath(n2)
   214     if not n1: return localpath(n2)
   212     a, b = n1.split('/'), n2.split('/')
   215     a, b = n1.split(os.sep), n2.split('/')
   213     a.reverse()
   216     a.reverse()
   214     b.reverse()
   217     b.reverse()
   215     while a and b and a[-1] == b[-1]:
   218     while a and b and a[-1] == b[-1]:
   216         a.pop()
   219         a.pop()
   217         b.pop()
   220         b.pop()