Revert "gclient_scm: Use cherry-picking instead of rebasing."

This reverts commit c912114140.

Reason for revert: broke patch application on infra/config https://crbug.com/853032

Original change's description:
> gclient_scm: Use cherry-picking instead of rebasing.
> 
> We have a problem when in this situation, we checkout |patch| and rebase it on
> top of |base|, thus including an |extra commit| that we shouldn't.
> 
> o master
> |
> . o patch
> |/
> o extra commit
> |
> o base (what gclient synced src at)
> 
> This does merge-base between |patch| and |master|, and cherry-picks only the
> changes belonging to the patch.
> 
> Bug: 850812
> Change-Id: Id09ae1682e53b69ed49b2fb649310de6a6a8a29e
> Reviewed-on: https://chromium-review.googlesource.com/1098228
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Aaron Gable <agable@chromium.org>

TBR=agable@chromium.org,ehmaldonado@chromium.org

Change-Id: Ib3feeee2f44f5441713383f1dbf08db16fae4717
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 850812, 853032
Reviewed-on: https://chromium-review.googlesource.com/1101977
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
This commit is contained in:
Andrii Shyshkalov
2018-06-14 22:57:17 +00:00
committed by Commit Bot
parent c912114140
commit 690d8d437b
4 changed files with 23 additions and 203 deletions

View File

@@ -247,7 +247,7 @@ class FakeReposBase(object):
return False
for repo in ['repo_%d' % r for r in range(1, self.NB_GIT_REPOS + 1)]:
subprocess2.check_call(['git', 'init', '-q', join(self.git_root, repo)])
self.git_hashes[repo] = [(None, None)]
self.git_hashes[repo] = [None]
self.git_port = find_free_port(self.host, 20000)
self.git_base = 'git://%s:%d/git/' % (self.host, self.git_port)
# Start the daemon.
@@ -275,28 +275,17 @@ class FakeReposBase(object):
return subprocess2.check_output(
['git', 'rev-parse', 'HEAD'], cwd=path).strip()
def _commit_git(self, repo, tree, base=None):
def _commit_git(self, repo, tree):
repo_root = join(self.git_root, repo)
if base:
base_commit = self.git_hashes[repo][base][0]
subprocess2.check_call(
['git', 'checkout', base_commit], cwd=repo_root)
self._genTree(repo_root, tree)
commit_hash = commit_git(repo_root)
base = base or -1
if self.git_hashes[repo][base][1]:
new_tree = self.git_hashes[repo][base][1].copy()
if self.git_hashes[repo][-1]:
new_tree = self.git_hashes[repo][-1][1].copy()
new_tree.update(tree)
else:
new_tree = tree.copy()
self.git_hashes[repo].append((commit_hash, new_tree))
def _create_ref(self, repo, ref, revision):
repo_root = join(self.git_root, repo)
subprocess2.check_call(
['git', 'update-ref', ref, self.git_hashes[repo][revision][0]],
cwd=repo_root)
def _fast_import_git(self, repo, data):
repo_root = join(self.git_root, repo)
logging.debug('%s: fast-import %s', repo, data)