Skip to content

Commit 56ec5fe

Browse files
committed
Small cleanup
1 parent ad548b8 commit 56ec5fe

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

Tools/scripts/patchcheck.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,13 @@ def call_fxn(*args, **kwargs):
3939
@status("Getting the list of files that have been added/changed",
4040
info=lambda x: n_files_str(len(x)))
4141
def changed_files():
42-
"""Get the list of changed or added files from the VCS."""
43-
if os.path.isdir(os.path.join(SRCDIR, '.hg')):
44-
cmd = 'hg status --added --modified --no-status'
45-
else:
42+
"""Get the list of changed or added files from Mercurial."""
43+
if not os.path.isdir(os.path.join(SRCDIR, '.hg')):
4644
sys.exit('need a checkout to get modified files')
4745

48-
st = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)
49-
try:
50-
st.wait()
46+
cmd = 'hg status --added --modified --no-status'
47+
with subprocess.Popen(cmd.split(), stdout=subprocess.PIPE) as st:
5148
return [x.decode().rstrip() for x in st.stdout]
52-
finally:
53-
st.stdout.close()
5449

5550

5651
def report_modified_files(file_paths):

0 commit comments

Comments
 (0)