[PATCH 6 of 6 v2] paths: allow util.finddirs touse os.path.sep
Kostia Balytskyi
ikostia at fb.com
Tue Sep 19 12:57:50 EDT 2017
# HG changeset patch
# User Kostia Balytskyi <ikostia at fb.com>
# Date 1505837708 25200
# Tue Sep 19 09:15:08 2017 -0700
# Node ID 0a561e2299b6880dd0e6e91294c92bbc0aef726b
# Parent 29007a29700f107b7fd5bf139fa192f9528d6349
paths: allow util.finddirs touse os.path.sep
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -3130,11 +3130,12 @@ class dirs(object):
if safehasattr(parsers, 'dirs'):
dirs = parsers.dirs
-def finddirs(path):
- pos = path.rfind('/')
+def finddirs(path, useossep=False):
+ sep = os.path.sep if useossep else '/'
+ pos = path.rfind(sep)
while pos != -1:
yield path[:pos]
- pos = path.rfind('/', 0, pos)
+ pos = path.rfind(sep, 0, pos)
# compression code
More information about the Mercurial-devel
mailing list