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