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