diff -r 3297dcdad196 Tools/scripts/patchcheck.py --- a/Tools/scripts/patchcheck.py Mon Feb 20 22:06:59 2012 +0100 +++ b/Tools/scripts/patchcheck.py Tue Feb 21 00:53:04 2012 +0100 @@ -36,6 +36,24 @@ return decorated_fxn +def mq_patches_applied(): + """Check if at least one mq patch is applied + + If some error occurred (may be because the mq extension is not active) we + ignore it. + """ + some_applied = False + cmd = 'hg qapplied' + with subprocess.Popen(cmd.split(), + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) as st: + bstdout, _ = st.communicate() + if st.returncode == 0 and bstdout: + some_applied = True + + return some_applied + + @status("Getting the list of files that have been added/changed", info=lambda x: n_files_str(len(x))) def changed_files(): @@ -44,6 +62,9 @@ sys.exit('need a checkout to get modified files') cmd = 'hg status --added --modified --no-status' + if mq_patches_applied(): + cmd += ' --rev qparent' + with subprocess.Popen(cmd.split(), stdout=subprocess.PIPE) as st: return [x.decode().rstrip() for x in st.stdout]