Commit a3d1aaf1 authored by Josip Sokcevic's avatar Josip Sokcevic Committed by LUCI CQ

Revert "[depot_tools] Add --fork-point when computing merge-base"

This reverts commit 934ac6eb.

Reason for revert: https://crbug.com/1225658, git reparent-branch
may result in data loss (recoverable if gc doesn't remove it).

Original change's description:
> [depot_tools] Add --fork-point when computing merge-base
>
> Using --fork-point when possible reduces the number of merge conflicts when running merge-base.
>
> Bug: 1111269
> Change-Id: I7240fdc9a613d2eb4e856b5677fc713551d7afe9
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2519729
> Reviewed-by: Josip Sokcevic <sokcevic@google.com>
> Commit-Queue: Gavin Mak <gavinmak@google.com>

R=gavinmak@google.com

Bug: 1111269
Bug: 1225658
Change-Id: I2aeadeb2fbff18abcab5552e07254dfc1c2499a7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3034831
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: 's avatarGavin Mak <gavinmak@google.com>
parent f6f3c7a4
......@@ -530,11 +530,7 @@ def get_or_create_merge_base(branch, parent=None):
parent = parent or upstream(branch)
if parent is None or branch is None:
return None
try:
actual_merge_base = run('merge-base', '--fork-point', parent, branch)
except subprocess2.CalledProcessError:
actual_merge_base = run('merge-base', parent, branch)
actual_merge_base = run('merge-base', parent, branch)
if base_upstream != parent:
base = None
......
......@@ -693,36 +693,6 @@ class GitMutableStructuredTest(git_test_utils.GitRepoReadWriteTestBase,
self.assertIsNone(
self.repo.run(self.gc.get_or_create_merge_base, 'branch_DOG'))
def testMergeBaseWithForkPoint(self):
self.repo.git('commit', '--allow-empty', '-am', 'foooooo')
self.repo.git('checkout','-tb', 'foobarA', 'main')
foobarA = self.repo.run(self.gc.hash_one, 'foobarA', short=True)
self.repo.git('checkout','-tb', 'foobarB', 'foobarA')
with self.repo.open('cl1', 'w') as f:
f.write('cl1')
self.repo.git('add', 'cl1')
self.repo.git_commit('cl1')
foobarB_old = self.repo.run(self.gc.hash_one, 'foobarB', short=True)
self.repo.git('checkout','-tb', 'foobarC', 'foobarB')
with self.repo.open('cl2', 'w') as f:
f.write('cl2')
self.repo.git('add', 'cl2')
self.repo.git_commit('cl2')
foobarC = self.repo.run(self.gc.hash_one, 'foobarC', short=True)
self.repo.git('checkout', 'foobarB')
with self.repo.open('cl1', 'w') as f:
f.write('amend cl1')
self.repo.git('add', 'cl1')
self.repo.git('commit', '--amend', '-m', 'amend cl1')
self.assertIn(foobarA,
self.repo.run(self.gc.get_or_create_merge_base, 'foobarB', foobarB_old))
self.assertIn(foobarB_old,
self.repo.run(self.gc.get_or_create_merge_base, foobarC, 'foobarB'))
def testGetBranchTree(self):
skipped, tree = self.repo.run(self.gc.get_branch_tree)
# This check fails with git 2.4 (see crbug.com/487172)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment