Mercurial > hg
comparison mercurial/util.py @ 6111:213ea6eed412
util.pathto: return '.' instead of an empty string
This could happen with something like
pathto(repo.root, 'foo/bar', 'foo/bar')
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Fri, 15 Feb 2008 10:38:37 -0200 |
parents | 41aa0a37d9be |
children | 1ee95f7df611 7b937b26adf7 |
comparison
equal
deleted
inserted
replaced
6110:81e20e01d465 | 6111:213ea6eed412 |
---|---|
333 b.reverse() | 333 b.reverse() |
334 while a and b and a[-1] == b[-1]: | 334 while a and b and a[-1] == b[-1]: |
335 a.pop() | 335 a.pop() |
336 b.pop() | 336 b.pop() |
337 b.reverse() | 337 b.reverse() |
338 return os.sep.join((['..'] * len(a)) + b) | 338 return os.sep.join((['..'] * len(a)) + b) or '.' |
339 | 339 |
340 def canonpath(root, cwd, myname): | 340 def canonpath(root, cwd, myname): |
341 """return the canonical path of myname, given cwd and root""" | 341 """return the canonical path of myname, given cwd and root""" |
342 if root == os.sep: | 342 if root == os.sep: |
343 rootsep = os.sep | 343 rootsep = os.sep |