Add git_execute to mergeinfo from the deleted search_related_commits script
Bug: chromium:1306416 Change-Id: Idebb83998a0d2e9e4034bc5d138d9f52a1215dc3 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3644955 Auto-Submit: Almothana Athamneh <almuthanna@chromium.org> Commit-Queue: Almothana Athamneh <almuthanna@chromium.org> Commit-Queue: Michael Achenbach <machenbach@chromium.org> Reviewed-by: Michael Achenbach <machenbach@chromium.org> Cr-Commit-Position: refs/heads/main@{#80591}
This commit is contained in:
parent
e412e6435b
commit
d98ae36734
@ -11,12 +11,28 @@ import os
|
||||
import sys
|
||||
import re
|
||||
|
||||
from search_related_commits import git_execute
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
GIT_OPTION_HASH_ONLY = '--pretty=format:%H'
|
||||
GIT_OPTION_NO_DIFF = '--quiet'
|
||||
GIT_OPTION_ONELINE = '--oneline'
|
||||
|
||||
|
||||
def git_execute(working_dir, args, verbose=False):
|
||||
command = ["git", "-C", working_dir] + args
|
||||
if verbose:
|
||||
print("Git working dir: " + working_dir)
|
||||
print("Executing git command:" + str(command))
|
||||
p = Popen(args=command, stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
||||
output, err = p.communicate()
|
||||
rc = p.returncode
|
||||
if rc != 0:
|
||||
raise Exception(err)
|
||||
if verbose:
|
||||
print("Git return value: " + output)
|
||||
return output
|
||||
|
||||
|
||||
def describe_commit(git_working_dir, hash_to_search, one_line=False):
|
||||
if one_line:
|
||||
return git_execute(git_working_dir, ['show',
|
||||
@ -109,7 +125,7 @@ def print_analysis(git_working_dir, hash_to_search):
|
||||
|
||||
if __name__ == '__main__': # pragma: no cover
|
||||
parser = argparse.ArgumentParser('Tool to check where a git commit was'
|
||||
' merged and reverted.')
|
||||
' merged and reverted.')
|
||||
|
||||
parser.add_argument('-g', '--git-dir', required=False, default='.',
|
||||
help='The path to your git working directory.')
|
||||
|
Loading…
Reference in New Issue
Block a user