Use three-way merge when applying Git patches.

After switching to a pure git workflow, most of the patchset we upload
to rietveld have git metadata. Apparently, however, the scripts here in
depot tools, which are used by the CQ and trybots, are ignoring that
and applying patches without taking advantage of git metadata.
In practice this causes people to rebase and reupload patches more than
necessary, even in the cases when it could be handled automatically by
means of a three way merge.
This change updates the GitCheckout class of depot_tools to use that.

BUG=416003

Review URL: https://codereview.chromium.org/577203002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@292087 0039d316-1c4b-4281-b951-d872f2087c98
changes/01/332501/1
primiano@chromium.org 11 years ago
parent 4cd0a8b9d6
commit 49dfcde0f1

@ -676,7 +676,7 @@ class GitCheckout(CheckoutBase):
else:
# No need to do anything special with p.is_new or if not
# p.diff_hunks. git apply manages all that already.
cmd = ['apply', '--index', '-p%s' % p.patchlevel]
cmd = ['apply', '--index', '-3', '-p%s' % p.patchlevel]
if verbose:
cmd.append('--verbose')
stdout.append(self._check_output_git(cmd, stdin=p.get(True)))

@ -457,8 +457,8 @@ class GitCheckout(GitBaseTest):
def testException(self):
self._check_exception(
self._get_co(None),
'While running git apply --index -p1;\n fatal: corrupt patch at line '
'12\n')
'While running git apply --index -3 -p1;\n fatal: corrupt patch at '
'line 12\n')
def testProcess(self):
self._test_process(self._get_co)

Loading…
Cancel
Save