diff Tools/scripts/patchcheck.py @ 75167:179bc7557484 2.7

Issue #14053: Fix "make patchcheck" to work with MQ. Patch by Francisco Martín Brugué
author Nadeem Vawda <nadeem.vawda@gmail.com>
date Wed, 22 Feb 2012 11:40:09 +0200
parents 11662a6e34df
children 1cfe0f50fd0c
line wrap: on
line diff
--- a/Tools/scripts/patchcheck.py	Wed Feb 22 00:28:46 2012 +0100
+++ b/Tools/scripts/patchcheck.py	Wed Feb 22 11:40:09 2012 +0200
@@ -36,6 +36,20 @@
     return decorated_fxn
 
 
+def mq_patches_applied():
+    """Check if there are any applied MQ patches."""
+    cmd = 'hg qapplied'
+    st = subprocess.Popen(cmd.split(),
+                          stdout=subprocess.PIPE,
+                          stderr=subprocess.PIPE)
+    try:
+        bstdout, _ = st.communicate()
+        return st.returncode == 0 and bstdout
+    finally:
+        st.stdout.close()
+        st.stderr.close()
+
+
 @status("Getting the list of files that have been added/changed",
         info=lambda x: n_files_str(len(x)))
 def changed_files():
@@ -43,6 +57,8 @@
     if os.path.isdir(os.path.join(SRCDIR, '.hg')):
         vcs = 'hg'
         cmd = 'hg status --added --modified --no-status'
+        if mq_patches_applied():
+            cmd += ' --rev qparent'
     elif os.path.isdir('.svn'):
         vcs = 'svn'
         cmd = 'svn status --quiet --non-interactive --ignore-externals'