diff -r 2cceb4d3079a Tools/scripts/patchcheck.py --- a/Tools/scripts/patchcheck.py Tue Feb 21 17:26:10 2012 +0100 +++ b/Tools/scripts/patchcheck.py Tue Feb 21 22:03:47 2012 +0100 @@ -36,6 +36,20 @@ 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. + """ + cmd = 'hg qapplied' + with subprocess.Popen(cmd.split(), + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) as st: + bstdout, _ = st.communicate() + return st.returncode == 0 and bstdout + + @status("Getting the list of files that have been added/changed", info=lambda x: n_files_str(len(x))) def changed_files(): @@ -44,6 +58,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]