Index: tools/release/mergeinfo.py |
diff --git a/test/intl/testcfg.py b/tools/release/mergeinfo.py |
similarity index 55% |
copy from test/intl/testcfg.py |
copy to tools/release/mergeinfo.py |
index 9fc087e5f523fc46eda2b3c94f9951c638447d10..59074108fb3f3472794b14f398bcfc468b9bb118 100644 |
--- a/test/intl/testcfg.py |
+++ b/tools/release/mergeinfo.py |
@@ -1,3 +1,4 @@ |
+#!/usr/bin/env python |
# Copyright 2013 the V8 project authors. All rights reserved. |
Michael Achenbach
2015/03/26 19:31:00
Please use short license header, see newer files,
Michael Hablich
2015/03/27 11:36:39
Done.
|
# Redistribution and use in source and binary forms, with or without |
# modification, are permitted provided that the following conditions are |
@@ -25,47 +26,36 @@ |
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
+import argparse |
import os |
- |
-from testrunner.local import testsuite |
-from testrunner.objects import testcase |
- |
- |
-class IntlTestSuite(testsuite.TestSuite): |
- |
- def __init__(self, name, root): |
- super(IntlTestSuite, self).__init__(name, root) |
- |
- def ListTests(self, context): |
- tests = [] |
- for dirname, dirs, files in os.walk(self.root): |
- for dotted in [x for x in dirs if x.startswith('.')]: |
- dirs.remove(dotted) |
- dirs.sort() |
- files.sort() |
- for filename in files: |
- if (filename.endswith(".js") and filename != "assert.js" and |
- filename != "utils.js"): |
- testname = os.path.join(dirname[len(self.root) + 1:], filename[:-3]) |
- test = testcase.TestCase(self, testname) |
- tests.append(test) |
- return tests |
- |
- def GetFlagsForTestCase(self, testcase, context): |
- flags = ["--allow-natives-syntax"] + context.mode_flags |
- |
- files = [] |
- files.append(os.path.join(self.root, "assert.js")) |
- files.append(os.path.join(self.root, "utils.js")) |
- files.append(os.path.join(self.root, testcase.path + self.suffix())) |
- |
- flags += files |
- if context.isolates: |
- flags.append("--isolate") |
- flags += files |
- |
- return testcase.flags + flags |
- |
- |
-def GetSuite(name, root): |
- return IntlTestSuite(name, root) |
+import sys |
+ |
+from subprocess import call |
+ |
+def printAnalysis(gitWorkingDir, hashToSearch): |
Michael Achenbach
2015/03/26 19:31:00
nit: as it is a new file rather use pythonish meth
Michael Hablich
2015/03/27 11:36:40
Acknowledged.
|
+ print '0.) Info' |
+ gitExecute(gitWorkingDir, ['status']) |
Michael Achenbach
2015/03/26 19:31:00
I'd make the api of this tool more concise. Just s
Michael Hablich
2015/03/27 11:36:40
Not meant for consumption by other tools. For now
|
+ print '1.) Pulling' |
+ gitExecute(gitWorkingDir, ['pull']) |
Michael Achenbach
2015/03/26 19:31:00
I wouldn't let the script attempt to pull as pull
Michael Hablich
2015/03/27 11:36:40
Acknowledged.
|
+ print '2.) Searching' |
+ print '=====================ORIGINAL COMMIT START=====================' |
+ gitExecute(gitWorkingDir, ['show', hashToSearch]) |
+ print '=====================ORIGINAL COMMIT END=====================' |
+ print '#####################FOUND MERGES START#####################' |
+ gitExecute(gitWorkingDir, ["log",'--all', '--grep='+hashToSearch]) |
Michael Achenbach
2015/03/26 19:31:00
Add --format="%H" so that only the hashes are retu
Michael Achenbach
2015/03/27 10:59:42
Ignore my comment about log seaching in HEADS. You
Michael Hablich
2015/03/27 11:36:39
It should be human readable. I like it more verbos
|
+ print '#####################FOUND MERGES END#####################' |
+ print '3.) Done' |
+ |
+def gitExecute(workingDir, commands): |
+ return call(["git", '-C', workingDir] + commands) |
+ |
+if __name__ == "__main__": # pragma: no cover |
+ parser = argparse.ArgumentParser('Tool to check where a git commit was merged into.') |
+ parser.add_argument("-g", "--git-dir", required=True, |
Michael Achenbach
2015/03/26 19:31:00
This should be optional and just work for the curr
Michael Hablich
2015/03/27 11:36:40
Acknowledged.
|
+ help=("The path to your git working directory.")) |
+ |
+ parser.add_argument("--hash", help="Hash of the commit to be searched.", required=True) |
Michael Achenbach
2015/03/26 19:31:00
I'd make this a parameterless argument so that the
Michael Hablich
2015/03/27 11:36:39
Acknowledged.
|
+ args = sys.argv[1:] |
+ options = parser.parse_args(args) |
+ |
+ sys.exit(printAnalysis(options.git_dir, options.hash)) |