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