From: Benjamin Peterson Date: Wed, 6 Jun 2018 05:55:10 +0000 (-0700) Subject: [2.7] remove hg support from patchcheck (GH-7440). (GH-7444) X-Git-Tag: v2.7.16rc1~264 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9bbb8e21ca93eae77461888ff1fe69a738345e0a;p=thirdparty%2FPython%2Fcpython.git [2.7] remove hg support from patchcheck (GH-7440). (GH-7444) (cherry picked from commit b8c0845fee9277b1106ceecbf7592f8806c73ec8) --- diff --git a/Tools/scripts/patchcheck.py b/Tools/scripts/patchcheck.py index 093ef313143e..58aa168d6d06 100755 --- a/Tools/scripts/patchcheck.py +++ b/Tools/scripts/patchcheck.py @@ -43,20 +43,6 @@ 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() - - def get_git_branch(): """Get the symbolic name for the current git branch""" cmd = "git rev-parse --abbrev-ref HEAD".split() @@ -101,19 +87,8 @@ def get_base_branch(): @status("Getting the list of files that have been added/changed", info=lambda x: n_files_str(len(x))) def changed_files(base_branch=None): - """Get the list of changed or added files from Mercurial or git.""" - if os.path.isdir(os.path.join(SRCDIR, '.hg')): - if base_branch is not None: - sys.exit('need a git checkout to check PR status') - cmd = 'hg status --added --modified --no-status' - if mq_patches_applied(): - cmd += ' --rev qparent' - st = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE) - try: - filenames = [x.decode().rstrip() for x in st.stdout] - finally: - st.stdout.close() - elif os.path.exists(os.path.join(SRCDIR, '.git')): + """Get the list of changed or added files from git.""" + if os.path.exists(os.path.join(SRCDIR, '.git')): # We just use an existence check here as: # directory = normal git checkout/clone # file = git worktree directory @@ -138,7 +113,7 @@ def changed_files(base_branch=None): finally: st.stdout.close() else: - sys.exit('need a Mercurial or git checkout to get modified files') + sys.exit('need a git checkout to get modified files') filenames2 = [] for filename in filenames: