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