Title: [136583] trunk/Tools
Revision
136583
Author
[email protected]
Date
2012-12-04 15:01:32 -0800 (Tue, 04 Dec 2012)

Log Message

commit-queue can get stuck with a local commit
https://bugs.webkit.org/show_bug.cgi?id=104032

Reviewed by Dirk Pranke.

Previously the commit-queue would only clean down to HEAD. If the
commit-queue gets interrupted in the middle of a commit (e.g., after
the local commit but before the dcommit), then it can end up with a
patch locally committed. That patch will then prevent the commit-queue
from functioning.

This patch teaches the commit-queue to clean down to the merge base,
which will remove any local commits.

* Scripts/webkitpy/common/checkout/scm/git.py:
(Git.working_directory_is_clean):
(Git.clean_working_directory):
* Scripts/webkitpy/tool/commands/roll_unittest.py:
* Scripts/webkitpy/tool/steps/commit.py:
(Commit._commit_warning):
(Commit.run):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (136582 => 136583)


--- trunk/Tools/ChangeLog	2012-12-04 22:55:56 UTC (rev 136582)
+++ trunk/Tools/ChangeLog	2012-12-04 23:01:32 UTC (rev 136583)
@@ -1,3 +1,27 @@
+2012-12-04  Adam Barth  <[email protected]>
+
+        commit-queue can get stuck with a local commit
+        https://bugs.webkit.org/show_bug.cgi?id=104032
+
+        Reviewed by Dirk Pranke.
+
+        Previously the commit-queue would only clean down to HEAD. If the
+        commit-queue gets interrupted in the middle of a commit (e.g., after
+        the local commit but before the dcommit), then it can end up with a
+        patch locally committed. That patch will then prevent the commit-queue
+        from functioning.
+
+        This patch teaches the commit-queue to clean down to the merge base,
+        which will remove any local commits.
+
+        * Scripts/webkitpy/common/checkout/scm/git.py:
+        (Git.working_directory_is_clean):
+        (Git.clean_working_directory):
+        * Scripts/webkitpy/tool/commands/roll_unittest.py:
+        * Scripts/webkitpy/tool/steps/commit.py:
+        (Commit._commit_warning):
+        (Commit.run):
+
 2012-12-04  Dirk Pranke  <[email protected]>
 
         nrwt: store only the total number of tests in the result summary

Modified: trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py (136582 => 136583)


--- trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py	2012-12-04 22:55:56 UTC (rev 136582)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py	2012-12-04 23:01:32 UTC (rev 136583)
@@ -147,11 +147,11 @@
         return self._filesystem.exists(self.absolute_path(self._filesystem.join('.git', 'rebase-apply')))
 
     def working_directory_is_clean(self):
-        return self._run_git(['diff', 'HEAD', '--no-renames', '--name-only']) == ""
+        return self._run_git(['diff', self.remote_merge_base(), '--no-renames', '--name-only']) == ""
 
     def clean_working_directory(self):
         # Could run git clean here too, but that wouldn't match working_directory_is_clean
-        self._run_git(['reset', '--hard', 'HEAD'])
+        self._run_git(['reset', '--hard', self.remote_merge_base()])
         # Aborting rebase even though this does not match working_directory_is_clean
         if self.rebase_in_progress():
             self._run_git(['rebase', '--abort'])

Modified: trunk/Tools/Scripts/webkitpy/tool/commands/roll_unittest.py (136582 => 136583)


--- trunk/Tools/Scripts/webkitpy/tool/commands/roll_unittest.py	2012-12-04 22:55:56 UTC (rev 136582)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/roll_unittest.py	2012-12-04 23:01:32 UTC (rev 136583)
@@ -40,7 +40,8 @@
 Was that diff correct?
 Committed r49824: <http://trac.webkit.org/changeset/49824>
 """
-        self.assert_execute_outputs(RollChromiumDEPS(), [6764], expected_logs=expected_logs)
+        options = MockOptions(non_interactive=False)
+        self.assert_execute_outputs(RollChromiumDEPS(), [6764], options=options, expected_logs=expected_logs)
 
     def test_update_chromium_deps_older_revision(self):
         options = MockOptions(non_interactive=False)

Modified: trunk/Tools/Scripts/webkitpy/tool/steps/commit.py (136582 => 136583)


--- trunk/Tools/Scripts/webkitpy/tool/steps/commit.py	2012-12-04 22:55:56 UTC (rev 136582)
+++ trunk/Tools/Scripts/webkitpy/tool/steps/commit.py	2012-12-04 23:01:32 UTC (rev 136583)
@@ -47,10 +47,10 @@
         ]
 
     def _commit_warning(self, error):
-        working_directory_message = "" if error.working_directory_is_clean else " and working copy changes"
-        return ('There are %s local commits%s. Everything will be committed as a single commit. '
+        return ('There are %s local commits (and possibly changes in the working directory. '
+                'Everything will be committed as a single commit. '
                 'To avoid this prompt, set "git config webkit-patch.commit-should-always-squash true".' % (
-                error.num_local_commits, working_directory_message))
+                error.num_local_commits))
 
     def _check_test_expectations(self, changed_files):
         test_expectations_files = [filename for filename in changed_files if filename.endswith('TestExpectations')]
@@ -73,12 +73,11 @@
             raise Exception("Attempted to commit with a commit message shorter than 10 characters.  Either your patch is missing a ChangeLog or webkit-patch may have a bug.")
 
         self._check_test_expectations(self._changed_files(state))
-
         self._state = state
 
         username = None
         password = None
-        force_squash = False
+        force_squash = self._options.non_interactive
 
         num_tries = 0
         while num_tries < 3:
@@ -92,7 +91,7 @@
                 self._state["commit_text"] = commit_text
                 break;
             except AmbiguousCommitError, e:
-                if self._options.non_interactive or self._tool.user.confirm(self._commit_warning(e)):
+                if self._tool.user.confirm(self._commit_warning(e)):
                     force_squash = True
                 else:
                     # This will correctly interrupt the rest of the commit process.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to