chiark / gitweb /
wip workflow docs
[dgit.git] / dgit.1
1 .TH dgit 1 "" "Debian Project" "dgit"
2 .SH NAME
3 dgit \- git integration with the Debian archive
4 .
5 .SH SYNOPSIS
6 .B dgit
7 [\fIdgit\-opts\fP] \fBclone\fP [\fIdgit\-opts\fP]
8 \fIpackage\fP [\fIsuite\fP] [\fB./\fP\fIdir|\fB/\fP\fIdir]
9 .br
10 .B dgit
11 [\fIdgit\-opts\fP] \fBfetch\fP|\fBpull\fP [\fIdgit\-opts\fP]
12 [\fIsuite\fP]
13 .br
14 .B dgit
15 [\fIdgit\-opts\fP] \fBbuild\fP
16 [\fIgit\-buildpackage\-opts\fP|\fIdpkg\-buildpackage\-opts\fp]
17 .br
18 .B dgit
19 [\fIdgit\-opts\fP] \fBpush\fP [\fIdgit\-opts\fP]
20 [\fIsuite\fP]
21 .SH DESCRIPTION
22 .B dgit
23 treats the Debian archive as a version control system, and
24 bidirectionally gateways between the archive and git.  The git view of
25 the package can contain the usual upstream git history, and will be
26 augmented by commits representing uploads done by other developers not
27 using dgit.  This git history is stored in a canonical location known
28 as
29 .B dgit-repos
30 which lives outside the Debian archive (currently, on Alioth).
31
32 .B dgit clone
33 and
34 .B dgit fetch
35 consult the archive and dgit-repos and fetch and/or construct the
36 git view of the history.  With clone, the destination directory (by
37 default, the package name in the current directory) will be created,
38 and the new directory's `origin' remote will be set up to point to
39 the package's dgit-repos tree.
40
41 .B dgit build
42 runs
43 .B git-buildpackage
44 with some suitable options.  Options after
45 .B build
46 will be passed on to git-buildpackage.  It is not necessary to
47 use dgit build; it is OK to use any approach which ensures that
48 the generated source package corresponds to the relevant git commit.
49 Tagging and signing should be left to dgit push.
50
51 .B dgit push
52 does an `upload', pushing the current HEAD to the archive (as a source
53 package) and to dgit-repos (as git commits).  This also involves
54 making a signed git tag, and signing the files to be uploaded to the
55 archive.
56 .SH WORKFLOW - SIMPLE
57 It is always possible with dgit to clone or fetch a package, make
58 changes in git (using git-commit) on the suite branch
59 .RB ( "git checkout dgit/" \fIsuite\fR)
60 and then dgit push.  You can use whatever gitish techniques you like
61 to construct the commit to push; the only requirement is that it is a
62 descendant of the state of the archive, as provided by dgit in the
63 remote tracking branch
64 .BR remotes/dgit/ \fIsuite\fR.
65
66 If you are lucky the other uploaders have also used dgit and
67 integrated the other relevant git history; if not you can fetch it
68 into your tree and cherry-pick etc. as you wish.
69 .SH WORKFLOW - INTEGRATING BETWEEN DGIT AND OTHER GIT HISTORY
70 If you are the maintainer of a package, to deal with uploads made
71 without dgit, you will probably want to merge the synthetic commits
72 (made by dgit to represent the uploads) into your git history.
73 Normally you can just merge the dgit branch into your own master, or
74 indeed if you do your work on the dgit local suite branch
75 .BI dgit/ suite
76 you can just use dgit pull.
77
78 However the first time you use dgit it will generate a new origin
79 commit from the archive which won't be linked into the rest of your
80 git history.  You will need to merge this.
81
82 If last upload was made with git, you should usually proceed
83 as follows: identify the commit which was actually used to build the
84 package.  (Hopefully you have a tag for this.)  Check out the dgit
85 branch
86 .RB ( "git checkout dgit/" \fIsuite\fR)
87 and merge that other commit
88 .RB ( "git merge debian/" \fIversion\fR).
89 Hopefully this merge will be trivial because the two trees should
90 be the same.  The resulting branch head can be merged into your
91 working branches
92 .RB ( "git checkout master && git merge dgit/" \fIsuite\fR).
93
94 If last upload was not made with git, a different approach is required
95 to start using dgit.  First, do
96 .B dgit fetch
97 (or clone) obtain a git history representation of what's in the
98 archive and record it in the
99 .BI remotes/dgit/ suite
100 tracking branch.  Then construct somehow a git commit whose tree
101 corresponds to the tree to use for the next upload.  If that
102 commit-to-be-uploaded is not a descendant of the dig tracking remote,
103 check it out and say
104 .RB ( "git merge -s ours debian/" \fIversion\fR).
105 That tells git that we are intentionally throwing away any differences
106 between what's in the archive and what you intend to upload.
107 Then run
108 .BR "dgit push"
109 to actually upload the result.
110 .SH MODEL
111 You may use any suitable git workflow with dgit, provided you
112 satisfy dgit's requirements:
113
114 dgit maintains a pseudo-remote called
115 .BR dgit ,
116 with one branch per suite.  This remote cannot be used with
117 plain git.
118
119 The
120 .B dgit-repos
121 repository for each package contains one ref per suite named
122 \fBrefs/dgit/\fR\fIsuite\fR.  These should be pushed to only by
123 dgit.  They are fast forwarding.  Each push on this branch
124 corresponds to an upload (or attempted upload).
125
126 However, it is perfectly fine to have other branches in dgit-repos;
127 normally the dgit-repos repo for the package will be accessible via
128 the remote name `origin'.
129
130 dgit push can operate on any commit which is a descendant of the
131 current dgit/suite tip in dgit-repos.
132
133 Uploads made by dgit contain an additional field
134 .B Vcs-Dgit-Master
135 in the source package .dsc.  (This is added by dgit push.)
136 This specifies a commit (an ancestor of the dgit/suite
137 branch) whose tree is identical to the unpacked source upload.
138
139 Uploads not made by dgit are represented in git by commits which are
140 synthesised by dgit.  The tree of each such commit corresponds to the
141 unpacked source; there is an origin commit with the contents, and a
142 psuedo-merge from last known upload - that is, from the contents of
143 the dgit/suite branch.
144
145 dgit expects repos that it works with to have a
146 .B dgit
147 remote.  This refers to the well-known dgit-repos location
148 (currently, the dgit-repos project on Alioth).  dgit fetch updates
149 the remote tracking branch for dgit/suite.
150
151 dgit does not (currently) represent the orig tarball(s) in git; nor
152 does it represent the patch statck of a `3.0 (quilt)' package.  The
153 orig tarballs are downloaded and kept in the parent directory, as with
154 a traditional (non-gitish) dpkg-source workflow.
155
156 To a user looking at the archive, changes pushed using dgit look like
157 changes made in an NMU: in a `3.0 (quilt)' package the delta from the
158 previous upload is recorded in a new patch constructed by dpkg-source.
159 .SH PACKAGE SOURCE FORMATS
160 If you are not the maintainer, you do not need to worry about the
161 source format of the package.  You can just make changes as you like
162 in git.  If the package is a `3.0 (quilt)' package, the patch stack
163 will not (necessarily) be represented in the git history.
164
165 If you are the maintainer of a non-native package, you currently have
166 two sensible options.
167
168 Firstly, you can regard your git history as primary, and the archive
169 as an export format.  For example, you could maintain topic branches
170 in git and a fast-forwarding release branch; or you could do your work
171 directly in a merging way on the
172 .BI dgit/ suite
173 branches.  If you do this you should probably use a `1.0' format
174 source package.  In the archive, the delta between upstream will be
175 represented in the single Debian patch.
176
177 Secondly, you can regard your quiltish patch stack in the archive as
178 primary.  You will have to use other tools besides dgit to import and
179 export this patch stack.
180 .SH OPTIONS
181 .TP
182 .BR --dry-run | -n
183 Go through the motions, fetching all information needed, but do not
184 actually update the output(s).  For push, dgit does
185 the required checks and leaves the new .dsc in a temporary file,
186 but does not sign, tag, push or upload.
187 .TP
188 .BI -k keyid
189 Use
190 .I keyid
191 for signing the tag and the upload.
192 .TP
193 .BR --no-sign
194 does not sign tags or uploads (meaningful only with push).
195 .TP
196 .TP
197 .BI -p package
198 Specifies that we should process source package
199 .I package
200 rather than looking in debian/control or debian/changelog.
201 Valid with dgit fetch and dgit pull, only.
202 .TP
203 .BR -N | --new
204 The package may be new in this suite.  Without this, dgit will
205 refuse to push.
206 .TP
207 .BI -D
208 Prints debugging information to stderr.  Repeating the option produces
209 more output (currently, up to -DD is meaningfully different).
210 .TP
211 .BI -c name = value
212 Specifies a git configuration option.  dgit itself is also controlled
213 by git configuration options.
214 .TP
215 .RI \fB--dget=\fR program |\fB--dput=\fR program |\fB--debsign=\fR program
216 Specifies alternative programs to use instead of dget, dput
217 or debsign.
218 .TP
219 .RI \fB--dget:\fR option |\fB--dput:\fR option |\fB--debsign:\fR option
220 Specifies a single additional option to pass to dget, dput or
221 debsign.  Use repeatedly if multiple additional options are required.
222 .TP
223 .BI -C changesfile
224 Specifies the .changes file which is to be uploaded.  By default
225 dgit push looks for single .changes file in the parent directory whose
226 filename suggests it is for the right package and version.
227 .TP
228 .BI --existing-package= package
229 dgit push needs to canonicalise the suite name.  But currently
230 there is no way to ask the archive to do this without knowing the
231 name of an existing package.  Without --new we can just use the
232 package we are trying to push.  But with --new that will not work, so
233 we guess that
234 .B dpkg
235 exists in the target suite.  If it doesn't, you can use this option to
236 specify a package which does.  If the suite is empty, bad luck.
237 .SH CONFIGURATION
238 dgit looks at the following git config keys to control its behaviour.
239 You may set them with git-config (either in system-global or per-tree
240 configuration), or provide
241 .BI -c key = value
242 on the dgit command line.
243 .TP
244 .BI dgit-suite. suite .distro
245 .TP
246 .BI dgit.default.distro
247 .TP
248 .BI dgit.default.username
249 .TP
250 .BI dgit-distro. distro .git-url
251 .TP
252 .BI dgit-distro. distro .git-host
253 .TP
254 .BI dgit-distro. distro .git-proto
255 .TP
256 .BI dgit-distro. distro .git-path
257 .TP
258 .BI dgit-distro. distro .git-check
259 .TP
260 .BI dgit-distro. distro .git-create
261 .TP
262 .BI dgit-distro. distro .upload-host
263 .TP
264 .BI dgit-distro. distro .mirror
265 .TP
266 .BI dgit-distro. distro .archive-query
267 .TP
268 .BI dgit-distro. distro .archive-query-default-component
269 .TP
270 .BI dgit-distro. distro .ssh
271 .TP
272 .BR dgit.default. *
273 for each
274 .BR dgit-distro. \fIdistro\fR . *
275 .SH BUGS
276 We should be using some kind of vhost/vpath setup for the git repos on
277 alioth, so that they can be moved later if and when this turns out to
278 be a good idea.
279
280 Debian Policy needs to be updated to describe the new Vcs-Dgit-Master
281 field (and to specify that it is an RC bug for that field to refer
282 to an unavailable commit).
283
284 The method of canonicalising suite names is bizarre.  See the
285 .B --existing-package
286 option for one of the implication.s
287
288 dgit push should perhaps do `git push origin', or something similar,
289 by default.
290
291 The mechanism for checking for and creating per-package repos on
292 alioth is a hideous bodge.  One consequence is that dgit currently
293 only works for people with push access.
294
295 Debian Maintainers are currently not able to push, as there is not
296 currently any mechanism for determining and honouring the archive's
297 ideas about access control.  Currently only DDs can push.
298
299 dgit's representation of format `3.0 (quilt)' source packages does not
300 represent the patch stack.  Currently the patch series representation
301 cannot round trip through the archive.  Ideally dgit would represent a
302 quilty package with an origin commit of some kind followed by the
303 patch stack as a series of commits followed by a pseudo-merge (to make
304 the branch fast-forwarding).  This would also mean a new `dgit
305 rebase-prep' command or some such to turn such a fast-forwarding
306 branch back into a rebasing patch stack, and a `force' option to dgit
307 push (perhaps enabled automatically by a note left by rebase-prep)
308 which will make the required pseudo-merge.
309
310 If the dgit push fails halfway through, it should be restartable and
311 idempotent.  However this is not true for the git tag operation.
312 Also, it would be good to check that the proposed signing key is
313 available before starting work.
314
315 dgit's handling of .orig.tar.gz is not very sophisticated.  Ideally
316 the .orig.tar.gz could be transported via the git repo as git tags.
317 Doing this is made more complicated by the possibility of a `3.0
318 (quilt)' package with multiple .orig tarballs.
319
320 The error messages are often unhelpfully terse and tend to refer to
321 line numbers in dgit.
322
323 The option parser requires values to be cuddled to the option name.
324
325 dgit assumes knowledge of the archive layout.  There appears to be no
326 sane way to find the path in the archive pool of the .dsc for a
327 particular suite.  I'm assured that the archive layout is a
328 `well known algorithm' by now.
329
330 --dry-run often does not work with fetch, even though this is a
331 logically plausible request.  (It fails, instead.)