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