xref: /freebsd/tools/tools/git/git-arc.1 (revision d7d962ead0b6e5e8a39202d0590022082bf5bfb6)
1.\"
2.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3.\"
4.\" Copyright (c) 2021 Daniel Ebdrup Jensen
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.Dd May 14, 2021
28.Dt GIT-ARC 1
29.Os
30.Sh NAME
31.Nm git arc
32.Nd a wrapper to improve integration betwen git and arcanist
33.Sh SYNOPSIS
34.Nm
35.Cm create
36.Op Fl l
37.Op Fl r Ar reviewer1 Ns Op Cm \&, Ns Ar reviewer2 ...
38.Op Fl s Ar subscriber1 Ns Op Cm \&, Ns Ar subscriber2 ...
39.Op Ar commit Ns | Ns Ar commit-range
40.Nm
41.Cm list Ar commit Ns | Ns Ar commit-range
42.Nm
43.Cm patch Ar diff1 Ns Op Cm \&, Ns Ar diff2
44.Nm
45.Cm stage
46.Op Fl b Ar branch
47.Op Ar commit Ns | Ns Ar commit-range
48.Nm
49.Cm update
50.Op Ar commit Ns | Ns Ar commit-range Oc
51.Sh DESCRIPTION
52The
53.Nm
54utility creates and manages
55.Fx
56Phabricator reviews based on git commits.
57.Pp
58Git
59assumes a one-to-one relationship between git commits and
60Differential Revisions, and the Differential Revision title must match
61the summary line of the corresponding commit.
62In particular, the commit summaries must be unique across all open
63Differential Revisions authored the submitter.
64.Pp
65The first parameter must be a verb.
66The available verbs are:
67.Bl -tag -width "create"
68.It Cm create
69Create new Differential Revisions from the specified commits.
70.It Cm list
71Print the associated Differential Revisions for the specified commits.
72.It Cm patch
73Try to apply a patch from a Differential revision to the currently
74checked out tree.
75.It Cm stage
76Prepare a series of commits to be pushed to the upstream
77.Fx
78repository.
79The commits are cherry-picked to a branch (by default the
80.Dq main
81branch), review tags are added to the commit log message, and
82the log message is opened in an editor for any last-minute
83updates.
84The commits need not have associated Differential
85Revisions.
86.It Cm update
87Synchronize the Differential Revisions associated with the
88specified commits.
89Currently only the diff is updated; the review description and other
90metadata is not synchronized.
91.El
92.Sh CONFIGURATION
93These are manipulated by
94.Nm git-config :
95.Bl -tag -width "arc.assume_yes"
96.It Va arc.assume_yes
97Assume a
98.Dq yes
99answer to all prompts instead of
100prompting the user.
101Equivalent to the
102.Fl y
103flag.
104Defaults to false.
105.It Va arc.browse
106Try to open newly created reviews in a browser tab.
107Defaults to false.
108.It Va arc.list
109Always use
110.Dq list mode
111.Pq Fl l
112with create.
113In this mode, the list of git revisions to create reviews for
114is listed with a single prompt before creating reviews.
115The diffs for individual commits are not shown.
116Defaults to false.
117.It Va arc.verbose
118Always use verbose output.
119Equivalent to the
120.Fl v
121flag.
122Defaults to false.
123.El
124.Sh EXAMPLES
125The typical end-to-end usage looks something like this.
126.Pp
127Commit changes with a message and create a Differential review:
128.Bd -literal -offset indent
129$ git commit -m "kern: Rewrite in Rust"
130$ git arc create HEAD
131.Ed
132.Pp
133Make changes to the diff based on review feedback, then amend the
134changes to the existing commit and update the Differential review:
135.Bd -literal -offset indent
136$ git commit --amend
137$ git arc update HEAD
138.Ed
139.Pp
140Now that all reviewers are happy, it is time to stage the commit and
141push it:
142.Bd -literal -offset indent
143$ git arc stage HEAD
144$ git push freebsd HEAD:main
145.Ed
146.Pp
147Create a Phabricator review using the contents of the most recent
148commit in your git checkout:
149.Bd -literal -offset indent
150$ git arc create -r markj HEAD
151.Ed
152.Pp
153The commit title is used as the review title, the commit log
154message is used as the review description, and
155.Aq Mt markj@FreeBSD.org
156is added as a reviewer.
157.Pp
158Create a series of Phabricator reviews for each of HEAD~2, HEAD~ and
159HEAD:
160.Bd -literal -offset indent
161$ git arc create HEAD~3..HEAD
162.Ed
163.Pp
164Pairs of consecutive commits are linked into a patch stack.
165Note that the first commit in the specified range is excluded.
166.Pp
167Update the review corresponding to commit b409afcfedcdda:
168.Bd -literal -offset indent
169$ git arc update b409afcfedcdda
170.Ed
171.Pp
172The title of the commit must be the same as it was when the review
173was created.
174Note that the review description is not automatically updated.
175.Pp
176Apply the patch in review D12345 to the currently checked-out tree,
177and stage it:
178.Bd -literal -offset indent
179$ git arc patch D12345
180.Ed
181.Pp
182List the status of reviews for all the commits in the branch
183.Dq feature :
184.Bd -literal -offset indent
185$ git arc list main..feature
186.Ed
187.Sh SEE ALSO
188.Xr build 7 ,
189.Xr development 7
190.Sh HISTORY
191The
192.Nm
193utility appeared in the src tools collection in
194.Fx 14.0 .
195.Sh AUTHORS
196The
197.Nm
198utility was written by
199.An -nosplit
200.An Mark Johnston Aq Mt markj@FreeBSD.org
201and the manual page was written by
202.An Daniel Ebdrup Jensen Aq Mt debdrup@FreeBSD.org .
203