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