chiark / gitweb /
28f3084816064107440ab23f938091d4079269c1
[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 It is hazardous to use plain git-rebase on a git-debrebase branch,
59 because git-rebase has a tendency to start the rebase
60 too far back in history,
61 and then drop important commits.
62 Soo L<git-debrebase(5)/ILLEGAL OPERATIONS>
63
64 =item git-debrebase status
65
66 Analyses the current branch,
67 both in terms of its contents,
68 and the refs which are relevant to git-debrebase,
69 and prints a human-readable summary.
70
71 Please do not attempt to parse the output;
72 it may be reformatted or reorganised in the future.
73 Instead,
74 use one of the L<UNDERLYING AND SUPPLEMENTARY OPERATIONS>
75 described below.
76
77 =item git-debrebase conclude
78
79 Finishes a git-debrebase session,
80 tidying up the branch and making it fast forward again.
81
82 Specifically: if the branch is unstitched,
83 launders and restitches it,
84 making a new pseudomerge.
85 Otherwise, it is an error,
86 unless --noop-ok.
87
88 =item git-debrebase quick
89
90 Unconditionally launders and restitches the branch,
91 consuming any ffq-prev
92 and making a new pseudomerge.
93
94 If the branch is already laundered and stitched, does nothing.
95
96 =item git-debrebase prepush [--prose=<for commit message>]
97
98 =item git-debrebase stitch [--prose=<for commit message>]
99
100 Stitches the branch,
101 consuming ffq-prev.
102 This is a good command to run before pushing to a git server.
103
104 If there is no ffq-prev, it is an error, unless --noop-ok.
105
106 You should consider using B<conclude> instead,
107 because that launders the branch too.
108
109 =item git-debrebase scrap
110
111 Throws away all the work since the branch was last stitched.
112 This is done by rewinding you to ffq-prev.
113
114 =item git-debrebase new-upstream <new-version> [<upstream-details>...]
115
116 Rebases the delta queue
117 onto a new upstream version.  In detail:
118
119 Firstly, checks that the proposed rebase seems to make sense:
120 It is a snag unless the new upstream(s)
121 are fast forward from the previous upstream(s)
122 as found in the current breakwater anchor.
123 And, in the case of a multi-piece upstream
124 (a multi-component upstream, in dpkg-source terminology),
125 if the pieces are not in the same order, with the same names.
126
127 If all seems well, unstitches and launders the branch.
128
129 Then,
130 generates
131 (in a private working area)
132 a new anchor merge commit,
133 on top of the breakwater tip,
134 and on top of that a commit to
135 update the version number in debian/changelog.
136
137 Finally,
138 starts a git-rebase
139 of the delta queue onto these new commits.
140
141 That git-rebase may complete successfully,
142 or it may require your assistance,
143 just like a normal git-rebase.
144
145 If you git-rebase --abort,
146 the whole new upstream operation is aborted,
147 except for the laundering.
148
149 <new-version>
150 may be whole new Debian version, including revision,
151 or just the upstream part,
152 in which case -1 will be appended
153 to make the new Debian version.
154
155 The <upstream-details> are, optionally, in order:
156
157 =over
158
159 =item <upstream-commit-ish>
160
161 The new upstream branch (or commit-ish).
162 The default is to look for one of these tags, in this order:
163 U vU upstream/U;
164 where U is the new upstream version.
165 (This is the same algorithm as L<git-deborig(1)>.)
166
167 It is a snag if the upstream contains a debian/ directory;
168 if forced to proceed,
169 git-debrebase will disregard the upstream's debian/ and
170 take (only) the packaging from the current breakwater.
171
172 =item <piece-name> <piece-upstream-commit-ish>
173
174 Specifies that this is a multi-piece upstream.
175 May be repeated.
176
177 When such a pair is specified,
178 git-debrebase will first combine the pieces of the upstream
179 together,
180 and then use the result as the combined new upstream.
181
182 For each <piece-name>,
183 the tree of the <piece-upstream-commit-ish>
184 becomes the subdirectory <piece-name>
185 in the combined new upstream
186 (supplanting any subdirectory that might be there in
187 the main upstream branch).
188
189 <piece-name> has a restricted syntax:
190 it may contain only ASCII alphanumerics and hyphens.
191
192 The combined upstream is itself recorded as a commit,
193 with each of the upstream pieces' commits as parents.
194 The combined commit contains an annotation
195 to allow a future git-debrebase new upstream operation
196 to make the coherency checks described above.
197
198 =item <git-rebase options>
199
200 These will be passed to git rebase.
201
202 If the upstream rebase is troublesome, -i may be helpful.
203 As with plain git-debrebase,
204 do not specify a base, or --onto, or --fork-point.
205
206 =back
207
208 If you are planning to generate a .dsc,
209 you will also need to have, or generate,
210 actual orig tarball(s),
211 which must be identical to the rev-spec(s)
212 passed to git-debrebase.
213 git-debrebase does not concern itself with source packages
214 so neither helps with this, nor checks it.
215 L<git-deborig(1)>,
216 L<git-archive(1)>, L<dgit(1)> and
217 L<gbp-import-orig(1)> may be able to help.
218
219 =item git-debrebase make-patches [--quiet-would-amend]
220
221 Generate patches in debian/patches/
222 representing the changes made to upstream files.
223
224 It is not normally necessary to run this command explicitly.
225 When uploading to Debian,
226 dgit and git-debrebase
227 will cooperate to regenerate patches as necessary.
228 When working with pure git remotes,
229 the patches are not needed.
230
231 Normally git-debrebase make-patches will
232 require a laundered branch.
233 (A laundered branch does not contain any patches.)
234 But if there are already some patches made by
235 git-debrebase make-patches,
236 and all that has happened is that more
237 changes to upstream files have been committed,
238 running it again can add the missing patches.
239
240 If the patches implied by the current branch
241 are not a simple superset of those already in debian/patches,
242 make-patches will fail with exit status 7,
243 and an error message.
244 (The message can be suppress with --quiet-would-amend.)
245 If the problem is simply that
246 the existing patches were not made by git-debrebase,
247 using dgit quilt-fixup instead should succeed.
248
249 =item git-debrebase convert-from-gbp [<upstream-commit-ish>]
250
251 Cnnverts a gbp patches-unapplied branch
252 (not a gbp pq patch queue branch)
253 into a git-debrebase interchange branch.
254
255 This is done by generating a new anchor merge,
256 converting the quilt patches as a delta queue,
257 and dropping the patches from the tree.
258
259 The upstream commit-ish should correspond to
260 the gbp upstream branch, if there is one.
261 It is a snag if it is not an ancestor of HEAD,
262 or if the history between the upstream and HEAD
263 contains commits which make changes to upstream files.
264 If it is not specified,
265 the same algorithm is used as for git-debrebase new-upstream.
266
267 It is also a snag if the specified upstream
268 has a debian/ subdirectory.
269 This check exists to detect certain likely user errors,
270 but if this situation is true and expected,
271 forcing it is fine.
272
273 git-debrebase will try to look for the dgit archive view
274 of the most recent release,
275 and if it finds it will make a pseduomerge so that
276 your new git-debrebase view is appropriately fast forward.
277
278 The result is a well-formed git-debrebase interchange branch.
279 The result is also fast-forward from the gbp branch.
280
281 It is a snag if the new branch looks like it will have diverged,
282 just as for a laundering/unstitching call to git-debrebase;
283 See L</Establish the current branch's ffq-prev>, below.
284
285 Note that it is dangerous not to know whether you are
286 dealing with a gbp patches-unapplied branch containing quilt patches,
287 or a git-debrebase interchange branch.
288 At worst,
289 using the wrong tool for the branch format might result in
290 a dropped patch queue!
291
292 =back
293
294 =head1 UNDERLYING AND SUPPLEMENTARY OPERATIONS
295
296 =over
297
298 =item git-debrebase breakwater
299
300 Prints the breakwater tip commitid.
301 If your HEAD branch is not fully laundered,
302 prints the tip of the so-far-laundered breakwater.
303
304 =item git-debrebase anchor
305
306 Prints the breakwater anchor commitid.
307
308 =item git-debrebase analyse
309
310 Walks the history of the current branch,
311 most recent commit first,
312 back until the most recent anchor,
313 printing the commit object id,
314 and commit type and info
315 (ie the semantics in the git-debrebase model)
316 for each commit.
317
318 =item git-debrebase record-ffq-prev
319
320 Establishes the current branch's ffq-prev,
321 as discussed in L</UNSTITCHING AND LAUNDERING>,
322 but does not launder the branch or move HEAD.
323
324 It is an error if the ffq-prev could not be recorded.
325 It is also an error if an ffq-prev has already been recorded,
326 unless --noop-ok.
327
328 =item git-debrebase launder-v0
329
330 Launders the branch without recording anything in ffq-prev.
331 Then prints some information about the current branch.
332 Do not use this operation;
333 it will be withdrawn soon.
334
335 =item git-debrebase convert-to-gbp
336
337 Converts a laundered branch into a
338 gbp patches-unapplied branch containing quilt patches.
339 The result is not fast forward from the interchange branch,
340 and any ffq-prev is deleted.
341
342 This is provided mostly for the test suite
343 and for unusual situations.
344 It should only be used with a care and 
345 with a proper understanding of the underlying theory.
346
347 Be sure to not accidentally treat the result as
348 a git-debrebase branch,
349 or you will drop all the patches!
350
351 =item git-debrebase convert-from-dgit-view [<convert-options>] [upstream]
352
353 Converts any dgit-compatible git branch
354 corresponding to a (possibly hypothetical) 3.0 quilt dsc source package
355 into a git-debrebase-compatible branch.
356
357 This operation should not be used
358 if the branch is already in git-debrebase form.
359 Normally git-debrebase will refuse to continue in this case
360 (or silently do nothing if the global --noop-ok option is used).
361
362 Some representation of the original upstream source code will be needed.
363 If I<upstream> is supplied, that must be a suitable upstream commit.
364 By default,
365 git-debrebase will look first for git tags (as for new-upstream),
366 and then for orig tarballs which it will ask dgit to process.
367
368 The upstream source must be exactly right and
369 all the patches in debian/patches must be up to date.
370 Applying the patches from debian/patches to the upstream source
371 must result in exactly your HEAD.
372
373 The output is laundered and stitched.
374 The resulting history is not particularly pretty,
375 especially if orig tarball(s) were imported
376 to produce a synthetic upstream commit.
377
378 The available convert-options are as follows.
379 (These must come after convert-from-dgit-view.)
380
381 =over
382
383 =item --[no-]diagnose
384
385 Print additional error messages to help diagnose
386 failure to find an appropriate upstream.
387 --no-diagnose is the default.
388
389 =item --build-products-dir
390
391 Directory to look in for orig tarballs.
392 The default is the git config option
393 dgit.default.build-products-dir
394 or failing that, C<..>.
395 Passed on to dgit, if git-debrebase invokes dgit.
396
397 =item --[no-]origs
398
399 Whether to try to look for or use any orig tarballs.
400 --origs is the default.
401
402 =item --[no-]tags
403
404 Whether to try to look for or use any upstream git tags.
405 --tags is the default.
406
407 =item --always-convert-anyway
408
409 Perform the conversion operation,
410 producing unpleasant extra history,
411 even if the branch seems to be in git-debrebase form already.
412 This should not be done unless necessary,
413 and it should not be necessary.
414
415 =back
416
417 =back
418
419 =head1 OPTIONS
420
421 This section documents the general options
422 to git-debrebase
423 (ie, the ones which immediately follow
424 git-debrebase
425 or
426 git debrebase
427 on the command line).
428 Individual operations may have their own options which are
429 docuented under each operation.
430
431 =over
432
433 =item -f<snag-id>
434
435 Turns snag(s) with id <snag-id> into warnings.
436
437 Some troublesome things which git-debrebase encounters
438 are B<snag>s.
439 (The specific instances are discussed
440 in the text for the relevant operation.)
441
442 When a snag is detected,
443 a message is printed to stderr containing the snag id
444 (in the form C<-f<snag-idE<gt>>),
445 along with some prose.
446
447 If snags are detected, git-debrebase does not continue,
448 unless the relevant -f<snag-id> is specified,
449 or --force is specified.
450
451 =item --force
452
453 Turns all snags into warnings.
454 See the -f<snag-id> option.
455
456 Do not invoke git-debrebase --force in scripts and aliases;
457 instead, specify the particular -f<snag-id> for expected snags.
458
459 =item --noop-ok
460
461 Suppresses the error in
462 some situations where git-debrebase does nothing,
463 because there is nothing to do.
464
465 The specific instances are discussed
466 in the text for the relvant operation.
467
468 =item --anchor=<commit-ish>
469
470 Treats <commit-ish> as an anchor.
471 This overrides the usual logic which automatically classifies
472 commits as anchors, pseudomerges, delta queue commits, etc.
473
474 It also disables some coherency checks
475 which depend on metadata extracted from its commit message,
476 so
477 it is a snag if <commit-ish> is the anchor
478 for the previous upstream version in
479 git-debrebase new-upstream operations.
480
481 =item --dgit=<program>
482
483 Run <program>, instead of dgit from PATH,
484 when invocation of dgit is necessary.
485 This is provided mostly for the benefit of the test suite.
486
487 =item -D
488
489 Requests (more) debugging.  May be repeated.
490
491 =back
492
493 =head1 UNSTITCHING AND LAUNDERING
494
495 Several operations unstitch and launder the branch first.
496 In detail this means:
497
498 =head2 Establish the current branch's ffq-prev
499
500 If ffq-prev is not yet recorded,
501 git-debrebase checks that the current branch is ahead of relevant
502 remote tracking branches.
503 The relevant branches depend on
504 the current branch (and its
505 git configuration)
506 and are as follows:
507
508 =over
509
510 =item
511
512 The branch that git would merge from
513 (remote.<branch>.merge, remote.<branch>.remote);
514
515 =item
516
517 The branch git would push to, if different
518 (remote.<branch>.pushRemote etc.);
519
520 =item
521
522 For local dgit suite branches,
523 the corresponding tracking remote;
524
525 =item
526
527 If you are on C<master>,
528 remotes/dgit/dgit/sid.
529
530 =back
531
532 The apparently relevant ref names to check are filtered through
533 branch.<branch>.ffq-ffrefs,
534 which is a semicolon-separated list of glob patterns,
535 each optionally preceded by !; first match wins.
536
537 In each case it is a snag if
538 the local HEAD is behind the checked remote,
539 or if local HEAD has diverged from it.
540 All the checks are done locally using the remote tracking refs:
541 git-debrebase does not fetch anything from anywhere.
542
543 If these checks pass,
544 or are forced,
545 git-debrebse then records the current tip as ffq-prev.
546
547 =head2 Examine the branch
548
549 git-debrebase
550 analyses the current HEAD's history to find the anchor
551 in its breakwater,
552 and the most recent breakwater tip.
553
554 =head2 Rewrite the commits into laundered form
555
556 Mixed debian+upstream commits are split into two commits each.
557 Delta queue (upstream files) commits bubble to the top.
558 Pseudomerges,
559 and quilt patch additions,
560 are dropped.
561
562 This rewrite will always succeed, by construction.
563 The result is the laundered branch.
564
565 =head1 SEE ALSO
566
567 git-debrebase(1),
568 dgit-maint-rebase(7),
569 dgit(1),
570 gitglossary(7)