chiark / gitweb /
git-debrebase(1): Further manpage improvement
[dgit.git] / git-debrebase.1.pod
1 =head1 NAME
2
3 git-debrebase - delta queue rebase tool for Debian packaging
4
5 =head1 SYNOPSYS
6
7  git-debrebase [<options...>] [-- <git-rebase options...>]
8  git-debrebase [<options...>] <operation> [<operation options...>
9
10 =head1 INTRODUCTION
11
12 git-debrebase is a tool for representing in git,
13 and manpulating,
14 Debian packages based on upstream source code.
15
16 This is the command line reference.
17 Please read the tutorial
18 L<dgit-maint-debrebase(5)>.
19 For background, theory of operation,
20 and definitions see L<git-debrebase(5)>.
21
22 You should read this manpage in conjunction with
23 L<git-debrebase(5)/TERMINOLOGY>,
24 which defines many important terms used here.
25
26 =head1 PRINCIPAL OPERATIONS
27
28 =over
29
30 =item git-debrebase [-- <git-rebase options...>]
31
32 Unstitches and launders the branch.
33 (See L</UNSTITCHING AND LAUNDERING> below.)
34
35 Then optionally edits the Debian delta queue,
36 using git-rebase, by running
37
38     git rebase <git-rebase options> <breakwater-tip>
39
40 Do not pass a base branch argument:
41 git-debrebase will supply that.
42 Do not use --onto, or --fork-point.
43 Useful git-rebase options include -i and --autosquash.
44
45 If git-rebase stops for any reason,
46 you may git-rebase --abort, --continue, or --skip, as usual.
47 If you abort the git-rebase,
48 the branch will still have been laundered,
49 but everything in the rebase will be undone.
50
51 =item git-debrebase stitch [--prose=<for commit message>]
52
53 Stitch the branch,
54 consuming ffq-prev.
55
56 If there is no ffq-prev, it is an error, unless --noop-ok.
57
58 It is a problem if the branch is not laundered.
59
60 =item git-debrebase new-upstream-v0 <new-version> [<upstream-details>...]
61
62 Rebases the delta queue
63 onto a new upstream version.  In detail:
64
65 Firstly, checks that the proposed rebase seems to make sense:
66 It is a problem unless the new upstream(s)
67 are fast forward from the previous upstream(s)
68 as found in the current breakwater anchor.
69 And, in the case of a multi-piece upstream
70 (a multi-component upstream, in dpkg-source terminology),
71 if the pieces are not in the same order, with the same names.
72
73 If all seems well, unstitches and launders the branch.
74
75 Then,
76 generates
77 (in a private working area)
78 a new anchor merge commit,
79 on top of the breakwater tip,
80 and on top of that a commit to
81 update the version number in debian/changelog.
82
83 Finally,
84 starts a git-rebase
85 of the delta queue onto these new commits.
86
87 That git-rebase may complete successfully,
88 or it may require your assistance,
89 just like a normal git-rebase.
90
91 If you git-rebase --abort,
92 the whole new upstream operation is aborted,
93 except for the laundering.
94
95 The <upstream-details> are, optionally, in order:
96
97 =over
98
99 =item <upstream-commit-ish>
100
101 The new upstream branch (or commit-ish).
102 Default is C<upstream>.
103
104 It is a problem if the upstream contains a debian/ directory;
105 if forced to proceed,
106 git-debrebase will disregard the upstream's debian/ and
107 take (only) the packaging from the current breakwater.
108
109 =item <piece-name> <piece-upstream-commit-ish>
110
111 Specifies that this is a multi-piece upstream.
112 May be repeated.
113
114 When such a pair is specified,
115 git-debrebase will first combine the pieces of the upstream
116 together,
117 and then use the result as the combined new upstream.
118
119 For each <piece-name>,
120 the tree of the <piece-upstream-commit-ish>
121 becomes the subdirectory <piece-name>
122 in the combined new upstream
123 (supplanting any subdirectory that might be there in
124 the main upstream branch).
125
126 <piece-name> has a restricted syntax:
127 it may contain only ASCII alphanumerics and hyphens.
128
129 The combined upstream is itself recorded as a commit,
130 with each of the upstream pieces' commits as parents.
131 The combined commit contains an annotation
132 to allow a future git-debrebase new upstream operation
133 to make the coherency checks described above.
134
135 =item <git-rebase options>
136
137 These will be passed to git rebase.
138
139 If the upstream rebase is troublesome, -i may be helpful.
140 As with plain git-debrebase,
141 do not specify a base, or --onto, or --fork-point.
142
143 =back
144
145 If you are planning to generate a .dsc,
146 you will also need to have, or generate,
147 actual orig tarball(s),
148 which must be identical to the rev-spec(s)
149 passed to git-debrebase.
150 git-debrebase does not concern itself with source packages
151 so neither helps with this, nor checks it.
152 L<git-deborig(1)>,
153 L<git-archive(1)>, L<dgit(1)> and
154 L<gbp-import-orig(1)> may be able to help.
155
156 This subcommand has -v0 in its name because we are not yet sure
157 that its command line syntax is optimal.
158 We may want to introduce an incompatible replacement syntax
159 under the name C<new-upstream>.
160
161 =item git-debrebase convert-from-gbp [<upstream-commit-ish>]
162
163 Cnnverts a gbp patches-unapplied branch
164 (not a gbp pq patch queue branch)
165 into a git-debrebase interchange branch.
166
167 This is done by generating a new anchor merge,
168 converting the quilt patches as a delta queue,
169 and dropping the patches from the tree.
170
171 The upstream commit-ish should correspond to
172 the gbp upstream branch, if there is one.
173 It is a problem if it is not an ancestor of HEAD,
174 or if the history between the upstream and HEAD
175 contains commits which make changes to upstream files.
176
177 It is also a problem if the specified upstream
178 has a debian/ subdirectory.
179 This check exists to detect certain likely user errors,
180 but if this situation is true and expected,
181 forcing it is fine.
182
183 The result is a well-formed git-debrebase interchange branch.
184 The result is also fast-forward from the gbp branch.
185
186 Note that it is dangerous not to know whether you are
187 dealing with a gbp patches-unappled branch containing quilt patches,
188 or a git-debrebase interchange branch.
189 At worst,
190 using the wrong tool for the branch format might result in
191 a dropped patch queue!
192
193 =back
194
195 =head1 UNDERLYING AND SUPPLEMENTARY OPERATIONS
196
197 =over
198
199 =item git-debrebase breakwater
200
201 Prints the breakwater tip commitid.
202 If your HEAD branch is not fully laundered,
203 prints the tip of the so-far-laundered breakwater.
204
205 =item git-debrebase anchor
206
207 Prints the breakwater anchor commitid.
208
209 =item git-debrebase analyse
210
211 Walks the history of the current branch,
212 most recent commit first,
213 back until the most recent anchor,
214 printing the commit object id,
215 and commit type and info
216 (ie the semantics in the git-debrebase model)
217 for each commit.
218
219 =item git-debrebase record-ffq-prev
220
221 Establishes the current branch's ffq-prev,
222 as discussed in L</UNSTITCHING AND LAUNDERING>,
223 but does not launder the branch or move HEAD.
224
225 It is an error if the ffq-prev could not be recorded.
226 It is also an error if an ffq-prev has already been recorded,
227 unless --noop-ok.
228
229 =item git-debrebase launder-v0
230
231 Launders the branch without recording anything in ffq-prev.
232 Then prints some information about the current branch.
233 Do not use this operation;
234 it will be withdrawn soon.
235
236 =item git-debrebase convert-to-gbp
237
238 Converts a laundered branch into a
239 gbp patches-unapplied branch containing quilt patches.
240 The result is not fast forward from the interchange branch,
241 and any ffq-prev is deleted.
242
243 This is provided mostly for the test suite
244 and for unusual situations.
245 It should only be used with a care and 
246 with a proper understanding of the underlying theory.
247
248 Be sure to not accidentally treat the result as
249 a git-debrebase branch,
250 or you will drop all the patches!
251
252 =back
253
254 =head1 OPTIONS
255
256 This section documents the general options
257 to git-debrebase
258 (ie, the ones which immediately follow
259 git-debrebase
260 or
261 git debrebase
262 on the command line).
263 Individual operations may have their own options which are
264 docuented under each operation.
265
266 =over
267
268 =item -f<problem-id>
269
270 Turns problems with id <problem-id> into warnings.
271
272 Some troublesome things which git-debrebase encounters
273 are B<problem>s.
274 (The specific instances are discussed
275 in the text for the relvant operation.)
276
277 When a problem is detected,
278 a message is printed to stderr containing the problem id
279 (in the form C<-f<problem-idE<gt>>),
280 along with some prose.
281
282 If problems are detected, git-debrebase does not continue,
283 unless the relevant -f<problem-id> is specified,
284 or --force is specified.
285
286 =item --force
287
288 Turns all problems into warnings.
289 See the -f<problem-id> option.
290
291 Do not invoke git-debrebase --force in scripts and aliases;
292 instead, specify the particular -f<problem-id> for expected problems.
293
294 =item --noop-ok
295
296 Suppresses the error in
297 some situations where git-debrebase does nothing,
298 because there is nothing to do.
299
300 The specific instances are discussed
301 in the text for the relvant operation.
302
303 =item --anchor=<commit-ish>
304
305 Treats <commit-ish> as an anchor.
306 This overrides the usual logic which automatically classifies
307 commits as anchors, pseudomerges, delta queue commits, etc.
308
309 It also disables some coherency checks
310 which depend on metadata extracted from its commit message,
311 so
312 it is a problem if <commit-ish> is the anchor
313 for the previous upstream version in
314 git-debrebase new-upstream operations.
315
316 =item -D
317
318 Requests (more) debugging.  May be repeated.
319
320 =back
321
322 =head1 UNSTITCHING AND LAUNDERING
323
324 Several operations unstitch and launder the branch first.
325 In detail this means:
326
327 =head2 Establish the current branch's ffq-prev
328
329 If ffq-prev is not yet recorded,
330 git-debrebase checks that the current branch is ahead of relevant
331 remote tracking branches.
332 The relevant branches depend on
333 the current branch (and its
334 git configuration)
335 and are as follows:
336
337 =over
338
339 =item
340
341 The branch that git would merge from
342 (remote.<branch>.merge, remote.<branch>.remote);
343
344 =item
345
346 The branch git would push to, if different
347 (remote.<branch>.pushRemote etc.);
348
349 =item
350
351 For local dgit suite branches,
352 the corresponding tracking remote;
353
354 =item
355
356 If you are on C<master>,
357 remotes/dgit/dgit/sid.
358
359 =back
360
361 The apparently relevant ref names to check are filtered through
362 branch.<branch>.ffq-ffrefs,
363 which is a semicolon-separated list of glob patterns,
364 each optionally preceded by !; first match wins.
365
366 In each case it is a problem if
367 the local HEAD is behind the checked remote,
368 or if local HEAD has diverged from it.
369 All the checks are done locally using the remote tracking refs:
370 git-debrebase does not fetch anything from anywhere.
371
372 If these checks pass,
373 or are forced,
374 git-debrebse then records the current tip as ffq-prev.
375
376 =head2 Examine the branch
377
378 git-debrebase
379 analyses the current HEAD's history to find the anchor
380 in its breakwater,
381 and the most recent breakwater tip.
382
383 =head2 Rewrite the commits into laundered form
384
385 Mixed debian+upstream commits are split into two commits each.
386 Delta queue (upstream files) commits bubble to the top.
387 Pseudomerges,
388 and quilt patch additions,
389 are dropped.
390
391 This rewrite will always succeed, by construction.
392 The result is the laundered branch.
393
394 =head1 SEE ALSO
395
396 git-debrebase(1),
397 dgit-maint-rebase(7),
398 dgit(1),
399 gitglossary(7)