diff --git a/mercurial/osutil.py b/mercurial/osutil.py --- a/mercurial/osutil.py +++ b/mercurial/osutil.py @@ -26,7 +26,9 @@ def listdir(path, stat=False, skip=None) (name, type) ''' result = [] - prefix = path + os.sep + prefix = path + if not prefix.endswith(os.sep): + prefix += os.sep names = os.listdir(path) names.sort() for fn in names: diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -856,7 +856,7 @@ def _statfiles_clustered(files): if pos == -1: dir, base = '.', nf else: - dir, base = nf[:pos], nf[pos+1:] + dir, base = nf[:pos+1], nf[pos+1:] cache = dircache.get(dir, None) if cache is None: try: