Commit 8990189a authored by sammc@chromium.org's avatar sammc@chromium.org

Support merging with conflicts with git-drover.

Currently, git-drover gives up and cleans up if the cherry-pick fails.
This change allows the user to manually resolve conflicts when using
git-drover.

BUG=404755

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@297429 0039d316-1c4b-4281-b951-d872f2087c98
parent ccbb746d
This diff is collapsed.
......@@ -755,7 +755,9 @@ git-drover(1) Manual Page
<h2 id="_synopsis">SYNOPSIS</h2>
<div class="sectionbody">
<div class="verseblock">
<pre class="content"><em>git drover</em> --branch &lt;branch&gt; --cherry-pick &lt;commit&gt;
<pre class="content"><em>git drover</em> --branch &lt;branch&gt;
(--cherry-pick &lt;change&gt; | --continue [path_to_workdir] |
--abort [path_to_workdir])
[--parent_checkout &lt;path-to-existing-checkout&gt;]
[--verbose] [--dry-run]</pre>
<div class="attribution">
......@@ -767,8 +769,7 @@ git-drover(1) Manual Page
<div class="sectionbody">
<div class="paragraph"><p><code>git drover</code> applies a commit to a release branch. It creates a new workdir from
an existing checkout to avoid downloading a new checkout without affecting the
existing checkout. Creating a workdir requires symlinks so this does not work on
Windows. See the EXAMPLE section for the equivalent sequence of commands to run.</p></div>
existing checkout.</p></div>
<div class="paragraph"><p><code>git drover</code> does not support reverts. See the EXAMPLE section for the
equivalent sequence of commands to run.</p></div>
</div>
......@@ -794,6 +795,25 @@ equivalent sequence of commands to run.</p></div>
</p>
</dd>
<dt class="hdlist1">
--continue [path_to_workdir]
</dt>
<dd>
<p>
Continue a cherry-pick that required manual resolution. The path to the drover
workdir is optional. If unspecified, the current directory is used.
</p>
</dd>
<dt class="hdlist1">
--abort [path_to_workdir]
</dt>
<dd>
<p>
Abort a cherry-pick that required manual resolution and clean up its workdir.
The path to the drover workdir is optional. If unspecified, the current
directory is used.
</p>
</dd>
<dt class="hdlist1">
--parent_checkout
</dt>
<dd>
......@@ -838,7 +858,37 @@ at least once to fetch the branches.</p></div>
<h4 id="_merge_example">Merge Example</h4>
<div class="paragraph"><p></p></div><div class="listingblock"><div class="content"><pre><code># Here's a commit (from some.committer) that we want to 'drover'.
<span style="font-weight: bold; color: #ffffff">$ git log -n 1 --pretty=fuller</span>
<span style="color: #e7e71c">commit 8b79b7b2f7e6e728f9a3c7b385c72efc7c47244a</span>
<span style="color: #e7e71c">commit f7448045de01b54914db8b902ca77fbbf42b3146</span>
Author: some.committer &lt;some.committer@chromium.org&gt;
AuthorDate: Thu Apr 10 08:54:46 2014 +0000
Commit: some.committer &lt;some.committer@chromium.org&gt;
CommitDate: Thu Apr 10 08:54:46 2014 +0000
This change needs to go to branch 9999
# Now do the 'drover'.
<span style="font-weight: bold; color: #ffffff">$ git drover --branch 9999 --cherry-pick f7448045de01b54914db8b902ca77fbbf42b3146</span>
Going to cherry-pick
"""
<span style="color: #e7e71c">commit f7448045de01b54914db8b902ca77fbbf42b3146</span>
Author: some.committer &lt;some.committer@chromium.org&gt;
Date: Thu Apr 10 08:54:46 2014 +0000
This change needs to go to branch 9999
"""
to 9999. Continue (y/n)? y
# A cl is uploaded to rietveld, where it can be reviewed before landing.
About to land on 9999. Continue (y/n)? y
# The cherry-pick cl is landed on the branch 9999.
</code></pre></div></div><p><div class="paragraph"></p></div>
</div>
<div class="sect3">
<h4 id="_merge_with_conflicts_example">Merge with Conflicts Example</h4>
<div class="paragraph"><p></p></div><div class="listingblock"><div class="content"><pre><code># Here's a commit (from some.committer) that we want to 'drover'.
<span style="font-weight: bold; color: #ffffff">$ git log -n 1 --pretty=fuller</span>
<span style="color: #e7e71c">commit ca8e437616d853cb10008a252b54cfed928f157c</span>
Author: some.committer &lt;some.committer@chromium.org&gt;
AuthorDate: Thu Apr 10 08:54:46 2014 +0000
Commit: some.committer &lt;some.committer@chromium.org&gt;
......@@ -847,10 +897,10 @@ CommitDate: Thu Apr 10 08:54:46 2014 +0000
This change needs to go to branch 9999
# Now do the 'drover'.
<span style="font-weight: bold; color: #ffffff">$ git drover --branch 9999 --cherry-pick 8b79b7b2f7e6e728f9a3c7b385c72efc7c47244a</span>
<span style="font-weight: bold; color: #ffffff">$ git drover --branch 9999 --cherry-pick ca8e437616d853cb10008a252b54cfed928f157c</span>
Going to cherry-pick
"""
<span style="color: #e7e71c">commit 8b79b7b2f7e6e728f9a3c7b385c72efc7c47244a</span>
<span style="color: #e7e71c">commit ca8e437616d853cb10008a252b54cfed928f157c</span>
Author: some.committer &lt;some.committer@chromium.org&gt;
Date: Thu Apr 10 08:54:46 2014 +0000
......@@ -858,6 +908,23 @@ Date: Thu Apr 10 08:54:46 2014 +0000
"""
to 9999. Continue (y/n)? y
Error: Patch failed to apply.
A workdir for this cherry-pick has been created in
/tmp/drover_9999
To continue, resolve the conflicts there and run
git drover --continue /tmp/drover_9999
To abort this cherry-pick run
git drover --abort /tmp/drover_9999
<span style="font-weight: bold; color: #ffffff">$ pushd /tmp/drover_9999</span>
# Manually resolve conflicts.
<span style="font-weight: bold; color: #ffffff">$ git add path/to/file_with_conflicts</span>
<span style="font-weight: bold; color: #ffffff">$ popd</span>
<span style="font-weight: bold; color: #ffffff">$ git drover --continue /tmp/drover_9999</span>
# A cl is uploaded to rietveld, where it can be reviewed before landing.
About to land on 9999. Continue (y/n)? y
......@@ -875,24 +942,24 @@ Branch drover_9999 set up to track remote ref refs/branch-heads/9999.
# Here's the commit we want to revert.
<span style="font-weight: bold; color: #ffffff">$ git log -n 1</span>
<span style="color: #e7e71c">commit 33b0e9164d4564eb8a4b4e5b951bba6edeeecacb</span>
<span style="color: #e7e71c">commit 98d544a18e19bb80be9d4a8094efda8ab1d2534b</span>
Author: some.committer &lt;some.committer@chromium.org&gt;
Date: Thu Apr 10 08:54:46 2014 +0000
This change is horribly broken.
# Now do the revert.
<span style="font-weight: bold; color: #ffffff">$ git revert 33b0e9164d4564eb8a4b4e5b951bba6edeeecacb</span>
<span style="font-weight: bold; color: #ffffff">$ git revert 98d544a18e19bb80be9d4a8094efda8ab1d2534b</span>
# That reverted the change and committed the revert.
<span style="font-weight: bold; color: #ffffff">$ git log -n 1</span>
<span style="color: #e7e71c">commit 8a2d2bb98b9cfc9260a9bc86da1eec2a43f43f8b</span>
<span style="color: #e7e71c">commit 0fc5e9101886dcb1aebbb9434d0df9341f0dedfe</span>
Author: you &lt;you@chromium.org&gt;
Date: Thu Apr 10 09:11:36 2014 +0000
Revert "This change is horribly broken."
This reverts commit 33b0e9164d4564eb8a4b4e5b951bba6edeeecacb.
This reverts commit 98d544a18e19bb80be9d4a8094efda8ab1d2534b.
# As with old drover, reverts are generally OK to commit without LGTM.
<span style="font-weight: bold; color: #ffffff">$ git cl upload -r some.committer@chromium.org --send-mail</span>
......@@ -906,7 +973,7 @@ Date: Thu Apr 10 09:11:36 2014 +0000
# Here's a commit (from some.committer) that we want to 'drover'.
<span style="font-weight: bold; color: #ffffff">$ git log -n 1 --pretty=fuller</span>
<span style="color: #e7e71c">commit 537f446fa3d5e41acab017bb0b082fbd0c9eb043</span>
<span style="color: #e7e71c">commit b27fff7b167964750303f60222e79f3932f438e0</span>
Author: some.committer &lt;some.committer@chromium.org&gt;
AuthorDate: Thu Apr 10 08:54:46 2014 +0000
Commit: some.committer &lt;some.committer@chromium.org&gt;
......@@ -920,8 +987,8 @@ Branch drover_9999 set up to track remote ref refs/branch-heads/9999.
# Now do the 'drover'.
# IMPORTANT!!! Do Not leave off the '-x' flag
<span style="font-weight: bold; color: #ffffff">$ git cherry-pick -x 537f446fa3d5e41acab017bb0b082fbd0c9eb043</span>
[drover_9999 b468abc] This change needs to go to branch 9999
<span style="font-weight: bold; color: #ffffff">$ git cherry-pick -x b27fff7b167964750303f60222e79f3932f438e0</span>
[drover_9999 bd8dc1c] This change needs to go to branch 9999
Author: some.committer &lt;some.committer@chromium.org&gt;
Date: Thu Apr 10 08:54:46 2014 +0000
1 file changed, 1 insertion(+)
......@@ -930,7 +997,7 @@ Branch drover_9999 set up to track remote ref refs/branch-heads/9999.
# That took the code authored by some.committer and committed it to
# the branch by the person who drovered it (i.e. you).
<span style="font-weight: bold; color: #ffffff">$ git log -n 1 --pretty=fuller</span>
<span style="color: #e7e71c">commit b468abc42ddd4fd9aecc48c3eda172265306d2b4</span>
<span style="color: #e7e71c">commit bd8dc1c0678913e36b2b06855810803a2e0ab906</span>
Author: some.committer &lt;some.committer@chromium.org&gt;
AuthorDate: Thu Apr 10 08:54:46 2014 +0000
Commit: you &lt;you@chromium.org&gt;
......@@ -938,7 +1005,7 @@ CommitDate: Thu Apr 10 09:11:36 2014 +0000
This change needs to go to branch 9999
(cherry picked from commit 537f446fa3d5e41acab017bb0b082fbd0c9eb043)
(cherry picked from commit b27fff7b167964750303f60222e79f3932f438e0)
# Looks good. Ship it!
<span style="font-weight: bold; color: #ffffff">$ git cl upload</span>
......@@ -968,7 +1035,7 @@ from <a href="https://chromium.googlesource.com/chromium/tools/depot_tools.git">
<div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
Last updated 2015-09-23 11:11:58 AEST
Last updated 2015-10-20 18:00:26 AEDT
</div>
</div>
</body>
......
......@@ -2,12 +2,12 @@
.\" Title: git-drover
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 09/23/2015
.\" Date: 10/20/2015
.\" Manual: Chromium depot_tools Manual
.\" Source: depot_tools 4549a59
.\" Source: depot_tools 704d890
.\" Language: English
.\"
.TH "GIT\-DROVER" "1" "09/23/2015" "depot_tools 4549a59" "Chromium depot_tools Manual"
.TH "GIT\-DROVER" "1" "10/20/2015" "depot_tools 704d890" "Chromium depot_tools Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
......@@ -32,14 +32,16 @@ git-drover \- Apply a commit from the trunk to a release branch, or from one rel
.SH "SYNOPSIS"
.sp
.nf
\fIgit drover\fR \-\-branch <branch> \-\-cherry\-pick <commit>
\fIgit drover\fR \-\-branch <branch>
(\-\-cherry\-pick <change> | \-\-continue [path_to_workdir] |
\-\-abort [path_to_workdir])
[\-\-parent_checkout <path\-to\-existing\-checkout>]
[\-\-verbose] [\-\-dry\-run]
.fi
.sp
.SH "DESCRIPTION"
.sp
git drover applies a commit to a release branch\&. It creates a new workdir from an existing checkout to avoid downloading a new checkout without affecting the existing checkout\&. Creating a workdir requires symlinks so this does not work on Windows\&. See the EXAMPLE section for the equivalent sequence of commands to run\&.
git drover applies a commit to a release branch\&. It creates a new workdir from an existing checkout to avoid downloading a new checkout without affecting the existing checkout\&.
.sp
git drover does not support reverts\&. See the EXAMPLE section for the equivalent sequence of commands to run\&.
.SH "OPTIONS"
......@@ -54,6 +56,16 @@ The branch to cherry\-pick the commit to\&.
The commit to cherry\-pick\&.
.RE
.PP
\-\-continue [path_to_workdir]
.RS 4
Continue a cherry\-pick that required manual resolution\&. The path to the drover workdir is optional\&. If unspecified, the current directory is used\&.
.RE
.PP
\-\-abort [path_to_workdir]
.RS 4
Abort a cherry\-pick that required manual resolution and clean up its workdir\&. The path to the drover workdir is optional\&. If unspecified, the current directory is used\&.
.RE
.PP
\-\-parent_checkout
.RS 4
The path to the chromium checkout to use as the source for a creating git\-new\-workdir workdir to use for cherry\-picking\&. If unspecified, the current directory is used\&.
......@@ -89,7 +101,54 @@ Before working with branches, you must \fIgclient sync \-\-with_branch_heads\fR
.nf
# Here\*(Aqs a commit (from some\&.committer) that we want to \*(Aqdrover\*(Aq\&.
\fB$ git log \-n 1 \-\-pretty=fuller\fR
commit b5a049e34297f22a4ea63567b32e3290bb3f244c
commit 9b111fcda69cb6bf8a38d1e77867c298d80ca9d1
Author: some\&.committer <some\&.committer@chromium\&.org>
AuthorDate: Thu Apr 10 08:54:46 2014 +0000
Commit: some\&.committer <some\&.committer@chromium\&.org>
CommitDate: Thu Apr 10 08:54:46 2014 +0000
This change needs to go to branch 9999
# Now do the \*(Aqdrover\*(Aq\&.
\fB$ git drover \-\-branch 9999 \-\-cherry\-pick 9b111fcda69cb6bf8a38d1e77867c298d80ca9d1\fR
Going to cherry\-pick
"""
commit 9b111fcda69cb6bf8a38d1e77867c298d80ca9d1
Author: some\&.committer <some\&.committer@chromium\&.org>
Date: Thu Apr 10 08:54:46 2014 +0000
This change needs to go to branch 9999
"""
to 9999\&. Continue (y/n)? y
# A cl is uploaded to rietveld, where it can be reviewed before landing\&.
About to land on 9999\&. Continue (y/n)? y
# The cherry\-pick cl is landed on the branch 9999\&.
.fi
.if n \{\
.RE
.\}
.sp
.RE
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBMerge with Conflicts Example\fR
.RS 4
.sp
.sp
.if n \{\
.RS 4
.\}
.nf
# Here\*(Aqs a commit (from some\&.committer) that we want to \*(Aqdrover\*(Aq\&.
\fB$ git log \-n 1 \-\-pretty=fuller\fR
commit 89ce5bb7bdf7149754b94e4d9fc5413435e6680d
Author: some\&.committer <some\&.committer@chromium\&.org>
AuthorDate: Thu Apr 10 08:54:46 2014 +0000
Commit: some\&.committer <some\&.committer@chromium\&.org>
......@@ -98,10 +157,10 @@ CommitDate: Thu Apr 10 08:54:46 2014 +0000
This change needs to go to branch 9999
# Now do the \*(Aqdrover\*(Aq\&.
\fB$ git drover \-\-branch 9999 \-\-cherry\-pick b5a049e34297f22a4ea63567b32e3290bb3f244c\fR
\fB$ git drover \-\-branch 9999 \-\-cherry\-pick 89ce5bb7bdf7149754b94e4d9fc5413435e6680d\fR
Going to cherry\-pick
"""
commit b5a049e34297f22a4ea63567b32e3290bb3f244c
commit 89ce5bb7bdf7149754b94e4d9fc5413435e6680d
Author: some\&.committer <some\&.committer@chromium\&.org>
Date: Thu Apr 10 08:54:46 2014 +0000
......@@ -109,6 +168,23 @@ Date: Thu Apr 10 08:54:46 2014 +0000
"""
to 9999\&. Continue (y/n)? y
Error: Patch failed to apply\&.
A workdir for this cherry\-pick has been created in
/tmp/drover_9999
To continue, resolve the conflicts there and run
git drover \-\-continue /tmp/drover_9999
To abort this cherry\-pick run
git drover \-\-abort /tmp/drover_9999
\fB$ pushd /tmp/drover_9999\fR
# Manually resolve conflicts\&.
\fB$ git add path/to/file_with_conflicts\fR
\fB$ popd\fR
\fB$ git drover \-\-continue /tmp/drover_9999\fR
# A cl is uploaded to rietveld, where it can be reviewed before landing\&.
About to land on 9999\&. Continue (y/n)? y
......@@ -143,24 +219,24 @@ Branch drover_9999 set up to track remote ref refs/branch\-heads/9999\&.
# Here\*(Aqs the commit we want to revert\&.
\fB$ git log \-n 1\fR
commit 215689406a8ca5813412becc6258509be903db59
commit d5efb50dcc76ea29ad30d1015fb291a9ba5fc0db
Author: some\&.committer <some\&.committer@chromium\&.org>
Date: Thu Apr 10 08:54:46 2014 +0000
This change is horribly broken\&.
# Now do the revert\&.
\fB$ git revert 215689406a8ca5813412becc6258509be903db59\fR
\fB$ git revert d5efb50dcc76ea29ad30d1015fb291a9ba5fc0db\fR
# That reverted the change and committed the revert\&.
\fB$ git log \-n 1\fR
commit 1efaf0e8b1c6c6afadfb37e15023b52b960ac2fd
commit 1b6ccf84e2c13c6f6a2b69b29626aed8fa0ae24d
Author: you <you@chromium\&.org>
Date: Thu Apr 10 09:11:36 2014 +0000
Revert "This change is horribly broken\&."
This reverts commit 215689406a8ca5813412becc6258509be903db59\&.
This reverts commit d5efb50dcc76ea29ad30d1015fb291a9ba5fc0db\&.
# As with old drover, reverts are generally OK to commit without LGTM\&.
\fB$ git cl upload \-r some\&.committer@chromium\&.org \-\-send\-mail\fR
......@@ -191,7 +267,7 @@ Date: Thu Apr 10 09:11:36 2014 +0000
# Here\*(Aqs a commit (from some\&.committer) that we want to \*(Aqdrover\*(Aq\&.
\fB$ git log \-n 1 \-\-pretty=fuller\fR
commit 640f962733bfd2b9c44539a0d65952643750957e
commit 2655f8d9d48f18dbfed237c67b8c65134050b2e3
Author: some\&.committer <some\&.committer@chromium\&.org>
AuthorDate: Thu Apr 10 08:54:46 2014 +0000
Commit: some\&.committer <some\&.committer@chromium\&.org>
......@@ -205,8 +281,8 @@ Branch drover_9999 set up to track remote ref refs/branch\-heads/9999\&.
# Now do the \*(Aqdrover\*(Aq\&.
# IMPORTANT!!! Do Not leave off the \*(Aq\-x\*(Aq flag
\fB$ git cherry\-pick \-x 640f962733bfd2b9c44539a0d65952643750957e\fR
[drover_9999 5f1ae97] This change needs to go to branch 9999
\fB$ git cherry\-pick \-x 2655f8d9d48f18dbfed237c67b8c65134050b2e3\fR
[drover_9999 589e8ad] This change needs to go to branch 9999
Author: some\&.committer <some\&.committer@chromium\&.org>
Date: Thu Apr 10 08:54:46 2014 +0000
1 file changed, 1 insertion(+)
......@@ -215,7 +291,7 @@ Branch drover_9999 set up to track remote ref refs/branch\-heads/9999\&.
# That took the code authored by some\&.committer and committed it to
# the branch by the person who drovered it (i\&.e\&. you)\&.
\fB$ git log \-n 1 \-\-pretty=fuller\fR
commit 5f1ae978a8d05c16d8ed812163b7aa927f028bf9
commit 589e8adbb095944100d029724b4038094120f23b
Author: some\&.committer <some\&.committer@chromium\&.org>
AuthorDate: Thu Apr 10 08:54:46 2014 +0000
Commit: you <you@chromium\&.org>
......@@ -223,7 +299,7 @@ CommitDate: Thu Apr 10 09:11:36 2014 +0000
This change needs to go to branch 9999
(cherry picked from commit 640f962733bfd2b9c44539a0d65952643750957e)
(cherry picked from commit 2655f8d9d48f18dbfed237c67b8c65134050b2e3)
# Looks good\&. Ship it!
\fB$ git cl upload\fR
......
#!/usr/bin/env bash
. git-drover.demo.common.sh
drover_c "This change needs to go to branch 9999"
echo "# Here's a commit (from some.committer) that we want to 'drover'."
run git log -n 1 --pretty=fuller
echo
echo "# Now do the 'drover'."
pcommand git drover --branch 9999 \
--cherry-pick $(git show-ref -s pick_commit)
echo "Going to cherry-pick"
echo '"""'
output git log -n 1
echo '"""'
echo "to 9999. Continue (y/n)? y"
echo
echo "Error: Patch failed to apply."
echo
echo "A workdir for this cherry-pick has been created in"
echo " /tmp/drover_9999"
echo
echo "To continue, resolve the conflicts there and run"
echo " git drover --continue /tmp/drover_9999"
echo
echo "To abort this cherry-pick run"
echo " git drover --abort /tmp/drover_9999"
echo
pcommand pushd /tmp/drover_9999
echo "# Manually resolve conflicts."
pcommand git add path/to/file_with_conflicts
pcommand popd
pcommand git drover --continue /tmp/drover_9999
echo
echo "# A cl is uploaded to rietveld, where it can be reviewed before landing."
echo
echo "About to land on 9999. Continue (y/n)? y"
echo "# The cherry-pick cl is landed on the branch 9999."
......@@ -9,7 +9,9 @@ include::_git-drover_desc.helper.txt[]
SYNOPSIS
--------
[verse]
'git drover' --branch <branch> --cherry-pick <commit>
'git drover' --branch <branch>
(--cherry-pick <change> | --continue [path_to_workdir] |
--abort [path_to_workdir])
[--parent_checkout <path-to-existing-checkout>]
[--verbose] [--dry-run]
......@@ -18,8 +20,7 @@ DESCRIPTION
`git drover` applies a commit to a release branch. It creates a new workdir from
an existing checkout to avoid downloading a new checkout without affecting the
existing checkout. Creating a workdir requires symlinks so this does not work on
Windows. See the EXAMPLE section for the equivalent sequence of commands to run.
existing checkout.
`git drover` does not support reverts. See the EXAMPLE section for the
equivalent sequence of commands to run.
......@@ -32,6 +33,15 @@ OPTIONS
--cherry-pick <commit>::
The commit to cherry-pick.
--continue [path_to_workdir]::
Continue a cherry-pick that required manual resolution. The path to the drover
workdir is optional. If unspecified, the current directory is used.
--abort [path_to_workdir]::
Abort a cherry-pick that required manual resolution and clean up its workdir.
The path to the drover workdir is optional. If unspecified, the current
directory is used.
--parent_checkout::
The path to the chromium checkout to use as the source for a creating
git-new-workdir workdir to use for cherry-picking. If unspecified, the current
......@@ -63,6 +73,10 @@ Merge Example
^^^^^^^^^^^^^
demo:1[]
Merge with Conflicts Example
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
demo:4[]
Revert Example
^^^^^^^^^^^^^^
demo:2[]
......
This diff is collapsed.
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