# HG changeset patch # Parent 46553ada6e358b0b23d02f7726b1a3d1ebcc04df diff --git a/Tools/scripts/patchcheck.py b/Tools/scripts/patchcheck.py --- a/Tools/scripts/patchcheck.py +++ b/Tools/scripts/patchcheck.py @@ -28,15 +28,29 @@ def status(message, modal=False, info=No @status("Getting the list of files that have been added/changed", info=lambda x: "%s files" % len(x)) def changed_files(): - """Run ``svn status`` and return a set of files that have been - changed/added.""" - cmd = 'svn status --quiet --non-interactive --ignore-externals' - svn_st = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) - svn_st.wait() - output = [line.strip() for line in svn_st.stdout.readlines()] + """Get the list of files that have been changed/added.""" + if os.path.isdir('.hg'): + hg = True + elif os.path.isdir('.svn'): + hg = False + else: + sys.exit("can't get the list of modified files without " + "a svn or hg checkout") + + if hg: + cmd = 'hg status --added --modified --no-status' + else: + cmd = 'svn status --quiet --non-interactive --ignore-externals' + status = subprocess.Popen(cmd.split(' '), stdout=subprocess.PIPE) + status.wait() + output = (line.strip() for line in status.stdout) + + if hg: + return set(output) + files = set() for line in output: - if not line[0] in ('A', 'M'): + if not line.startswith(('A', 'M')): continue line_parts = line.split() path = line_parts[-1]