# See debian/README.source for a more general description of this source
# package.
#
# Let's say that some time and upstream commits have passed since the last
# debian package and you want to prepare a new one. Here are the steps to
# follow.

git checkout upstream
# Make sure remotes/trunk == upstream
# If not, dcommit them or move into topic branches.
git-svn rebase
git checkout debian
git merge upstream
git checkout -b debian-PENDING
dch -i # write new version string based on timestamp of rebase
tg summary # for each PATCH that appears there:
  git checkout $PATCH
  tg update
  tg patch # does patch contain any changes?
  # NO - delete it!
    git checkout debian-PENDING
    tg delete $PATCH
    dch -a "removed $PATCH - merged upstream"
    git commit -m 'documented patch removal' debian/changelog
  # YES
    # have a look at associated bug report(s) and either:
    # - leave as is, in a topic branch
    # - do some work to allow inclusion upstream
    # - delete following the steps above.
git checkout debian-PENDING
git rebase -i debian
git checkout debian
git merge debian-PENDING
git branch -d debian-PENDING

git checkout autostuff
git merge upstream
NOCONFIGURE=1 ./autogen.sh
git status # inspect and remove any cruft or temp files
git add # any new necessary files
git commit -a -m 'Updated generated autostuff files.'

TS=YYYYMMDD+HHMM
git tag ekg2_$TS
# TODO: Perhaps the following command can be skipped, as git-buildpackage can create a tarball.
git archive --prefix=ekg2_$TS/  --verbose HEAD | gzip -9 > ../ekg2_${TS}.orig.tar.gz

git checkout build
git merge autostuff debian # in case of conflicts in .gitignore, ignore just autom4te.cache and commit
./debian/rules tg-cleanexport
git add debian/patches
git commit -m 'Refreshed topgit-generated patches.'

# TODO: move to .gbp.conf in debian branch
script -c "git-buildpackage --git-verbose --git-upstream-branch=autostuff --git-debian-branch=build" ../typescript.YYYYMMDD-X

Build and test on sid.

