Skip to content

Commit 9bbb8e2

Browse files
authored
[2.7] remove hg support from patchcheck (GH-7440). (GH-7444)
(cherry picked from commit b8c0845)
1 parent 7b9b87e commit 9bbb8e2

File tree

1 file changed

+3
-28
lines changed

1 file changed

+3
-28
lines changed

Tools/scripts/patchcheck.py

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,6 @@ def call_fxn(*args, **kwargs):
4343
return decorated_fxn
4444

4545

46-
def mq_patches_applied():
47-
"""Check if there are any applied MQ patches."""
48-
cmd = 'hg qapplied'
49-
st = subprocess.Popen(cmd.split(),
50-
stdout=subprocess.PIPE,
51-
stderr=subprocess.PIPE)
52-
try:
53-
bstdout, _ = st.communicate()
54-
return st.returncode == 0 and bstdout
55-
finally:
56-
st.stdout.close()
57-
st.stderr.close()
58-
59-
6046
def get_git_branch():
6147
"""Get the symbolic name for the current git branch"""
6248
cmd = "git rev-parse --abbrev-ref HEAD".split()
@@ -101,19 +87,8 @@ def get_base_branch():
10187
@status("Getting the list of files that have been added/changed",
10288
info=lambda x: n_files_str(len(x)))
10389
def changed_files(base_branch=None):
104-
"""Get the list of changed or added files from Mercurial or git."""
105-
if os.path.isdir(os.path.join(SRCDIR, '.hg')):
106-
if base_branch is not None:
107-
sys.exit('need a git checkout to check PR status')
108-
cmd = 'hg status --added --modified --no-status'
109-
if mq_patches_applied():
110-
cmd += ' --rev qparent'
111-
st = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)
112-
try:
113-
filenames = [x.decode().rstrip() for x in st.stdout]
114-
finally:
115-
st.stdout.close()
116-
elif os.path.exists(os.path.join(SRCDIR, '.git')):
90+
"""Get the list of changed or added files from git."""
91+
if os.path.exists(os.path.join(SRCDIR, '.git')):
11792
# We just use an existence check here as:
11893
# directory = normal git checkout/clone
11994
# file = git worktree directory
@@ -138,7 +113,7 @@ def changed_files(base_branch=None):
138113
finally:
139114
st.stdout.close()
140115
else:
141-
sys.exit('need a Mercurial or git checkout to get modified files')
116+
sys.exit('need a git checkout to get modified files')
142117

143118
filenames2 = []
144119
for filename in filenames:

0 commit comments

Comments
 (0)