Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1953)

Unified Diff: Tools/Scripts/webkitpy/tool/commands/rebaseline.py

Issue 1235353002: Fix resolution of local branch name in scm and rebaseline tools. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: also check for detached HEAD in rebaseline-o-matic Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Tools/Scripts/webkitpy/tool/commands/rebaseline.py
diff --git a/Tools/Scripts/webkitpy/tool/commands/rebaseline.py b/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
index 6f1161f7fdfb3be003fd0dbc5b01c3f0d3b27118..8442aa59e468b97c1ef25dcfa61bf5da9c329bf3 100644
--- a/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
+++ b/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
@@ -842,11 +842,10 @@ class AutoRebaseline(AbstractParallelRebaselineCommand):
tool.executive.run_command(['git', 'auto-svn'])
# Save the current branch name and checkout a clean branch for the patch.
- old_branch_name = tool.executive.run_command(
- ["git", "rev-parse", "--symbolic-full-name", "HEAD"])
- if old_branch_name == "HEAD":
+ old_branch_name = self._tool.scm().current_branch()
+ if not old_branch_name:
Xianzhu 2015/07/16 22:01:19 Why don't use the same method as for rebaseline-o-
joelo 2015/07/16 23:00:11 I'm not quite sure what you mean by this. I change
Xianzhu 2015/07/16 23:21:39 I was just wondering why rebaseline-o-matic assert
# If HEAD is detached use commit SHA instead.
- old_branch_name = tool.executive.run_command(["git", "rev-parse", "HEAD"])
+ old_branch_name = tool.executive.run_command(["git", "rev-parse", "HEAD"]).strip()
Xianzhu 2015/07/16 22:01:19 Should use single quotes to keep consistency.
joelo 2015/07/16 23:00:11 Done. Sorry, this file is not consistent at all.
Xianzhu 2015/07/16 23:21:39 Never mind. I didn't notice the inconsistency.
tool.scm().delete_branch(self.AUTO_REBASELINE_BRANCH_NAME)
tool.scm().create_clean_branch(self.AUTO_REBASELINE_BRANCH_NAME)
@@ -944,6 +943,8 @@ class RebaselineOMatic(AbstractDeclarativeCommand):
log_thread.start()
try:
old_branch_name = self._tool.scm().current_branch()
+ assert old_branch_name, (
+ "Rebaseline-o-matic cannot be run from a branch with a detached HEAD.")
Xianzhu 2015/07/16 22:01:19 Ditto.
self._run_logged_command(['git', 'pull'])
rebaseline_command = [self._tool.filesystem.join(self._tool.scm().checkout_root, 'Tools', 'Scripts', 'webkit-patch'), 'auto-rebaseline']
if self._verbose:
@@ -953,7 +954,8 @@ class RebaselineOMatic(AbstractDeclarativeCommand):
self._log_queue.put(self.QUIT_LOG)
traceback.print_exc(file=sys.stderr)
# Sometimes git crashes and leaves us on a detached head.
- self._tool.scm().checkout_branch(old_branch_name)
+ if old_branch_name:
+ self._tool.scm().checkout_branch(old_branch_name)
else:
self._log_queue.put(self.QUIT_LOG)
log_thread.join()

Powered by Google App Engine
This is Rietveld 408576698