Skip to content

Commit 6721149

Browse files
committed
Merge: python#14053: Fix "make patchcheck" to work with MQ.
Patch by Francisco Martín Brugué
2 parents e7ad419 + 9f64f73 commit 6721149

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1990,6 +1990,9 @@ IDLE
19901990
Tools/Demos
19911991
-----------
19921992

1993+
- Issue #14053: patchcheck.py ("make patchcheck") now works with MQ patches.
1994+
Patch by Francisco Martín Brugué.
1995+
19931996
- Issue #13930: 2to3 is now able to write its converted output files to another
19941997
directory tree as well as copying unchanged files and altering the file
19951998
suffix. See its new -o, -W and --add-suffix options. This makes it more

Tools/scripts/patchcheck.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ def call_fxn(*args, **kwargs):
3636
return decorated_fxn
3737

3838

39+
def mq_patches_applied():
40+
"""Check if there are any applied MQ patches."""
41+
cmd = 'hg qapplied'
42+
with subprocess.Popen(cmd.split(),
43+
stdout=subprocess.PIPE,
44+
stderr=subprocess.PIPE) as st:
45+
bstdout, _ = st.communicate()
46+
return st.returncode == 0 and bstdout
47+
48+
3949
@status("Getting the list of files that have been added/changed",
4050
info=lambda x: n_files_str(len(x)))
4151
def changed_files():
@@ -44,6 +54,8 @@ def changed_files():
4454
sys.exit('need a checkout to get modified files')
4555

4656
cmd = 'hg status --added --modified --no-status'
57+
if mq_patches_applied():
58+
cmd += ' --rev qparent'
4759
with subprocess.Popen(cmd.split(), stdout=subprocess.PIPE) as st:
4860
return [x.decode().rstrip() for x in st.stdout]
4961

0 commit comments

Comments
 (0)