Remove "attempt to squash" behavior from git rebase-update

In common workflows, this step only succeeds ~5% of the time, and
in the other 95% of cases, simply adds ~30 seconds of wasted time
to the execution time of `rebase-update`. Therefore, this CL removes
the automated functionality, and leaves squashing as a manual option
to the user.

Fixed: 40264739
Bug: 40390274
Change-Id: Ib2a3ffe4b0e5d0b74323a2a0d34ab0e1b7fafb08
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6104282
Auto-Submit: Mason Freed <masonf@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
This commit is contained in:
Mason Freed
2024-12-20 09:48:16 -08:00
committed by LUCI CQ
parent 19548ed7a2
commit 58625e82c6
4 changed files with 25 additions and 65 deletions

View File

@@ -191,7 +191,7 @@ class GitRebaseUpdateTest(git_test_utils.GitRepoReadWriteTestBase):
self.repo.git('checkout', 'sub_K')
output, _ = self.repo.capture_stdio(self.rp.main, ['foobar'])
self.assertIn('Squashing failed', output)
self.assertIn('try squashing your branch first', output)
self.assertTrue(self.repo.run(self.gc.in_rebase))
@@ -257,7 +257,7 @@ class GitRebaseUpdateTest(git_test_utils.GitRepoReadWriteTestBase):
self.repo.git('add', 'M')
self.repo.git_commit('K NOPE')
# Add a commits to branch_L which will work when squashed
# Add a commits to branch_L which would work if squashed
self.repo.git('checkout', 'branch_L')
self.repo.git('reset', 'branch_L~')
with self.repo.open('L', 'w') as f:
@@ -282,7 +282,16 @@ class GitRebaseUpdateTest(git_test_utils.GitRepoReadWriteTestBase):
self.repo.git('rebase', '--skip')
output, _ = self.repo.capture_stdio(self.reup.main)
self.assertIn('Failed! Attempting to squash', output)
self.assertIn('try squashing your branch first', output)
# manually squash the branch
self.repo.git('rebase', '--abort')
self.repo.git('squash-branch',)
# Try the rebase again
self.repo.git('rebase', '--skip')
output, _ = self.repo.capture_stdio(self.reup.main)
self.assertIn('Deleted branch branch_G', output)
self.assertIn('Deleted branch branch_L', output)
self.assertIn('\'branch_G\' was merged', output)