Commit d98ae367 authored by Al Muthanna Athamina's avatar Al Muthanna Athamina Committed by V8 LUCI CQ

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: 's avatarMichael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80591}
parent e412e643
...@@ -11,12 +11,28 @@ import os ...@@ -11,12 +11,28 @@ import os
import sys import sys
import re import re
from search_related_commits import git_execute from subprocess import Popen, PIPE
GIT_OPTION_HASH_ONLY = '--pretty=format:%H' GIT_OPTION_HASH_ONLY = '--pretty=format:%H'
GIT_OPTION_NO_DIFF = '--quiet' GIT_OPTION_NO_DIFF = '--quiet'
GIT_OPTION_ONELINE = '--oneline' 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): def describe_commit(git_working_dir, hash_to_search, one_line=False):
if one_line: if one_line:
return git_execute(git_working_dir, ['show', return git_execute(git_working_dir, ['show',
...@@ -109,7 +125,7 @@ def print_analysis(git_working_dir, hash_to_search): ...@@ -109,7 +125,7 @@ def print_analysis(git_working_dir, hash_to_search):
if __name__ == '__main__': # pragma: no cover if __name__ == '__main__': # pragma: no cover
parser = argparse.ArgumentParser('Tool to check where a git commit was' 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='.', parser.add_argument('-g', '--git-dir', required=False, default='.',
help='The path to your git working directory.') help='The path to your git working directory.')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment