[PATCH] extensions: don't fail to load on Windows if path ends with a '\' (issue4187)

Ed Morley emorley at mozilla.com
Tue Mar 4 17:17:01 CST 2014


# HG changeset patch
# User Ed Morley <emorley at mozilla.com>
# Date 1393974750 0
#      Tue Mar 04 23:12:30 2014 +0000
# Node ID 74e8f96578fdad93d682f676441d1b04f1c34901
# Parent  5beb49fd5958cd46cb933a8bccf482b56eb55b18
extensions: don't fail to load on Windows if path ends with a '\' (issue4187)

Same fix as 5c794e7331e7 but now works on Windows too.

diff -r 5beb49fd5958 -r 74e8f96578fd mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -46,7 +46,7 @@ def loadpath(path, module_name):
     path = util.expandpath(path)
     if os.path.isdir(path):
         # module/__init__.py style
-        d, f = os.path.split(path.rstrip('/'))
+        d, f = os.path.split(path.rstrip(os.sep))
         fd, fpath, desc = imp.find_module(f, [d])
         return imp.load_module(module_name, fd, fpath, desc)
     else:


More information about the Mercurial-devel mailing list