.TH GIT-DPM 1 "2012-05-15" "git\-dpm" GIT-DPM \" I don't want hyphen (U+2010), nor minus (U+2212), but hyphen-minus(U+002D) .char \- \N'45' .char - \N'45' \" some for "'" .char ' \N'39' .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\fIwhatever\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. Its contents need to be equal enough to the contents in your upstream tarball. .IP "the patched branch (\fBpatched\fP|\fBpatched\-\fP\fIwhatever\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 a 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 regularly rebased, you should not publish it. .IP "the Debian branch (\fBmaster\fP|\fP\fIwhatever\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 Then you want to get those changes into the Debian branch and the new patch files created (which you can do using \fBgit\-dpm update\-patches\fP), but you most likely want to also document what you did in the changelog, so all in one step: \fBgit\-dpm dch \-\- \-i\fP Perhaps change something in the Debian packaging: \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 record\-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 dch \-\- \-v \fP\fInewupstream\fP\fB\-1 "new upstream version"\fP You could have also done the last step in three by: \fBgit\-dpm update\-patches\fP \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 dch "\fP\fIfix ... (Closes: num)\fP\fB"\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 implied by \fBgit\-dpm dch\fP merged those 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 Now 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 because 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 .IP "Removing existing patches" First get the master branch: \fBgit clone\fP \fIURL\fP Create the patched branch and check it out: \fBgit\-dpm checkout\-patched\fP Get a list of commits since the last upstream release: \fBgit rebase \-i upstream\-unstable\fP This will open your default editor with a list of commits. Edit the list to remove undesired commits. \fI...\fP \fBgit commit\fP Then you want to get those changes into the Debian branch and the old patch files deleted (which you can do using \fBgit\-dpm update\-patches\fP), but you most likely want to also document what you did in the changelog, so all in one step: \fBgit\-dpm dch \-\- \-i\fP Perhaps change something in the Debian packaging: \fI...\fP \fBgit commit \-a\fP Then push the whole thing back: \fBgit push\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). .TP .B \-\-allow\-changes\-in\-debian\-branch Ignore upstream changes in your Debian branch. This will either discard them if merge\-patched is called by come command or them being ignored elsewhere. .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 that file and the files given with \-\-component unpackaged as some branch or commit in your git repository (or similar enough so \fBdpkg\-source\fP will not know the difference). 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 responsibility 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 fourth 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 fourth argument. The contents of this commit/branch given in the fourth 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 \-\-component \fIfilename\fP Record a \fB.orig\-\fP\fIcomponent\fP\fB.tar\fP file to be unpacked in your upstream branch. .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; with this, it will 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 \-\-record\-patch\-category Add a \fBPatch-Category:\fP field to each imported patch that is in a subdirectory of \fBdebian/patches\fP. This causes \fBupdate\-patches\fP to store it in the same subdirectory. .TP .B \-\-record\-patch\-name Add a \fBPatch-Name:\fP field to each imported patch with its name. This causes \fBupdate\-patches\fP to store it under its original name. .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\fIwhatever\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 \fR[\fP\fIoptions\fP\fR] [\fP\fIbranch-name\fP\fR]\fP 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. If a \fIbranch-name\fP is given, that branch is processed. Otherwise the name is derived from the currently checked out branch as usual. Options: .RS .TP .B \-\-redo Do something, even if it seems like there is nothing to do. .TP .BR \-\-allow\-revert ", " \-\-ignore\-deletions ", " \-\-dot\-git\-files=\fI*\fP 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 \-m \fImessage\fP Use \fImessage\fP as commit message. (If used together with \-\-amend, do not reuse old commit message, author or author date but replace the old commit with a new commit with that message). .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 \-\-allow\-nonlinear passed to merge\-patched. .RE .TP .B dch \fR[\fP\fIoptions\fP\fR]\fP \-\- \fIdch-options\fP After calling update\-patches if necessary, run devscripts' dch with the specified options and then do a \fBgit commit\fP with a commit message containing changes to the \fBdebian/changelog\fP file. Options: .RS .TP .B \-\-amend Replace the commit currently the head of the Debian branch (\fBmaster\fP|\fIsomething\fP) instead of creating a new one on top. The commit message will also include changes done to \fBdebian/changelog\fP in the previous commit (unless reverted by the new edit). .TP .B \-\-ignore\-patches Do not call update\-patches but simply ignore the current state of the patched branch (\fBpatched\fP|\fBpatched\-\fP\fIsomething\fP). .TP .BR \-\-keep\-branch ", " \-\-allow\-revert ", " \-\-allow\-nonlinear ", " \-\-ignore\-deletions ", " \-\-dot\-git\-files=\fI*\fP Passed to update\-patches, if called. .TP .BR \-\-latest\-only | \-\-latest | \-l Only include changes between the current working directory before calling dch and after calling it (and not since the last commit or the last commit not replaced). .TP .BR \-e " | " \-v " | " \-a " | " \-\-all " | " \-s " | " \-n " | " \-\-no\-verify " | " \-u " | " \-\-untracked\-files " | " \-q " | " \-\-quiet " | " \-\-cleanup=\fI...\fP " | " \-\-author=\fI...\fP passed to git commit. .RE .TP .B merge\-patched\-into\-debian \fR[\fP\fIoptions\fP\fR] [\fR\fIbranch-name\fP\fR]\fP Usually \fBupdate\-patches\fP runs this for you if deemed necessary. This command is the core of \fBgit\-dpm\fP, but you usually do not call it directly. It is called by \fBupdate\-patches\fP and things calling \fBupdate\-patches\fP like \fBdch\fP when necessary. It replaces all files (with only the exceptions described below) in the current Debian branch (\fBmaster\fP|\fIwhatever\fP) with those found in the patched branch (\fBpatched\fP|\fBpatched\-\fP\fIwhatever\fP). Only the \fBdebian\fP directory and files in the root directory starting with ".git" are kept from the Debian branch (so \fB.gitignore\fP, \fB.gitattributes\fP, ... will stay). And all files that were found in the last recorded patched branch and deleted in the current Debian branch will also be deleted in the new one. Additionally the \fBdebian/.git\-dpm\fP file will be updated so the current patched branch is recorded and is marked as belonging to the last recorded upstream branch. If there is no \fIbranch-name\fP given on the command line the base name of the branches to operate on is computed from the currently checked out branch as usual. Otherwise this argument is used. 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 .BR \-\-no\-ignore\-deletions " (default)" Files deleted currently in the Debian branch relative to the recorded patched branch will still be deleted in the new Debian branch and not taken from the new patched branch. This is the default unless a different default was set with \fBgit config dpm.\fP\fIBRANCHNAME\fP\fB.dpmIgnoreDeletions true\fP. .TP .B \-\-ignore\-deletions Disable the behavior described in \fB\-\-no\-ignore\-deletions\fP. .TP .BI \-\-dot\-git\-files= method Specify how files starting with \fB.git\fP outside \fBdebian/\fP are handled. Those are handles specially as \fB.gitattributes\fP and \fB.gitignore\fP might be different in the Debian branch without being part of any patch. (The whole \fBdebian/\fP directory is always taken from the Debian branch, so files there are not affected). Possible methods are: .RS .TP .BR automatic " (default)" Any \fB.git\fP\fI*\fP files that are added, modified or removed in the current Debian branch compared to the old upstream branch are set to this state, everything else is taken as found in the new patched branch. .TP .B debian All \fB.git\fP\fI*\fP files are taken from the Debian branch. Files with a name like that from the patched branch are ignored. .TP .B upstream Files starting with \fB.git\fP are not given special handling. They are taken from the patched branch, unless they are deleted in the Debian branch and the default \fB\-\-no\-ignore\-deletions\fP is active. (i.e. just like any other file outside \fBdebian/\fP). .RE .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). .TP .BI \-m " message" Commit message to use for the new commit created. (If used together with \-\-amend, this disables reusing the old author and date). .TP .B \-\-allow\-nonlinear do not abort with an error if the patched branch is no linear series of commits on top of the upstream branch. Using this option is not recommended as it easily hides problems with patched or upstream branch and may introduce broken debian/patches/ series, as format-patch does no serialisation. .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 \fBrecord\-new\-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 record\-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 re-add 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 \-\-allow\-no\-parent If dpm.importWithoutParent is set to false via git config, git\-dpm will not allow import\-new\-upstream to be run without this option or at least on \-p option. .TP .B \-\-rebase\-patched After recording the new upstream branch, rebase the patched branch to the new upstream branch. .TP .B \-\-no\-rebase\-patched Do not call rebase\-patched after recording the new upstream branch. (This is currently the default, but that may change in the future). .TP .B \-m \fImessage\fP Commit message to use for the new commit to the Debian branch recording the new file and upstream branch. .TP .B \-\-component \fIpackage\fP_\fIversion\fP.orig\-\fIcomponent\fP.tar\fI.gz\fP Unpack the specified filename into the \fIcomponent\fP directory and record it so that \fBprepare\fP and \fBstatus\fP know to check for it. .TP .B \-\-init None of the branches yet exists, create them. As the branches to operate on are derived from \fBHEAD\fP if no \fB\-\-branch\fP option is given, you either need \fBHEAD\fP point to an not yet existing branch (like directly after \fBgit init\fP) or you need you give a name with \fB\-\-branch\fP. Otherwise one of the branches already exists and you only get an error message. .TP .B \-\-branch \fIdebianbranch\fP Don't derive the Debian branch name from current \fBHEAD\fP but use \fIdebianbranch\fP instead. (And upstream branch name and patched branch name derived from that as usual). .TP .B \-\-pristine\-tar\-commit \fR|\fP \-\-ptc Call \fBpristine\-tar commit\fP for all imported tarballs not yet found in the pristine\-tar branch. .TP .B \-\-no\-pristine\-tar\-commit Do not call \fBpristine\-tar commit\fP for all imported tarballs even if configured to do so by \fBgit config dpm.pristineTarCommit true\fP or by \fBgit config branch.\fPdebianbranch\fB.dpmPristineTarCommit true\fP. .TP .BR \-\-ignore\-deletions ", " \-\-dot\-git\-files= Passed to merge\-patched, if called (only done if there were no patches previously). .TP .B \-\-upstream\-author \fIauthor\fP Used as the \fB\-\-author\fP argument to \fBgit\-dpm import\-tar\fP. .TP .B \-\-upstream\-date \fIdate\fP Used as the \fB\-\-date\fP argument to \fBgit\-dpm import\-tar\fP (especially \fBauto\fP is supported to extract a date from the tar file). .TP .B \-\-exclude \fIpattern\fP The given pattern is passed to tar as exclude pattern when unpacking. Can be given multiple times. .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 \-\-branch \fIbranchname\fP\fR Create new branch \fIbranchname\fP if it does not already exist or replace \fIbranchname\fP with a commit created from the tarball with the current \fIbranchname\fP head as parent. .TP .B \-m \fImessage\fP Do not start an editor for the commit message, but use the argument instead. .TP .B \-\-date \fIdate\fP Date of the commit to create. If the value is \fBauto\fP then the newest date of any file or directory in the tarball is used. .TP .B \-\-author \fIauthor\fP Author of the commit to create. It has to be in the usual git format \fIauthor\fP \fB<\fP\fIemail\fP\fB>\fP. .TP .B \-\-exclude \fIpattern\fP The given pattern is passed to tar as exclude pattern when unpacking. Can be given multiple times. .RE .TP .B record\-new\-upstream \fR[\fP\fIoptions\fP\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\fIwhatever\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), \fBgit\-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. .RS .TP .B \-\-rebase\-patched Automatically call \fBgit\-dpm rebase\-patched\fP. .TP .B \-\-new\-tarball\-only Don't refuse operation if the tarball changes but the upstream branch did not. (This is only sensible if the tarball changed without changing its contents, see the warning above). .TP .B \-m \fImessage\fP Commit message to use for the new commit to the Debian branch recording the new file and upstream branch. .TP .B \-\-amend Replace the last commit instead of creating a new one on top. .TP .B \-\-component \fIfilename\fP Record \fIfilename\fP as needed component source file (i.e. a \fIsourcename\fP\fB_\fP\fIupstreamversion\fP\fB.orig\-\fP\fIcomponent\fP\fB.tar.\fP\fIcompression\fP file). It's your responsible to have that file's contents already as part of your upstream branch (in a \fIcomponent\fP subdirectory). (Recorded files will be looked for by \fBstatus\fP and \fBprepare\fP. The list of recorded component source files is removed when a new upstream branch or upstream \fB.orig\fP source file is recorded). .TP .BR \-\-ignore\-deletions ", " \-\-\dot\-git\-files= Passed to merge\-patched, if called (which is only done if there were no patches previously, so the new upstream branch is merged in directly). .RE .TP .B rebase\-patched Try to rebase your current patched branch (\fBpatched\fP|\fBpatched\-\fP\fIwhatever\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 resolve 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 \fIoptions\fP \fR]\fP \fR[\fP \fIversion\fP \fR]\fP Add tags to the upstream, 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\-stale\-patches 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. .TP .B \-\-named Use the package name as part of the names of the generated tags. (use \fBgit config dpm.tagsNamed true\fP to make this the default) .TP .B \-\-with\-name \fIname\fP Like \fB\-\-named\fP but give the name to use. .TP .B \-\-debian\-tag \fItag-name\fP .TP .B \-\-patched\-tag \fItag-name\fP .TP .B \-\-upstream\-tag \fItag-name\fP Specify the names of the tags to generate. .RS .HP \fB%p\fP is replaced with the package name, .HP \fB%v\fP with the version (without epoch) with colons (:) and tilde (~) replaced by underscore (_), .HP \fB%u\fP with the upstream version (without epoch or Debian revision) with colons (:) and tilde (~) replaced by underscore (_), .HP \fB%e\fP with the epoch, .HP \fB%f\fP with the epoch followed by an underscore (_) if there is an epoch, and with the empty string if there is no epoch, .HP \fB%V\fP with the version (without epoch) with colons (:) and tilde (~) replaced by dots (.), .HP \fB%U\fP with the upstream version (without epoch or Debian revision) with colons (:) and tilde (~) replaced with dots (.), .HP \fB%E\fP with the epoch followed by a dot if there is an epoch, and with the empty string if there is no epoch, .HP \fB%%\fP with a single \fB%\fP. .RE If one of those is not set via the command line option, \fBgit config\fP is asked about value of \fBdpm.debianTag\fP, \fBdpm.patchedTag\fP or \fBdpm.upstreamTag\fP. If that is also not set or the special value \fBAUTO\fP, then debian/.git-dpm is scanned for a line of the form \fBdebianTag="\fP\fIvalue\fP\fB"\fP, \fBpatchedTag="\fP\fIvalue\fP\fB"\fP or \fBupstreamTag="\fP\fIvalue\fP\fB"\fP. (Note: always add those to the end of the file, the first eight lines have fixed line numbers) If this still does not result in an pattern to use, the defaults are '\fB%p\-debian%e\-%v\fP', '\fB%p\-patched%e\-%v\fP' and '\fB%p\-upstream%e\-%u\fP' with \fB\-\-named\fP and '\fBdebian%e\-%v\fP', '\fBpatched%e\-%v\fP' and '\fBupstream%e\-%u\fP' without. If a tag name has the special value \fBNONE\fP, no tag is generated. .RE .TP .B ref\-tag \fR[ \fP\fIoptions\fP \fR]\fP \fIcommit\fP \fR[\fP \fIversion\fP \fR]\fP Like \fBtag\fP, but create tags for \fIcommit\fP, i.e. \fIcommit\fP will get the Debian tag and the other tags are placed where the \fBdebian/.git\-dpm\fP file of that commit points to. So it is mostly equivalent to: \fBgit checkout \-b temp \fP\fIcommit\fP \fBgit\-dpm tag \fR[\fP\fIoptions\fP\fR]\fP \fP\fR[\fP\fIversion\fP\fR]\fP \fBgit checkout \fP\fIprevious-head\fP \fBgit branch \-D temp\fP Options like \fBtag\fP. .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 \fP" Override the author to be recorded. .TP .B \-\-defaultauthor "\fIauthor \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). .TP .B \-\-record\-name Add a \fBPatch-Name:\fP field to tell \fBupdate\-patches\fP to export it with the same name again. .TP .B \-\-name \fIname\fP Add a \fBPatch\-Name:\fP field to tell \fBupdate\-patches\fP to use \fIname\fP as filename to store this patch into (relative to \fBdebian/patches\fP). .TP .B \-\-category \fIname\fP Add a \fBPatch\-Category:\fP field to tell \fBupdate\-patches\fP to always export this patch into a subdirectory \fIname\fP of \fBdebian/patches\fP. .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 specifying the parent to look at. .TP .B \-\-repick Don't abort if the specified commit is already contained. .TP .BR \-\-allow\-nonlinear ", " \-\-ignore\-deletions ", " \-\-dot\-git\-files= Passed to update\-patches, if called. 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/re-added 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 and possible \fB.orig\-\fP\fIcomponent\fP\fB.tar\fP files. 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 executable 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). .TP .B \-\-use\-changelog Parse debian/changelog of the imported package. Use the description as commit messages and the author and time as default for patches and import commits without that information. (Warning: may still contain some rough edges). .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 plus possible .orig\-component.tar in their respective directories. (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). .TP .B \-\-allow\-no\-parent If dpm.importWithoutParent is set to false via git config, git\-dpm will not allow import\-dsc to be run without this option or at least on \-\-upstream\-parent option. .TP .B \-\-pristine\-tar\-commit \fR|\fP\-\-ptc Call \fBpristine\-tar commit\fP for all tarballs imported after the rest of the import\-dsc command was successful. .TP .B \-\-no\-pristine\-tar\-commit Do not call \fBpristine\-tar commit\fP for all imported tarballs even if configured to do so by \fBgit config dpm.pristineTarCommit true\fP or by \fBgit config branch.\fPdebianbranch\fB.dpmPristineTarCommit true\fP. .TP .B \-\-upstream\-author \fIauthor\fP Used as the \fB\-\-author\fP argument to \fBgit\-dpm import\-tar\fP. .TP .B \-\-upstream\-date \fIdate\fP Used as the \fB\-\-date\fP argument to \fBgit\-dpm import\-tar\fP (especially \fBauto\fP is supported to extract a date from the tar file). .TP .B \-\-tar-exclude \fIpattern\fP The given pattern is passed to tar as exclude pattern when unpacking tarfiles. Can be given multiple times. .RE .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 visible 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 suitable 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. .TP .B \-\-record\-patch\-category Add a \fBPatch\-Category:\fP field to each imported patch that is in a subdirectory of \fBdebian/patches\fP. This causes \fBupdate\-patches\fP to store it in the same subdirectory. .TP .B \-\-record\-patch\-name Add a \fBPatch\-Name:\fP field to each imported patch with its name. This causes \fBupdate\-patches\fP to store it under its original name. .RE .TP .B record\-dsc \fR[\fP\fIoptions\fP\fR]\fP \fIcommit\fP \fI.dsc-file\fP Store a pristine .dsc file in a \fBdscs\fP branch after storing the files it contains using pristine\-tar. The first argument is an tag or commit storing the \fBgit\-dpm\fP project in the state belonging to the \fB.dsc\fP file and the second argument is the \fB.dsc\fP file itself. The files it references are expected in the same directory as the file itself (if they are needed). Some checks are done to make sure the file and its contents are named properly and match the commit in question, but only cursory to avoid obvious mistakes (for example only the version is checked, but .debian.tar is not unpacked to check the files are really the same, for example). Options: .RS .TP .B \-\-create\-branch Create a new \fBdscs\fP branch. .TP .B \-\-allow\-unsigned Allow recording a unsigned \fB.dsc\fP file. This usually defeats the point of storing them at all. .RE .SH the debian/.git\-dpm file You should not need to know about the contents if this file except for debugging 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 rebase\-patched: r\-p apply\-patch: a\-p import\-tar: i\-t import\-new\-upstream: i\-n\-u, inu record\-new\-upstream: r\-n\-u, rnu merge\-patched\-in\-debian: merge\-patched record\-new\-upstream is also available under the old name new\-upstream, though likely will be removed in future versions (to avoid confusion). .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\fIwhatever\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 regularly rebase d, 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 usually causes unnecessary large patches. .IP "the Debian branch (\fBmaster\fP|\fIwhatever\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. .IP "alternative branch names" You can specify alternate branch names for upstream and patched branches of a specific Debian branch, or force a branch to be a Debian branch that would normally be considered e.g. upstream branch of another branch by adding \fBdpmUpstreamBranch\fP and \fBdpmPatchedBranch\fP configure items for the Debian branch in question (you need both, only one is treated as error). The following example is a no-op for all practical purposes: \fBgit config branch.master.dpmUpstreamBranch upstream\fP \fBgit config branch.master.dpmPatchedBranch patched\fP .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.