comparison mercurial/util.py @ 885:6594ba2a0f51

Merge latest round of walk fixes.
author Bryan O'Sullivan <bos@serpentine.com>
date Fri, 12 Aug 2005 11:18:41 -0800
parents 781266a78fe1 087771ebe2e6
children 882756761433
comparison
equal deleted inserted replaced
878:781266a78fe1 885:6594ba2a0f51
66 else: 66 else:
67 res += re.escape(c) 67 res += re.escape(c)
68 return head + res + tail 68 return head + res + tail
69 69
70 _globchars = {'[': 1, '{': 1, '*': 1, '?': 1} 70 _globchars = {'[': 1, '{': 1, '*': 1, '?': 1}
71
72 def pathto(n1, n2):
73 '''return the relative path from one place to another'''
74 if not n1: return n2
75 a, b = n1.split(os.sep), n2.split(os.sep)
76 a.reverse(), b.reverse()
77 while a and b and a[-1] == b[-1]:
78 a.pop(), b.pop()
79 b.reverse()
80 return os.sep.join((['..'] * len(a)) + b)
71 81
72 def canonpath(repo, cwd, myname): 82 def canonpath(repo, cwd, myname):
73 rootsep = repo.root + os.sep 83 rootsep = repo.root + os.sep
74 name = myname 84 name = myname
75 if not name.startswith(os.sep): 85 if not name.startswith(os.sep):