OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
2 # Copyright 2015 the V8 project authors. All rights reserved. | |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 | |
6 import argparse | |
7 import os | |
8 import sys | |
9 | |
10 from subprocess import call | |
11 | |
12 def print_analysis(gitWorkingDir, hashToSearch): | |
13 print '1.) Info' | |
14 git_execute(gitWorkingDir, ['status']) | |
15 print '2.) Searching for "' + hashToSearch + '"' | |
16 print '=====================ORIGINAL COMMIT START=====================' | |
17 git_execute(gitWorkingDir, ['show', hashToSearch]) | |
18 print '=====================ORIGINAL COMMIT END=====================' | |
19 print '#####################FOUND MERGES & REVERTS START#####################' | |
20 git_execute(gitWorkingDir, ["log",'--all', '--grep='+hashToSearch]) | |
21 print '#####################FOUND MERGES & REVERTS END#####################' | |
22 print 'Finished successfully' | |
23 | |
24 def git_execute(workingDir, commands): | |
25 return call(["git", '-C', workingDir] + commands) | |
26 | |
27 if __name__ == "__main__": # pragma: no cover | |
28 parser = argparse.ArgumentParser('Tool to check where a git commit was merged and reverted.') | |
29 parser.add_argument("-g", "--git-dir", required=False, default='.', | |
30 help="The path to your git working directory.") | |
31 | |
32 parser.add_argument('hash',nargs=1, help="Hash of the commit to be searched.") | |
Michael Achenbach
2015/03/27 10:55:01
nit: space after comma
Michael Hablich
2015/03/27 11:36:40
Done.
| |
33 | |
34 args = sys.argv[1:] | |
35 options = parser.parse_args(args) | |
36 | |
37 sys.exit(print_analysis(options.git_dir, options.hash[0])) | |
OLD | NEW |