File: git-dpm.1

package info (click to toggle)
git-dpm 0.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 508 kB
  • ctags: 93
  • sloc: sh: 4,791; makefile: 72
file content (868 lines) | stat: -rw-r--r-- 30,117 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
.TH GIT-DPM 1 "2010-07-19" "git\-dpm" GIT-DPM
.SH NAME
git\-dpm \- debian packages in git manager
.SH SYNOPSIS
.B git\-dpm \-\-help

.B git\-dpm
[
\fIoptions\fP
]
\fIcommand\fP
[
\fIper\-command\-options and \-arguments\fP
]
.SH DESCRIPTION
Git\-dpm is a tool to handle a debian source package in a git repository.

Each project contains three branches, a debian branch (\fBmaster\fP/\fIwhatever\fP),
a patched branch (\fBpatched\fP/\fBpatched\-\fP\fIwhaterver\fP) and an upstream
branch (\fBupstream\fP/\fBupstream\-\fP\fIwhatever\fP) and \fBgit\-dpm\fP helps
you store the information in there so you have your changes exportable as quilt
series.

Git\-dpm will guess the other two branches based on the branch it sees.
(Most commands act based on the current HEAD, i.e. what branch you have
currently checked out, though some as e.g. \fBstatus\fP allows an optional
argument instead).
So for example, if you are in branch \fBmaster\fP, git\-dpm assumes the
corresponding upstream branch is called \fBupstream\fP.
If you are in branch \fBupstream-something\fP, it assumes the debian branch
is called \fBsomething\fP.

Note that most commands may switch to another branch automatically,
partly because it is easier to implement that way and hopefully so one
does not need to switch branches manually so often.

.SH SHORT EXPLANATION OF THE BRANCHES
.IP "the upstream branch (\fBupstream\fP|\fBupstream\-\fP\fIwhatever\fP)"
This branch contains the upstream sources.
It contents need to be equal enough to the contents in your upstream tarball.

.IP "the patched branch (\fBpatched\fP|\fBpatched\-\fP\fIwhaterver\fP)"
This branch contains your patches to the upstream source.
Every commit will be stored as a single patch in the resulting package.

Most of the time it will not exist as branch known to \fBgit\fP,
but only as some point in the history of the debian branch and
possibly as tag for published versions.
\fBGit\-dpm\fP will create it when needed and remove the
branch when no longer needed.


To help git generate a linear patch series, this should ideal be a
linear chain of commits, whose description are helpful for other people.

As this branch is regulary rebased, you should not publish it.

.IP "the debian branch (\fBmaster\fP|\fP\fIwhaterver\fP)"
This is the primary branch.

This branch contains the \fBdebian/\fP directory and has the patched
branch merged in.

Every change not in \fBdebian/\fP, \fB.git\fP\fI*\fP or deleting files
must be done in the patched branch.

.SH EXAMPLES
Let's start with some examples:

.IP "Checking out a project"
First get the master branch:
 \fBgit clone\fP \fIURL\fP

Then create upstream branch and see if the .orig.tar is ready:
 \fBgit\-dpm prepare\fP

Create the patched branch and check it out:
 \fBgit\-dpm checkout\-patched\fP

Do some changes, apply some patches, commit them..
 \fI...\fP
 \fBgit commit\fP

If your modification fixes a previous change (and that is not the
last commit, otherwise you could have used \-\-amend),
you might want to squash those two commits into one, so use:
 \fBgit rebase \-i upstream\fP

Merge your changes into the debian branch and create patches:
 \fBgit\-dpm update\-patches\fP
 \fBdch \-i\fP
 \fBgit commit \-\-amend \-a\fP

Perhaps change something with the debian package:
 \fI...\fP
 \fBgit commit \-a\fP

Then push the whole thing back:
 \fBgit push\fP

