[Python-checkins] cpython (3.2): Issue #14053: Fix "make patchcheck" to work with MQ.

nadeem.vawda python-checkins at python.org
Wed Feb 22 10:53:47 CET 2012


http://hg.python.org/cpython/rev/fc5de19c66e2
changeset:   75168:fc5de19c66e2
branch:      3.2
parent:      75156:e832ffd0388f
user:        Nadeem Vawda <nadeem.vawda at gmail.com>
date:        Wed Feb 22 11:46:41 2012 +0200
summary:
  Issue #14053: Fix "make patchcheck" to work with MQ.

Patch by Francisco Martín Brugué

files:
  Misc/NEWS                   |   3 +++
  Tools/scripts/patchcheck.py |  12 ++++++++++++
  2 files changed, 15 insertions(+), 0 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -483,6 +483,9 @@
 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
diff --git a/Tools/scripts/patchcheck.py b/Tools/scripts/patchcheck.py
--- a/Tools/scripts/patchcheck.py
+++ b/Tools/scripts/patchcheck.py
@@ -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'

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list