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