summaryrefslogtreecommitdiff
path: root/bin/maintmerge
blob: 4efb7efa710955bfefd4c20088bccacb6fb8f7b0 (plain)
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
#!/bin/sh

# Prepare a source package for dgit-maint-merge(7)

# TODO Generalise to some sort of script for any kind of project skeleton code

if ! (git diff-index --quiet --cached HEAD && \
          git diff-files --quiet && \
          test -z "$(git status --porcelain)" \
     ) >/dev/null 2>&1; then
    echo >&2 "please commit first"
    exit 1
fi

if ! [ -f "debian/changelog" ]; then
    echo >&2 "this doesn't look like a source package"
    exit 1
fi

if ! [ -d ".git" ]; then
    echo >&2 "please `git init`"
    exit 1
fi

source=$(dpkg-parsechangelog -SSource)

mkdir -p debian/source
echo "single-debian-patch" >>debian/source/options
echo "auto-commit" >>debian/source/options
git add debian/source/options

# TODO after substituting $source, word-wrap the paragraphs
cat >debian/source/patch-header <<EOF
The Debian packaging of $source is maintained in git, using the merging
workflow described in dgit-maint-merge(7).  There isn't a patch
queue that can be represented as a quilt series.

A detailed breakdown of the changes is available from their
canonical representation - git commits in the packaging repository.
For example, to see the changes made by the Debian maintainer in
the first upload of upstream version 1.2.3, you could use:

    % git clone https://git.dgit.debian.org/$source
    % cd $source
    % git log --oneline 1.2.3..debian/1.2.3-1 -- . ':!debian'

(If you have dgit, use \`dgit clone $source\`, rather than plain \`git
clone\`.)

A single combined diff, containing all the changes, follows.
EOF
git add debian/source/patch-header

git commit -m "Source package configuration for dgit-maint-merge(7)"

dgit setup-new-tree