Skip to content

Commit 9aa1e72

Browse files
remove hg support from patchcheck (GH-7440)
(cherry picked from commit b8c0845) Co-authored-by: Benjamin Peterson <[email protected]>
1 parent d6e789c commit 9aa1e72

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

Tools/scripts/patchcheck.py

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,6 @@ def call_fxn(*args, **kwargs):
4444
return decorated_fxn
4545

4646

47-
def mq_patches_applied():
48-
"""Check if there are any applied MQ patches."""
49-
cmd = 'hg qapplied'
50-
with subprocess.Popen(cmd.split(),
51-
stdout=subprocess.PIPE,
52-
stderr=subprocess.PIPE) as st:
53-
bstdout, _ = st.communicate()
54-
return st.returncode == 0 and bstdout
55-
56-
5747
def get_git_branch():
5848
"""Get the symbolic name for the current git branch"""
5949
cmd = "git rev-parse --abbrev-ref HEAD".split()
@@ -98,16 +88,8 @@ def get_base_branch():
9888
@status("Getting the list of files that have been added/changed",
9989
info=lambda x: n_files_str(len(x)))
10090
def changed_files(base_branch=None):
101-
"""Get the list of changed or added files from Mercurial or git."""
102-
if os.path.isdir(os.path.join(SRCDIR, '.hg')):
103-
if base_branch is not None:
104-
sys.exit('need a git checkout to check PR status')
105-
cmd = 'hg status --added --modified --no-status'
106-
if mq_patches_applied():
107-
cmd += ' --rev qparent'
108-
with subprocess.Popen(cmd.split(), stdout=subprocess.PIPE) as st:
109-
filenames = [x.decode().rstrip() for x in st.stdout]
110-
elif os.path.exists(os.path.join(SRCDIR, '.git')):
91+
"""Get the list of changed or added files from git."""
92+
if os.path.exists(os.path.join(SRCDIR, '.git')):
11193
# We just use an existence check here as:
11294
# directory = normal git checkout/clone
11395
# file = git worktree directory
@@ -129,7 +111,7 @@ def changed_files(base_branch=None):
129111
filename = filename.split(' -> ', 2)[1].strip()
130112
filenames.append(filename)
131113
else:
132-
sys.exit('need a Mercurial or git checkout to get modified files')
114+
sys.exit('need a git checkout to get modified files')
133115

134116
filenames2 = []
135117
for filename in filenames:

0 commit comments

Comments
 (0)