Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 9386:eae98607b349
util: canonpath: simplify logic
if root == os.sep, then endswithsep(root) is True as well: one test is enough
author | Nicolas Dumazet <nicdumz.commits@gmail.com> |
---|---|
date | Sat, 22 Aug 2009 15:47:03 +0200 |
parents | 570416319ed3 |
children | 5b117c90f036 |
comparison
equal
deleted
inserted
replaced
9385:570416319ed3 | 9386:eae98607b349 |
---|---|
264 b.reverse() | 264 b.reverse() |
265 return os.sep.join((['..'] * len(a)) + b) or '.' | 265 return os.sep.join((['..'] * len(a)) + b) or '.' |
266 | 266 |
267 def canonpath(root, cwd, myname): | 267 def canonpath(root, cwd, myname): |
268 """return the canonical path of myname, given cwd and root""" | 268 """return the canonical path of myname, given cwd and root""" |
269 if root == os.sep: | 269 if endswithsep(root): |
270 rootsep = os.sep | |
271 elif endswithsep(root): | |
272 rootsep = root | 270 rootsep = root |
273 else: | 271 else: |
274 rootsep = root + os.sep | 272 rootsep = root + os.sep |
275 name = myname | 273 name = myname |
276 if not os.path.isabs(name): | 274 if not os.path.isabs(name): |