Skip to content

remove hg support from patchcheck #7440

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 3 additions & 21 deletions Tools/scripts/patchcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,6 @@ def call_fxn(*args, **kwargs):
return decorated_fxn


def mq_patches_applied():
"""Check if there are any applied MQ patches."""
cmd = 'hg qapplied'
with subprocess.Popen(cmd.split(),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE) as st:
bstdout, _ = st.communicate()
return st.returncode == 0 and bstdout


def get_git_branch():
"""Get the symbolic name for the current git branch"""
cmd = "git rev-parse --abbrev-ref HEAD".split()
Expand Down Expand Up @@ -98,16 +88,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'
with subprocess.Popen(cmd.split(), stdout=subprocess.PIPE) as st:
filenames = [x.decode().rstrip() for x in st.stdout]
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
Expand All @@ -129,7 +111,7 @@ def changed_files(base_branch=None):
filename = filename.split(' -> ', 2)[1].strip()
filenames.append(filename)
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:
Expand Down