.IP "Switching to a new upstream version"
Get a new .orig.tar file.
Either upgrade your upstream branch to the contents of that file
and call \fBgit\-dpm new\-upstream ../\fP\fInew\-stuff\fP\fB.orig.tar.gz\fP
or tell git\-dpm to import and record it:
 \fBgit\-dpm import\-new\-upstream \-\-rebase ../\fP\fInew\-stuff\fP\fB.orig.tar.gz\fP

This will rebase the patched branch to the new upstream branch,
perhaps you will need to resolve some conflicts:
 \fIvim ...\fP
 \fBgit add\fP \fIresolved files\fP
 \fBgit rebase \-\-continue\fP

After rebase is run (with some luck even in the first try):
 \fBgit\-dpm update\-patches\fP

Record it in debian/changes:
 \fBdch \-v \fP\fInewupstream\fP\fB\-1 "new upstream version"\fP
 \fBgit commit \-\-amend \-a\fP

Do other debian/ changes:
 \fI...\fP
 \fBgit commit \-a\fP

Then push the whole thing back:
 \fBgit push\fP

.IP "Creating a new project"
Create an \fBupstream\fP (or \fBupstream\-\fP\fIwhatever\fP) branch containing
the contents of your orig.tar file:
 \fBtar \-xvf \fP\fIexample\fP\fB\(ul\fP\fI0\fP\fB.orig.tar.gz\fP
 \fBcd \fP\fIexample\fP\fB\-\fP\fI0\fP
 \fBgit init\fP
 \fBgit add .\fP
 \fBgit commit \-m "import \fP\fIexample\fP\fB_\fP\fI0\fP\fB.orig.tar.gz"\fP
 \fBgit checkout \-b upstream\-unstable\fP

You might want to use pristine tar to store your tar:
 \fBpristine\-tar commit ../\fP\fIexample\fP\fB_\fP\fI0\fP\fB.orig.tar.gz upstream\-unstable\fP

Then let git\-dpm know what tarball your upstream branch belongs to:
 \fBgit\-dpm init ../\fP\fIexample\fP\fB_\fP\fI0\fP\fB.orig.tar.gz\fP

Note that since you were in \fBupstream\-unstable\fP in this example,
in the last example \fBgit\-dpm\fP assumed you want your debian branch
called \fBunstable\fP and not \fBmaster\fP, so after the command returned
you are in the newly created \fBunstable\fP branch.

Do the rest of the packaging:
 \fIvim\fP \fBdebian/control debian/rules\fP
 \fBdch \-\-create \-\-package \fP\fIexample\fP\fB \-v \fP\fI0\fP\fB\-1\fP
 \fBgit add debian/control debian/rules debian/changelog\fP
 \fBgit commit \-m "initial packaging"\fP

Then add some patches:
 \fBgit\-dpm checkout\-patched\fP
 \fIvim ...\fP
 \fBgit commit \-a\fP
 \fBgit\-dpm update\-patches\fP
 \fBdch "\fP\fIfix ... (Closes: num)\fP\fB"\fP
 \fBgit commit \-\-amend \-a\fP

The \fBgit\-dpm checkout\-patched\fP created a temporary branch \fBpatched\-unstable\fP
(as you were in a branch called \fPunstable\fP. If you had called it with
HEAD being a branch \fBmaster\fP, it would have been \fBpatched\fP)
to which you added commits.
Then the \fBgit\-dpm update\-patches\fP merged that changes into \fBunstable\fP,
deleted the temporary branch and created new \fBdebian/patches/\fP files.

Then build your package:
 \fBgit\-dpm status &&\fP
 \fB dpkg\-buildpackage \-rfakeroot \-us \-uc \-I".git*"\fP

Not take a look what happened, perhaps you want to add some
files to \fB.gitignore\fP (in the \fBunstable\fP branch),
or remove some files from the \fBunstable\fP branch becaus your clean
rule removes them.

Continue the last few steps until the package is finished.
Then push your package:
 \fBgit\-dpm tag\fP
 \fBgit push \-\-tags \fP\fItarget\fP\fB unstable:unstable pristine\-tar:pristine\-tar\fP

.SH GLOBAL OPTIONS
.TP
.B \-\-debug
Give verbose output what git\-dpm is doing.
Mostly only useful for debugging or when preparing an bug report.

.TP
.B \-\-debug\-git\-calls
Output git invocations to stderr.
(For more complicated debugging cases).

.SH COMMANDS
.TP
.B init \fR[\fP\fIoptions\fP\fR]\fP \fItarfile\fP \fR[\fP\fIupstream-commit\fP \fR[\fP\fIpreapplied-commit\fP \fR[\fP\fIpatched-commit\fP\fR]]]\fP
Create a new project.

The first argument is an upstream tarball.

You also need to have the contents of those (or similar enough so
\fBdpkg\-source\fP will not know the difference) as some branch
or commit in your git repository.
This will be stored in the upstream branch
(called \fBupstream\fP or \fBupstream\-\fP\fIwhatever\fP).
If the second argument is non-existing or empty, that branch must
already exist, otherwise that branch will be initialized with
what that second argument. (It's your responsiblity that the
contents match. git\-dpm does not know what your clean rule does,
so cannot check (and does not even try to warn yet)).

You can already have an debian branch
(called \fBmaster\fP or \fBwhatever\fP).
If it does not exist, it will exist afterwards.
Otherwise it can contain a \fBdebian/patches/series\fP file,
which git\-dpm will import.

The third argument can be a descendant of your upstream branch,
that contains the changes of your debian branch before any patches
are applied (Most people prefer to have none and lintian warns, but
if you have some, commit/cherry pick them in a new branch/detached head
on top of your upstream branch and name them here).
Without \-\-patches\-applied, your debian branch may not have any
upstream changes compared to this commit (or if it is not given,
the upstream branch).

If there is no forth argument, git\-dpm will apply possible patches
in your debian branch on top of the third argument or upstream.
You can also do so yourself and give that as forth argument.

The contents of this commit/branch given in the forth commit or
created by applying patches on top of the third/your upstream branch
is then merged into your debian branch and remembered as patched branch.

Options:
.RS
.TP
.B \-\-patches\-applied
Denote the debian branch already has the patches applied.

Without this git\-dpm will check there are no changes in the
debian branch outside patch management before applying the
patches but instead check there are no differences after
applying the patches.

.TP
.B \-\-create\-no\-patches
Do not create/override \fBdebian/patches\fP directory.
You will have to call \fBupdate\-patches\fP yourself.
Useful if you are importing historical data and keep the
original patches in the debian branch.

.TP
.B \-\-no\-commit
Do not commit the new \fBdebian/.git\-dpm\fP file and
possible \fBdebian/patched\fP changes, but only add them
to working tree and index.
.RE

.TP
.B prepare
Make sure upstream branch and upstream orig.tar ball are there
and up to date.
(Best called after a clone or a pull).

.TP
.B status \fR[\fP\fIbranch\fP\fR]\fP

Check the status of the current project (or of the project
belonging to the argument \fIbranch\fP if that is given).
Returns with non-zero exit code if something to do is detected.

.TP
.B checkout\-patched

Checkout the patched branch (\fBpatched\fP|\fBpatched\-\fP\fIwhaterver\fP)
after making sure it exists and is one recorded in the \fBdebian/.git\-dpm\fP
file.

If the patched branch references an old state (i.e. one that is already
ancestor of the current debian branch), it is changed to the recorded current one.

Otherwise you can reset it to the last recorded state with the \fB\-\-force\fP
option.

.TP
.B update\-patches

After calling \fBmerge\-patched\-into\-debian\fP if necessary,
update the contents of \fBdebian/patches\fP to the current state of the
\fBpatched\fP branch.

Also record in debian/.git\-dpm which state of the patched branch
the patches directory belongs to.

Options:
.RS
.TP
.B \-\-redo
Do something,
even if it seems like there is nothing to do.

.TP
.B \-\-allow\-revert
passed on to merge\-patched\-into\-debian

.TP
.B \-\-amend
Do not create a new commit,
but amend the last one in the debian branch.
(I.e. call merge\-patched\-into\-debian with \-\-amend and
amend the updates patches into the last commit even if that was
not created by merge\-patched\-into\-debian).

.TP
.B \-\-keep\-branch
do not remove an existing patched branch
(usually that is removed and can be recreated with \fBcheckout\-patched\fP
to avoid stale copies lurking around.
.RE

.TP
.B merge\-patched\-into\-debian
Usually \fBupdate\-patches\fP runs this for you if deemed necessary.

Replace the current contents of the
debian branch (\fBmaster\fP|\fIwhaterver\fP)
with the contents of the
patched branch (\fBpatched\fP|\fBpatched\-\fP\fIwhaterver\fP),
except for everything under \fBdebian/\fP.
Also files that are deleted in the debian branch keep being
deleted and files in the root directory starting with ".git"
keep their contents from the debian branch, too.

The current state of the patched branch is recorded in \fBdebian/.git\-dpm\fP
and so is which upstream branch was recorded patched branch is relative to
(to easy future merge\-patched\-into\-debian operations).

Options:
.RS
.TP
.B \-\-allow\-revert
Usually reverting to an old state of the patched
branch is not allowed, to avoid mistakes (like having only pulled the
debian branch and forgot to run \fBcheckout\-patched\fP).
This option changes that
so you can for example drop the last patch in your stack.

.TP
.B \-\-keep\-branch
do not remove an existing patched branch
(usually that is removed and can be recreated with \fBcheckout\-patched\fP
to avoid stale copies lurking around).

.TP
.B \-\-amend
Replace the last commit on your debian branch (as git commit \-\-amend would do).
With the exception that every parent that is an ancestor of or equal to
the new patched branch or the recorded patched branch is omitted.
(That is, you lose not only the commit on the debian branch, but also a previous
state of the patched branch if your last commit also merged the patched branch).
.RE

.TP
.B import\-new\-upstream \fR[\fIoptions\fR]\fP \fI.orig.tar\fP
Import the contents of the given tarfile (as with \fBimport\-tar\fP)
and record this branch (as with \fBnew\-upstream\fP).

This is roughly equivalent to:
 \fBgit\-dpm import\-tar \-p \fP\fIupstream\fP \fIfilename\fP
 \fBgit checkout \-b \fP\fIupstream\fP
 \fBgit\-dpm new\-upstream \fP\fIfilename\fP

.RS
.TP
.B \-\-detached
Don't make the new upstream branch an ancestor of the old upstream
branch (unless you readd that with \fB\-p\fP).
.TP
.B \-p \fIcommit-id\fP\fR|\fP\-\-parent \fIcommit-id\fP
Give \fBimport\-tar\fP additional parents of the new commit to create.

For example if you track upstream's git repository in some branch,
you can name that here to make it part of the history of your debian branch.
.TP
.B \-\-rebase\-patched
After recording the new upstream branch,
rebase the patched branch to the new upstream branch.
.RE

.TP
.B import\-tar \fR[\fIoptions\fR]\fP \fI.tar-file\fP
Create a new commit containing the contents of the given file.
The commit will not have any parents, unless you give \fB\-p\fP options.

.RS
.TP
.B \-p \fIcommit-id\fP\fR|\fP\-\-parent \fIcommit-id\fP
Add the given commit as parent.
(Can be specified multiple times).

.TP
.B \-m \fImessage\fP
Do not start an editor for the commit message,
but use the argument instead.
.RE

.TP
.B new\-upstream \fR[\fP\-\-rebase\-patched\fR]\fP \fI.orig.tar\fP \fR[\fP\fIcommit\fP\fR]\fP

If you changed the
upstream branch (\fBupstream\fP|\fBupstream\-\fP\fIwhatever\fP),
git\-dpm needs to know which tarball this branch now corresponds
to and you have to rebase your
patched branch (\fBpatched\fP|\fBpatched\-\fP\fIwhaterver\fP)
to the new upstream branch.

If there is a second argument, this command first replaces
your upstream branch with the specified commit.

Then the new upstream branch is recorded in your debian branch's \fBdebian/.git\-dpm\fP
file.

If you specified \fB\-\-rebase\-patched\fP (or short \fB\-\-rebase\fP),
\fB git\-dpm rebase\-patched\fP will be called to rebase your patched branch
on top of the new upstream branch.

After this (and if the branch then looks like what you want),
you still need to call \fBgit\-dpm merge\-patched\-into\-debian\fP
(or directly \fBgit\-dpm update\-patches\fP).

\fBWARNING\fP to avoid any misunderstandings:
You have to change the upstream branch before using this command.
It's your responsibility to ensure the contents of the tarball match
those of the upstream branch.

.TP
.B rebase\-patched
Try to rebase your
current patched branch (\fBpatched\fP|\fBpatched\-\fP\fIwhaterver\fP)
to your current
current upstream branch (\fBupstream\fP|\fBupstream\-\fP\fIwhatever\fP).

If those branches do not yet exist as git branches, they are (re)created
from the information recorded in \fBdebian/.git\-dpm\fP first.

This is only a convenience wrapper around git rebase that first tries
to determine what exactly is to rebase.
If there are any conflicts, git rebase will ask you to resolv them
and tell rebase to continue.

After this is finished (and if the branch then looks like what you want),
you still need \fBmerge\-patched\-into\-debian\fP
(or directly \fBupdate\-patches\fP).

.TP
.B tag \fR[\fP \fIversion\fP \fR]\fP
Add tags to the uptream, patched and debian branches.
If no version is given, it is taken from debian/changelog.

Options:
.RS
.TP
.B \-\-refresh
Overwrite the tags if they are already there and differ (except upstream).

.TP
.B \-\-refresh\-upstream
Overwrite the upstream if that is there and differs.

.TP
.B \-\-allow\-nonclean
Don't error out if patches are not up to date.
This is only useful if you are importing historical data
and want to tag it.
.RE

.TP
.B apply\-patch \fR[\fP \fIoptions...\fP \fR]\fP \fR[\fP \fIfilename\fP \fR]\fP
Switch to the patched branch (assuming it is up to date,
use checkout\-patched first to make sure or get an warning),
and apply the patch given as argument or from stdin.


.RS
.TP
.B \-\-author "\fIauthor <email>\fP"
Override the author to be recorded.

.TP
.B \-\-defaultauthor "\fIauthor <email>\fP"
If no author could be determined from the commit,
use this.

.TP
.B \-\-date "\fIdate\fP"
Date to record this patch originally be from if non found.

.TP
.B \-\-dpatch
Parse patch as dpatch patch
(Only works for dpatch patches actually being a patch, might silently fail for others).

.TP
.B \-\-cdbs
Parse patch as cdbs simple\-patchsys.mk patch
(Only works for dpatch patches actually being a patch, might silently fail for others).

.TP
.B \-\-edit
Start an editor before doing the commit (In case you are too lazy to amend).
.RE

.TP
.B cherry\-pick \fR[\fP \fIoptions...\fP \fR]\fP \fIcommit\fP
Recreate the patched branch and cherry\-pick the given commit.
Then merge that back into the debian branch and update the debian/patches
directory (i.e. mostly equivalent to checkout\-patched, git's cherry\-pick,
and update\-patches).

.RS
.TP
.B \-\-merge\-only
Only merge the patched branch back into the debian branch but do not
update the patches directory (You'll need to run update\-patches later
to get this done).

.TP
.B \-e \fR|\fP \-\-edit
Passed to git's cherry\-pick: edit the commit message picked.

.TP
.B \-s \fR|\fP \-\-signoff
Passed to git's cherry\-pick: add a Signed\-off\-by header

.TP
.B \-x
Passed to git's cherry\-pick: add a line describing what was picked

.TP
.B \-m \fInum\fP \fR|\fP \-\-mainline \fInum\fP
Passed to git's cherry\-pick:
allow picking a merge by specifign the parent to look at.

.TP
.B \-\-repick
Don't abort if the specified commit is already contained.

.TP
.B \-\-allow\-nonlinear
passed to merge\-patched\-into\-debian and update\-patches.

.TP
.B \-\-keep\-branch
do not remove the patched branch when it is no longer needed.

.TP
.B \-\-amend
passed to merge\-patched\-into\-debian:
amend the last commit in the debian branch.
.RE

.TP
.B import\-dsc
Import a debian source package from a .dsc file.
This can be used to create a new project or to import a source package
into an existing project.

While a possible old state of a project is recorded as parent commit,
the state of the old debian branch is not taken into account.
Especially all file deletions and .gitignore files and the like need
to be reapplied/readded afterwards.
(Assumption is that new source package versions from outside might change
stuff significantly, so old information might more likely be outdated.
And reapplying it is easier then reverting such changes.)

First step is importing the \fB.orig.tar\fP file.
You can either specify a branch to use.
Otherwise \fBimport\-dsc\fP will look if the previous state of this project
already has the needed file so the old upstream branch can be reused.
If there is non, the file will be imported as a new commit,
by default with a possible previous upstream branch as parent.

Then \fBimport\-dsc\fP will try to import the source package in the state
as \fBdpkg\-source \-x\fP would create it.
(That is applying the .diff and making \fBdebian/rules\fP executeable for
1.0 format packages and replacing the \fBdebian\fP directory with the
contents of a .debian.tar and applying possible \fBdebian/patches/series\fP
for 3.0 format packages).
This is later referred to as verbatim import.

If it is a 1.0 source format package, \fBimport\-dsc\fP then looks for
a set of supported patch systems and tries to apply those patches.
Those are then merged with the verbatim state into the new debian branch.

Then a \fBdebian/.git\-dpm\fP file is created and a possible old state of
the project added as parent.

Note that \fBdpkg\-source\fP is not used to extract packages,
but they are extracted manually.
Especially \fBgit\-apply\fP is used instead of \fBpatch\fP.
While this generally works (and \fBgit\-dpm\fP has some magic to
work around some of \fBgit\-apply\fP's shortcomings),
unclean patches might sometimes need a \fB\-C0\fP option and then
in same cases be applied at different positions than where \fBpatch\fP
would apply them.

General options:
.RS
.TP
.B \-b \fR|\fP \-\-branch \fIbranch-name\fP
Don't look at the current HEAD, but import the package into the git\-dpm
project \fIbranchname\fP or create a new project (if that branch does not
yet exist).

.TP
.B \-\-verbatim \fIbranch-name\fP
After \fBimport\-dsc\fP has completed successfully, \fIbranch-name\fP will
contain the verbatim import of the .dsc file.
If a branch of that name already exists, the new verbatim commit will also
have the old as parent.
(This also causes the verbatim commit not being amended with other changes,
which can result in more commits).
.RE

.RS
Options about creating the upstream branch:
.TP
.B \-\-upstream\-to\-use \fIcommit\fP
Do not import the .orig.tar nor try to reuse an old import,
but always use the \fIcommit\fP specified.

It is your responsibility that this branch is
similar enough to the .orig.tar file in question.
(As usual, similar enough means:
Does not miss any files that your patches touch or your build process requires
(or recreates unless \fBdebian/rules clean\fP removes them again).
Every file different than in .orig.tar or not existing there you must delete
in the resulting debian branch. No patch may touch those files.)

Use with care.
Nothing will warn you even if you use the contents of a totally
wrong upstream version.

.TP
.B \-\-detached\-upstream
If importing a .orig.tar as new commit,
do not make an possible commit for an old upstream version parent.

.TP
.B \-\-upstream\-parent \fIcommit\fP
Add \fIcommit\fP as (additional) parent if importing a new upstream version.

(This can for example be used to make upstream's git history part of your
package's history and thus help git when cherry-picking stuff).
.RE

.RS
Options about applying patches:
.TP
.B \-f \fR|\fP \-\-force\-commit\-reuse
Only look at parent and tree and no longer at the description
when trying to reuse commits importing patches from
previous package versions.

.TP
.B \-C\fInum\fP \fR|\fP \-\-patch\-context \fInum\fP
Passed as \fB\-C\fP\fInum\fP to \fBgit\-apply\fP.
Specifies the number of context lines that must match.

.TP
.B \-\-dpatch\-allow\-empty
Do not error out if a dpatch file does not change anything
when treated as patch.

As dpatch files can be arbitrary scripts, \fBgit\-dpm\fP has
some problems detecting if they are really patches.
(It can only cope with patches).
If a script that is not a patch is treated as patch
that usually results in patch not modify anything,
thus those are forbidden without this option.

.TP
.B \-\-patch\-system \fImode\fP
Specify what patch system is used for source format 1.0 packages.
.RS
.TP
.B auto \fR(this is the default)\fP
Try to determine what patch system is used by looking at \fBdebian/rules\fP
(and \fBdebian/control\fP).
.TP
.B none
Those are not the patches you are looking for.
.TP
.B history
Don't try to find any patches in the .diff (like \fBnone\fP).
If if the project already exists and the upstream tarball is the same,
create the patched state of the new one by using the patches of the old
one and adding a patch of top bringing it to the new state.

If you import multiple revisions of some package, where each new
revision added at most a single change to upstream, this option allows you
to almost automatically create a proper set of patches (ideally only missing
descriptions).

If there are same changes and reverts those will be visibile in the patches
created, so this mode is not very useful in that case.

.TP
.B quilt
Extract and apply a \fBdebian/patches/series\fP quilt like series on top
of possible upstream changes found in the .diff file.

.TP
.B quilt\-first
As the \fBquilt\fP mode, but apply the patches to an unmodified upstream
first and then cherry\-pick the changes found in the .diff file.

As this is not the order in which patches are applied in a normal
unpack/build cycle, this will fail if those changes are not distinct enough
(for example when patches depend on changes done in the .diff).

But if the .diff only contains unrelated changes which varies with each
version, this gives a much nicer history, as the commits for the patches
can more easily be reused.

.TP
.B quilt\-applied
As the \fBquilt\-first\fP mode, but assume the patches are already applied
in the .diff, so apply them on top of an unmodified upstream and then add
a commit bringing it to the state in the .diff.
(Or not if that patch would be empty).

.TP
.B dpatch \fR|\fP dpatch\-first \fR|\fP dpatch\-applied
Like the \fBquilt\fP resp. \fBquilt\-first\fP resp. \fBquilt\-applied\fP modes,
but instead look for dpatch-style patches in \fBdebian/patches/00list\fP.

Note that only patches are supported and not dpatch running other commands.

.TP
.B simple \fR|\fP simple\-first \fR|\fP simple\-applied
Like the \fBquilt\fP resp. \fBquilt\-first\fP resp. \fBquilt\-applied\fP modes,
but instead assume \fBdebian/patches/\fP contains patches suiteable for
cdbs's \fBsimple\-patchsys.mk\fP.

.RE
.TP
.B \-\-patch\-author \fR"\fP\fIname \fP\fR<\fP\fIemail\fP\fR>\fP\fR"\fP
Set the author for all git commits importing patches.
.TP
.B \-\-patch\-default\-author \fR"\fP\fIname \fP\fR<\fP\fIemail\fP\fR>\fP\fR"\fP
Set an author for all patches not containing author information
(or where \fBgit\-dpm\fP cannot determine it).
.TP
.B \-\-edit\-patches
For every patch imported, start an editor for the commit message.
.RE

.SH the debian/.git\-dpm file
You should not need to know about the contents if this file except for
debuging git\-dpm.

The file contains 8 lines, but future version may contain more.

The first line is hint what this file is about and ignored.

Then there are 4 git commit ids for the recorded states:

.RS
First the state of the patched branch when the patches in \fBdebian/patches\fP
were last updated.

Then the state of the patched branch when it was last merged into the
debian branch.

Then the state upstream branch when the patched branch was last merged.

Finally the upstream branch.
.RE

The following 3 lines are the filename, the sha1 checksum and the size
of the origtarball belonging to the recorded upstream branch.

.SH SHORTCUTS
Most commands also have shorter aliases, to avoid typing:

 update\-patches:	up, u\-p, ci
 prepare:	prep
 checkout\-patched:	co, c\-p
 r ebase\-patched:	r\-p
 new\-upstream\-branch:	new\-upstream, n\-u
 apply\-patch:	a\-p
 import\-tar:	i\-t
 import\-new\-upstream:	i\-n\-u, inu
 cherry\-pick:	c\-p

.SH BRANCHES
.IP "the upstream branch (\fBupstream\fP|\fBupstream\-\fP\fIwhatever\fP)"
This branch contains the upstream sources.
It contents need to be equal enough to the contents in your upstream tarball.

Equal enough means that dpkg\-source should see no difference between your
patched tree and and original tarball unpackaged, the patched applied and
\fBdebian/rules clean\fP run.
Usually it is easiest to just store the verbatim
contents of your orig tarball here.
Then you can also use it for pristine tar.

This branch may contain a debian/ subdirectory, which will usually be just ignored.

You can either publish that branch or make it only implicitly visible via the
\fBdebian/.git\-dpm\fP file in the debian branch.

While it usually makes sense that newer upstream branches contain older ones,
this is not needed.
You should be able to switch from one created yourself
or by some foreign-vcs importing tool generated one to an native upstream
branch or vice versa without problems.
Note that since the debian branch has the patched branch as ancestor
and the patched branch the upstream branch, your upstream branches are part
of the history of your debian branch.
Which has the advantage that you
can recreate the exact state of your branches from your history directly
(like \fBgit checkout \-b oldstate \fP\fImyoldtagorshaofdebianbranchcommit\fP\fB ; git\-dpm prepare ; git checkout unstable\-oldstate\fP)
but the disadvantage that to remove those histories from your repository you
have to do some manual work.

.IP "the patched branch (\fBpatched\fP|\fBpatched\-\fP\fIwhaterver\fP)"
This branch contains your patches to the upstream source.
(which of course means it is based on your upstream branch).

Every commit will be stored as a single patch in the resulting package.

To help git generate a linear patch series, this should ideal be a
linear chain of commits, whose description are helpful for other people.

As this branch is regulary rebased, you should not publish it.
Instead you can recreate this branch using \fBgit\-dpm checkout\-patched\fP
using the information stored in \fBdebian/.git\-dpm\fP.

You are not allowed to change the contents of the \fBdebian/\fP subdirectory
in this branch.
Renaming files or deleting files usuall causes unecesary large
patches.

.IP "the debian branch (\fBmaster\fP|\fIwhaterver\fP)"
This is the primary branch.

This branch contains the \fBdebian/\fP directory and has the patched
branch merged in.

Every change not in \fBdebian/\fP, \fB.git\fP\fI*\fP or deleting files
must be done in the patched branch.

.SH COPYRIGHT
Copyright \(co 2009,2010 Bernhard R. Link
.br
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

.SH "REPORTING BUGS AND ISSUES"
You can report bugs or feature suggestions to
gi\t-dpm\-devel@lists.alioth.debian.org or tome.
Please send questions to git\-dpm\-user@lists.alioth.debian.org or to me
at brlink@debian.org.