]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #14053: Fix "make patchcheck" to work with MQ.
authorNadeem Vawda <nadeem.vawda@gmail.com>
Wed, 22 Feb 2012 09:46:41 +0000 (11:46 +0200)
committerNadeem Vawda <nadeem.vawda@gmail.com>
Wed, 22 Feb 2012 09:46:41 +0000 (11:46 +0200)
Patch by Francisco Martín Brugué

Misc/NEWS
Tools/scripts/patchcheck.py

index f8081a9300bc8e85ef095088fc74968d056736fc..ee4287bebc9f218dbaf3e457c7c7cd1486031c90 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -483,6 +483,9 @@ Build
 Tools/Demos
 -----------
 
+- Issue #14053: patchcheck.py ("make patchcheck") now works with MQ patches.
+  Patch by Francisco Martín Brugué.
+
 - Issue #13930: 2to3 is now able to write its converted output files to another
   directory tree as well as copying unchanged files and altering the file
   suffix.  See its new -o, -W and --add-suffix options.  This makes it more
index dc6b932fa2df2f8baf1782619ada74282499d2c2..0e18dd9356d413e8d22dd480bc9d6ad0dbf9db01 100755 (executable)
@@ -36,6 +36,16 @@ def status(message, modal=False, info=None):
     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 @@ def changed_files():
     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'