Skip to content

Commit 5343f14

Browse files
committed
Fix hg file finder in presence of white space in paths
1 parent b549c0c commit 5343f14

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

setuptools_scm/file_finder_hg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def _hg_ls_files_and_dirs(toplevel):
2525
out = subprocess.check_output([
2626
'hg', 'files',
2727
], cwd=toplevel, universal_newlines=True)
28-
for name in out.split():
28+
for name in out.splitlines():
2929
name = os.path.normcase(name).replace('/', os.path.sep)
3030
fullname = os.path.join(toplevel, name)
3131
hg_files.add(fullname)

testing/test_file_finder.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ def test_basic(inwd):
5151
})
5252

5353

54+
def test_whitespace(inwd):
55+
(inwd.cwd / 'adir' / 'space file').ensure(file=True)
56+
inwd.add_and_commit()
57+
assert set(find_files('adir')) == _sep({
58+
'adir/space file',
59+
'adir/filea',
60+
})
61+
62+
5463
def test_case(inwd):
5564
(inwd.cwd / 'CamelFile').ensure(file=True)
5665
(inwd.cwd / 'file2').ensure(file=True)

0 commit comments

Comments
 (0)