Commit 44267858 authored by mmoss@chromium.org's avatar mmoss@chromium.org

Add 'revert' example to git-drover docs.

TBR=iannucci@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@291840 0039d316-1c4b-4281-b951-d872f2087c98
parent 5f32a966
......@@ -770,12 +770,19 @@ sequence of commands to run.</p></div>
<div class="sect1">
<h2 id="_example">EXAMPLE</h2>
<div class="sectionbody">
<div class="paragraph"><p> Before working with branches, you must 'gclient sync --with_branch_heads' at least once to fetch the branches.</p></div><div class="listingblock"><div class="content"><pre><code># Make sure we have the most up-to-date branch sources.
<div class="sect2">
<h3 id="_prerequisites">PREREQUISITES</h3>
<div class="paragraph"><p>Before working with branches, you must
<code>gclient sync --with_branch_heads</code>
at least once to fetch the branches.</p></div>
<div class="sect3">
<h4 id="_merge_example">Merge Example</h4>
<div class="paragraph"><p></p></div><div class="listingblock"><div class="content"><pre><code># Make sure we have the most up-to-date branch sources.
<span style="font-weight: bold; color: #ffffff">$ git fetch</span>
# Here's the commit we want to 'drover'.
<span style="font-weight: bold; color: #ffffff">$ git log -n 1 --pretty=fuller</span>
commit 19b478428049b956b2dc389893c9ed7c05d1b175
commit 1077c7acbc1f1881d5181f6b1eaf4d0c6cd92543
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;
......@@ -789,8 +796,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 19b478428049b956b2dc389893c9ed7c05d1b175</span>
[drover_9999 88e74e0] This change needs to go to branch 9999
<span style="font-weight: bold; color: #ffffff">$ git cherry-pick -x 1077c7acbc1f1881d5181f6b1eaf4d0c6cd92543</span>
[drover_9999 1d9c1a1] 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(+)
......@@ -799,7 +806,7 @@ Branch drover_9999 set up to track remote ref refs/branch-heads/9999.
# That took the code authored by some.commiter and commited it to the
# branch by branch.maintainer (us).
<span style="font-weight: bold; color: #ffffff">$ git log -n 1 --pretty=fuller</span>
commit 88e74e0f2540eba7bc7bd4d6adb4b0d7923c9488
commit 1d9c1a1b768f2248c884495f4d47739c2ff249f7
Author: some.committer &lt;some.committer@chromium.org&gt;
AuthorDate: Thu Apr 10 08:54:46 2014 +0000
Commit: branch.maintainer &lt;branch.maintainer@chromium.org&gt;
......@@ -807,20 +814,58 @@ CommitDate: Thu Apr 10 09:11:36 2014 +0000
This change needs to go to branch 9999
(cherry picked from commit 19b478428049b956b2dc389893c9ed7c05d1b175)
(cherry picked from commit 1077c7acbc1f1881d5181f6b1eaf4d0c6cd92543)
# Looks good. Ship it!
<span style="font-weight: bold; color: #ffffff">$ git cl upload</span>
# Get LGTM or TBR.
# Wait for LGTM or TBR it.
<span style="font-weight: bold; color: #ffffff">$ git cl land</span>
# Or skip the LGTM/TBR and just 'git cl land --bypass-hooks'
</code></pre></div></div><p><div class="paragraph"></p></div>
</div>
<div class="sect3">
<h4 id="_revert_example">Revert Example</h4>
<div class="paragraph"><p></p></div><div class="listingblock"><div class="content"><pre><code># Make sure we have the most up-to-date branch sources.
<span style="font-weight: bold; color: #ffffff">$ git fetch</span>
# Checkout the branch with the change we want to revert.
<span style="font-weight: bold; color: #ffffff">$ git checkout -b drover_9999 branch-heads/9999</span>
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>
commit aca17ebfc070673e98afb6d36f6028eae6b0b8ca
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 aca17ebfc070673e98afb6d36f6028eae6b0b8ca</span>
# That reverted the change and committed the revert.
<span style="font-weight: bold; color: #ffffff">$ git log -n 1</span>
commit d27f8f3fd56621c5e3a92cb5e64100e2bc2137a2
Author: branch.maintainer &lt;branch.maintainer@chromium.org&gt;
Date: Thu Apr 10 09:11:36 2014 +0000
Revert "This change is horribly broken."
This reverts commit aca17ebfc070673e98afb6d36f6028eae6b0b8ca.
# 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>
<span style="font-weight: bold; color: #ffffff">$ git cl land --bypass-hooks</span>
</code></pre></div></div><p><div class="paragraph"></p></div>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_see_also">SEE ALSO</h2>
<div class="sectionbody">
<div class="paragraph"><p><a href="git-cherry-pick.html">git-cherry-pick(1)</a></p></div>
<div class="paragraph"><p><a href="git-cherry-pick.html">git-cherry-pick(1)</a>
<a href="git-revert.html">git-revert(1)</a></p></div>
</div>
</div>
<div class="sect1">
......@@ -835,7 +880,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 2014-08-25 16:45:38 PDT
Last updated 2014-09-05 16:32:10 PDT
</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.76.1 <http://docbook.sf.net/>
.\" Date: 08/25/2014
.\" Date: 09/05/2014
.\" Manual: Chromium depot_tools Manual
.\" Source: depot_tools f0a4926
.\" Source: depot_tools 2171f9c
.\" Language: English
.\"
.TH "GIT\-DROVER" "1" "08/25/2014" "depot_tools f0a4926" "Chromium depot_tools Manual"
.TH "GIT\-DROVER" "1" "09/05/2014" "depot_tools 2171f9c" "Chromium depot_tools Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
......@@ -39,8 +39,19 @@ git-drover \- Apply a commit from the trunk to a release branch, or from one rel
.sp
git drover is NOT IMPLEMENTED yet\&. See the EXAMPLE section for the equivalent sequence of commands to run\&.
.SH "EXAMPLE"
.SS "PREREQUISITES"
.sp
Before working with branches, you must \*(Aqgclient sync \-\-with_branch_heads\*(Aq at least once to fetch the branches\&.
Before working with branches, you must \fIgclient sync \-\-with_branch_heads\fR at least once to fetch the branches\&.
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBMerge Example\fR
.RS 4
.sp
.sp
.if n \{\
.RS 4
......@@ -51,7 +62,7 @@ Before working with branches, you must \*(Aqgclient sync \-\-with_branch_heads\*
# Here\*(Aqs the commit we want to \*(Aqdrover\*(Aq\&.
\fB$ git log \-n 1 \-\-pretty=fuller\fR
commit fd935aae549962611c2f178dc9026f23ae2ad9bd
commit 14293306d7969cff815969e2502f47794a63fbc5
Author: some\&.committer <some\&.committer@chromium\&.org>
AuthorDate: Thu Apr 10 08:54:46 2014 +0000
Commit: some\&.committer <some\&.committer@chromium\&.org>
......@@ -65,8 +76,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 fd935aae549962611c2f178dc9026f23ae2ad9bd\fR
[drover_9999 0f36796] This change needs to go to branch 9999
\fB$ git cherry\-pick \-x 14293306d7969cff815969e2502f47794a63fbc5\fR
[drover_9999 3200a8c] 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(+)
......@@ -75,7 +86,7 @@ Branch drover_9999 set up to track remote ref refs/branch\-heads/9999\&.
# That took the code authored by some\&.commiter and commited it to the
# branch by branch\&.maintainer (us)\&.
\fB$ git log \-n 1 \-\-pretty=fuller\fR
commit 0f3679662379e7032957abcc7d63e96cec444ec7
commit 3200a8cb2072a7c84aaba52baaecbf5e4d17ad00
Author: some\&.committer <some\&.committer@chromium\&.org>
AuthorDate: Thu Apr 10 08:54:46 2014 +0000
Commit: branch\&.maintainer <branch\&.maintainer@chromium\&.org>
......@@ -83,11 +94,11 @@ CommitDate: Thu Apr 10 09:11:36 2014 +0000
This change needs to go to branch 9999
(cherry picked from commit fd935aae549962611c2f178dc9026f23ae2ad9bd)
(cherry picked from commit 14293306d7969cff815969e2502f47794a63fbc5)
# Looks good\&. Ship it!
\fB$ git cl upload\fR
# Get LGTM or TBR\&.
# Wait for LGTM or TBR it\&.
\fB$ git cl land\fR
# Or skip the LGTM/TBR and just \*(Aqgit cl land \-\-bypass\-hooks\*(Aq
.fi
......@@ -95,9 +106,62 @@ CommitDate: Thu Apr 10 09:11:36 2014 +0000
.RE
.\}
.sp
.RE
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBRevert Example\fR
.RS 4
.sp
.sp
.if n \{\
.RS 4
.\}
.nf
# Make sure we have the most up\-to\-date branch sources\&.
\fB$ git fetch\fR
# Checkout the branch with the change we want to revert\&.
\fB$ git checkout \-b drover_9999 branch\-heads/9999\fR
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 4803efead17077ecd40440caef2e78d1c66098cf
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 4803efead17077ecd40440caef2e78d1c66098cf\fR
# That reverted the change and committed the revert\&.
\fB$ git log \-n 1\fR
commit 52350f2809ce71352326f1518feae57ac5152f18
Author: branch\&.maintainer <branch\&.maintainer@chromium\&.org>
Date: Thu Apr 10 09:11:36 2014 +0000
Revert "This change is horribly broken\&."
This reverts commit 4803efead17077ecd40440caef2e78d1c66098cf\&.
# As with old drover, reverts are generally OK to commit without LGTM\&.
\fB$ git cl upload \-r some\&.committer@chromium\&.org \-\-send\-mail\fR
\fB$ git cl land \-\-bypass\-hooks\fR
.fi
.if n \{\
.RE
.\}
.sp
.RE
.SH "SEE ALSO"
.sp
\fBgit-cherry-pick\fR(1)
\fBgit-cherry-pick\fR(1) \fBgit-revert\fR(1)
.SH "CHROMIUM DEPOT_TOOLS"
.sp
Part of the chromium \fBdepot_tools\fR(7) suite\&. These tools are meant to assist with the development of chromium and related projects\&. Download the tools from \m[blue]\fBhere\fR\m[]\&\s-2\u[1]\d\s+2\&.
......
#!/usr/bin/env bash
. demo_repo.sh
. git-drover.demo.common.sh
silent git push origin refs/remotes/origin/master:refs/branch-heads/9999
silent git config --add remote.origin.fetch \
+refs/branch-heads/*:refs/remotes/branch-heads/*
silent git fetch origin
silent git checkout -b master origin/master
add modified_file
set_user some.committer
c "This change needs to go to branch 9999"
silent git tag pick_commit
comment Before working with branches, you must \'gclient sync \
--with_branch_heads\' at least once to fetch the branches.
set_user branch.maintainer
tick 1000
drover_c "This change needs to go to branch 9999"
echo "# Make sure we have the most up-to-date branch sources."
run git fetch
......@@ -37,6 +22,6 @@ run git log -n 1 --pretty=fuller
echo
echo "# Looks good. Ship it!"
pcommand git cl upload
echo "# Get LGTM or TBR."
echo "# Wait for LGTM or TBR it."
run git cl land
echo "# Or skip the LGTM/TBR and just 'git cl land --bypass-hooks'"
#!/usr/bin/env bash
. git-drover.demo.common.sh
echo "# Make sure we have the most up-to-date branch sources."
run git fetch
echo
echo "# Checkout the branch with the change we want to revert."
run git checkout -b drover_9999 branch-heads/9999
echo
drover_c "This change is horribly broken."
echo "# Here's the commit we want to revert."
run git log -n 1
echo
echo "# Now do the revert."
silent git revert --no-edit $(git show-ref -s pick_commit)
pcommand git revert $(git show-ref -s pick_commit)
echo
echo "# That reverted the change and committed the revert."
run git log -n 1
echo
echo "# As with old drover, reverts are generally OK to commit without LGTM."
pcommand git cl upload -r some.committer@chromium.org --send-mail
run git cl land --bypass-hooks
#!/usr/bin/env bash
. demo_repo.sh
# Add and tag a dummy commit to refer to later.
drover_c() {
add modified_file
set_user some.committer
c "$1"
silent git tag -f pick_commit
set_user branch.maintainer
tick 1000
}
silent git push origin refs/remotes/origin/master:refs/branch-heads/9999
silent git config --add remote.origin.fetch \
+refs/branch-heads/*:refs/remotes/branch-heads/*
silent git fetch origin
silent git checkout -B master origin/master
......@@ -19,11 +19,30 @@ sequence of commands to run.
EXAMPLE
-------
PREREQUISITES
~~~~~~~~~~~~~
Before working with branches, you must
ifdef::backend-xhtml11[]
`gclient sync --with_branch_heads`
endif::backend-xhtml11[]
ifdef::backend-docbook[]
'gclient sync --with_branch_heads'
endif::backend-docbook[]
at least once to fetch the branches.
Merge Example
^^^^^^^^^^^^^
demo:1[]
Revert Example
^^^^^^^^^^^^^^
demo:2[]
SEE ALSO
--------
linkgit:git-cherry-pick[1]
linkgit:git-revert[1]
include::_footer.txt[]
......
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