Reviewers: Michael Achenbach,
Message:
On 2015/04/21 14:14:24, Michael Achenbach wrote:
detectReverts.py -> detect_reverts.py
Please be more pedantic about style as long as there is no automation for
it,
e.g. spaces, indentation and var names. I commented on a few.
https://codereview.chromium.org/1098123002/diff/1/tools/release/detectReverts.py
File tools/release/detectReverts.py (right):
https://codereview.chromium.org/1098123002/diff/1/tools/release/detectReverts.py#newcode12
tools/release/detectReverts.py:12: def print_analysis(gitWorkingDir,
hashToSearch, upperBound):
nit: python var names
https://codereview.chromium.org/1098123002/diff/1/tools/release/detectReverts.py#newcode14
tools/release/detectReverts.py:14: raw_output = git_execute(gitWorkingDir,
["rev-list", hashToSearch + ".." + upperBound])
Suggestiong: you could use log on origin/master with --grep="[Rr]evert
XXX"
and
--format=%H
XXX stands for the way numbers or hashes would be regexped in grep - don't
recall that right now.
Then you have everything in one git call.
https://codereview.chromium.org/1098123002/diff/1/tools/release/detectReverts.py#newcode18
tools/release/detectReverts.py:18: candidate_hashes =
raw_output.split("\n")
splitlines()
https://codereview.chromium.org/1098123002/diff/1/tools/release/detectReverts.py#newcode28
tools/release/detectReverts.py:28:
nit: two empty lines between things on toplevel
https://codereview.chromium.org/1098123002/diff/1/tools/release/detectReverts.py#newcode29
tools/release/detectReverts.py:29: def git_execute(workingDir, commands):
working_dir
https://codereview.chromium.org/1098123002/diff/1/tools/release/detectReverts.py#newcode39
tools/release/detectReverts.py:39: parser = argparse.ArgumentParser('Tool
to
check where a git commit was merged and reverted.')
Is a tool for one commit useful? Why not a whole range of commits? E.g. B
is
branch point. Tell me if there's anything interesting about commits in
A..B
within the range B..C (where C might be HEAD) and where A might be the a
commit
a week ago.
https://codereview.chromium.org/1098123002/diff/1/tools/release/detectReverts.py#newcode41
tools/release/detectReverts.py:41: help="The path to your git working
directory.")
nit: indentation
This was not meant for review yet as it is not finished. As told via chat
this
is intended to share the idea with you :-).
Description:
Initial implementation for finding merge candidates after branch cut
BUG=
Please review this at https://codereview.chromium.org/1098123002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+49, -0 lines):
A tools/release/detectReverts.py
Index: tools/release/detectReverts.py
diff --git a/tools/release/detectReverts.py b/tools/release/detectReverts.py
new file mode 100755
index
0000000000000000000000000000000000000000..f29be50600e642057571a5af0d05ab09cb940d3d
--- /dev/null
+++ b/tools/release/detectReverts.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+# Copyright 2015 the V8 project authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import argparse
+import os
+import sys
+
+from subprocess import call, Popen, PIPE
+
+def print_analysis(gitWorkingDir, hashToSearch, upperBound):
+
+ raw_output = git_execute(gitWorkingDir, ["rev-list", hashToSearch + ".."
+ upperBound])
+
+ print 'test'
+ raw_output = raw_output.strip()
+ candidate_hashes = raw_output.split("\n")
+ print "Found " + str(len(candidate_hashes)) + " candidates"
+ for candidate in candidate_hashes:
+ #git show -s --format=%B SHA1
+ current_message = git_execute(gitWorkingDir,
["show","-s", "--format=%B",candidate])
+ if ("Revert" in current_message) or ("revert" in current_message):
+ if hashToSearch in current_message:
+ print "Found revert in " + candidate
+
+ print "Finished"
+
+def git_execute(workingDir, commands):
+ p = Popen(['git', '-C', workingDir] + commands, stdin=PIPE, stdout=PIPE,
stderr=PIPE)
+ output, err = p.communicate()
+ rc = p.returncode
+ if rc != 0:
+ raise Exception(err)
+
+ return output
+
+if __name__ == "__main__": # pragma: no cover
+ parser = argparse.ArgumentParser('Tool to check where a git commit was
merged and reverted.')
+ parser.add_argument("-g", "--git-dir", required=False, default='.',
+ help="The path to your git working directory.")
+
+ parser.add_argument('originalCommit', nargs=1, help="Hash of the commit
to be searched.")
+ parser.add_argument('upperBound', nargs=1, help="branch when searching
should stop.")
+
+ args = sys.argv[1:]
+ options = parser.parse_args(args)
+
+ sys.exit(print_analysis(options.git_dir, options.originalCommit[0],
options.upperBound[0]))
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.