chiark / gitweb /
f17f1d670e3f5ffb529ecb5fa228f2109bcbab87
[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 =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 Analyise the current branch,
61 both in terms of its conents,
62 and the refs which are relevant to git-debrebase,
63 and print 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-v0 <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 This subcommand has -v0 in its name because we are not yet sure
203 that its command line syntax is optimal.
204 We may want to introduce an incompatible replacement syntax
205 under the name C<new-upstream>.
206
207 =item git-debrebase make-patches [--quiet-would-amend]
208
209 Generate patches in debian/patches/
210 representing the changes made to upstream files.
211
212 It is not normally necessary to run this command explicitly.
213 When uploading to Debian,
214 dgit and git-debrebase
215 will cooperate to regenerate patches as necessary.
216 When working with pure git remotes,
217 the patches are not needed.
218
219 Normally git-debrebase make-patches will
220 require a laundered branch.
221 (A laundered branch does not contain any patches.)
222 But if there are already some patches made by
223 git-debrebase make-patches,
224 and all that has happened is that more
225 changes to upstream files have been committed,
226 running it again can add the missing patches.
227
228 If the patches implied by the current branch
229 are not a simple superset of those already in debian/patches,
230 make-patches will fail with exit status 7,
231 and an error message.
232 (The message can be suppress with --quiet-would-amend.)
233
234 =item git-debrebase convert-from-gbp [<upstream-commit-ish>]
235
236 Cnnverts a gbp patches-unapplied branch
237 (not a gbp pq patch queue branch)
238 into a git-debrebase interchange branch.
239
240 This is done by generating a new anchor merge,
241 converting the quilt patches as a delta queue,
242 and dropping the patches from the tree.
243
244 The upstream commit-ish should correspond to
245 the gbp upstream branch, if there is one.
246 It is a snag if it is not an ancestor of HEAD,
247 or if the history between the upstream and HEAD
248 contains commits which make changes to upstream files.
249
250 It is also a snag if the specified upstream
251 has a debian/ subdirectory.
252 This check exists to detect certain likely user errors,
253 but if this situation is true and expected,
254 forcing it is fine.
255
256 The result is a well-formed git-debrebase interchange branch.
257 The result is also fast-forward from the gbp branch.
258
259 Note that it is dangerous not to know whether you are
260 dealing with a gbp patches-unappled branch containing quilt patches,
261 or a git-debrebase interchange branch.
262 At worst,
263 using the wrong tool for the branch format might result in
264 a dropped patch queue!
265
266 =back
267
268 =head1 UNDERLYING AND SUPPLEMENTARY OPERATIONS
269
270 =over
271
272 =item git-debrebase breakwater
273
274 Prints the breakwater tip commitid.
275 If your HEAD branch is not fully laundered,
276 prints the tip of the so-far-laundered breakwater.
277
278 =item git-debrebase anchor
279
280 Prints the breakwater anchor commitid.
281
282 =item git-debrebase analyse
283
284 Walks the history of the current branch,
285 most recent commit first,
286 back until the most recent anchor,
287 printing the commit object id,
288 and commit type and info
289 (ie the semantics in the git-debrebase model)
290 for each commit.
291
292 =item git-debrebase record-ffq-prev
293
294 Establishes the current branch's ffq-prev,
295 as discussed in L</UNSTITCHING AND LAUNDERING>,
296 but does not launder the branch or move HEAD.
297
298 It is an error if the ffq-prev could not be recorded.
299 It is also an error if an ffq-prev has already been recorded,
300 unless --noop-ok.
301
302 =item git-debrebase launder-v0
303
304 Launders the branch without recording anything in ffq-prev.
305 Then prints some information about the current branch.
306 Do not use this operation;
307 it will be withdrawn soon.
308
309 =item git-debrebase convert-to-gbp
310
311 Converts a laundered branch into a
312 gbp patches-unapplied branch containing quilt patches.
313 The result is not fast forward from the interchange branch,
314 and any ffq-prev is deleted.
315
316 This is provided mostly for the test suite
317 and for unusual situations.
318 It should only be used with a care and 
319 with a proper understanding of the underlying theory.
320
321 Be sure to not accidentally treat the result as
322 a git-debrebase branch,
323 or you will drop all the patches!
324
325 =back
326
327 =head1 OPTIONS
328
329 This section documents the general options
330 to git-debrebase
331 (ie, the ones which immediately follow
332 git-debrebase
333 or
334 git debrebase
335 on the command line).
336 Individual operations may have their own options which are
337 docuented under each operation.
338
339 =over
340
341 =item -f<snag-id>
342
343 Turns snag(s) with id <snag-id> into warnings.
344
345 Some troublesome things which git-debrebase encounters
346 are B<snag>s.
347 (The specific instances are discussed
348 in the text for the relvant operation.)
349
350 When a snag is detected,
351 a message is printed to stderr containing the snag id
352 (in the form C<-f<snag-idE<gt>>),
353 along with some prose.
354
355 If snags are detected, git-debrebase does not continue,
356 unless the relevant -f<snag-id> is specified,
357 or --force is specified.
358
359 =item --force
360
361 Turns all snags into warnings.
362 See the -f<snag-id> option.
363
364 Do not invoke git-debrebase --force in scripts and aliases;
365 instead, specify the particular -f<snag-id> for expected snags.
366
367 =item --noop-ok
368
369 Suppresses the error in
370 some situations where git-debrebase does nothing,
371 because there is nothing to do.
372
373 The specific instances are discussed
374 in the text for the relvant operation.
375
376 =item --anchor=<commit-ish>
377
378 Treats <commit-ish> as an anchor.
379 This overrides the usual logic which automatically classifies
380 commits as anchors, pseudomerges, delta queue commits, etc.
381
382 It also disables some coherency checks
383 which depend on metadata extracted from its commit message,
384 so
385 it is a snag if <commit-ish> is the anchor
386 for the previous upstream version in
387 git-debrebase new-upstream operations.
388
389 =item -D
390
391 Requests (more) debugging.  May be repeated.
392
393 =back
394
395 =head1 UNSTITCHING AND LAUNDERING
396
397 Several operations unstitch and launder the branch first.
398 In detail this means:
399
400 =head2 Establish the current branch's ffq-prev
401
402 If ffq-prev is not yet recorded,
403 git-debrebase checks that the current branch is ahead of relevant
404 remote tracking branches.
405 The relevant branches depend on
406 the current branch (and its
407 git configuration)
408 and are as follows:
409
410 =over
411
412 =item
413
414 The branch that git would merge from
415 (remote.<branch>.merge, remote.<branch>.remote);
416
417 =item
418
419 The branch git would push to, if different
420 (remote.<branch>.pushRemote etc.);
421
422 =item
423
424 For local dgit suite branches,
425 the corresponding tracking remote;
426
427 =item
428
429 If you are on C<master>,
430 remotes/dgit/dgit/sid.
431
432 =back
433
434 The apparently relevant ref names to check are filtered through
435 branch.<branch>.ffq-ffrefs,
436 which is a semicolon-separated list of glob patterns,
437 each optionally preceded by !; first match wins.
438
439 In each case it is a snag if
440 the local HEAD is behind the checked remote,
441 or if local HEAD has diverged from it.
442 All the checks are done locally using the remote tracking refs:
443 git-debrebase does not fetch anything from anywhere.
444
445 If these checks pass,
446 or are forced,
447 git-debrebse then records the current tip as ffq-prev.
448
449 =head2 Examine the branch
450
451 git-debrebase
452 analyses the current HEAD's history to find the anchor
453 in its breakwater,
454 and the most recent breakwater tip.
455
456 =head2 Rewrite the commits into laundered form
457
458 Mixed debian+upstream commits are split into two commits each.
459 Delta queue (upstream files) commits bubble to the top.
460 Pseudomerges,
461 and quilt patch additions,
462 are dropped.
463
464 This rewrite will always succeed, by construction.
465 The result is the laundered branch.
466
467 =head1 SEE ALSO
468
469 git-debrebase(1),
470 dgit-maint-rebase(7),
471 dgit(1),
472 gitglossary(7)