Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 4229:24c22a3f2ef8
pass repo.root to util.pathto() in preparation for the next patch
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Fri, 16 Mar 2007 00:22:57 -0300 |
parents | e817c68edfed |
children | c93562fb12cc |
comparison
equal
deleted
inserted
replaced
4228:c52b7176af94 | 4229:24c22a3f2ef8 |
---|---|
312 res += re.escape(c) | 312 res += re.escape(c) |
313 return head + res + tail | 313 return head + res + tail |
314 | 314 |
315 _globchars = {'[': 1, '{': 1, '*': 1, '?': 1} | 315 _globchars = {'[': 1, '{': 1, '*': 1, '?': 1} |
316 | 316 |
317 def pathto(n1, n2): | 317 def pathto(root, n1, n2): |
318 '''return the relative path from one place to another. | 318 '''return the relative path from one place to another. |
319 root should use os.sep to separate directories | |
319 n1 should use os.sep to separate directories | 320 n1 should use os.sep to separate directories |
320 n2 should use "/" to separate directories | 321 n2 should use "/" to separate directories |
321 returns an os.sep-separated path. | 322 returns an os.sep-separated path. |
323 | |
324 If n1 is a relative path, it's assumed it's | |
325 relative to root. | |
326 n2 should always be relative to root. | |
322 ''' | 327 ''' |
323 if not n1: return localpath(n2) | 328 if not n1: return localpath(n2) |
324 a, b = n1.split(os.sep), n2.split('/') | 329 a, b = n1.split(os.sep), n2.split('/') |
325 a.reverse() | 330 a.reverse() |
326 b.reverse() | 331 b.reverse() |