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

Misc/ACKS
Misc/NEWS
Tools/scripts/patchcheck.py

index a732965d5bf316fd282369de3baa543be19d5e7c..624b6164becfd550a27c62d01b9f63b485b37085 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -108,6 +108,7 @@ Jean Brouwers
 Gary S. Brown
 Oleg Broytmann
 Dave Brueck
+Francisco Martín Brugué
 Stan Bubrouski
 Erik de Bueger
 Dick Bulterman
index 825c3a7ccdad677c0290bf359c2a0a317d1da66b..f0b004486abc4bf9235186cda11d4f6f89aeb03d 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -531,6 +531,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 2834fefb23ea616f652f09564c44ab2d4c57d7a9..438e44eeff8a0ce65e288836ef592fccaecdbc35 100755 (executable)
@@ -36,6 +36,20 @@ 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'
+    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 @@ 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'