diff Tools/scripts/patchcheck.py @ 75168:fc5de19c66e2 3.2

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:46:41 +0200
parents f1859c9d1086
children 0ed68fb13b3a 1bdca2bcba6d
line wrap: on
line diff
--- a/Tools/scripts/patchcheck.py	Tue Feb 21 22:36:37 2012 +0100
+++ b/Tools/scripts/patchcheck.py	Wed Feb 22 11:46:41 2012 +0200
@@ -36,6 +36,16 @@
     return decorated_fxn
 
 
+def mq_patches_applied():
+    """Check if there are any applied MQ patches."""
+    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():
@@ -43,6 +53,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'