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