[PATCH 1 of 4] util: canonpath: simplify logic

Nicolas Dumazet nicdumz at gmail.com
Sat Aug 22 13:39:42 CDT 2009


# HG changeset patch
# User Nicolas Dumazet <nicdumz.commits at gmail.com>
# Date 1250948823 -7200
# Node ID f7a1dd3fa57b6be41c0c5535a16531b710571bb7
# Parent  642febca0e5df1a7cf628f30de94841b24e33ce5
util: canonpath: simplify logic

if root == os.sep, then endswithsep(root) is True as well: one test is enough

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -266,9 +266,7 @@
 
 def canonpath(root, cwd, myname):
     """return the canonical path of myname, given cwd and root"""
-    if root == os.sep:
-        rootsep = os.sep
-    elif endswithsep(root):
+    if endswithsep(root):
         rootsep = root
     else:
         rootsep = root + os.sep


More information about the Mercurial-devel mailing list