![]() |
![]() |
![]() |
![]() |
When branching and merging frequently, the different Debian™ changelog entries on the different branches tend to get into the way of the automatic merge and the the merge fails—leaving the (pathological) merge to the committer. In order to avoid this, gbp dch offers a way for creating changelog entries from Git™ commits before doing a release or anytime between releases.
The simplest way is doing all the changes to the
debian-branch
without touching
debian/changelog
at all. Then, when done, do:
gbp dch --release
This will look up the latest released version in the changelog,
increment the version in the Debian™ changelog, generate changelog
messages from the corresponding Git™ commit id up to the branch head, and
finally spawns an editor for final changelog file editing by invoking dch™
--release
.
But what if you want to have an (unreleased) snapshot for intermediate testing:
gbp dch --snapshot
will generate a snapshot release with a specially crafted version number and a warning in the changelog that this is a snapshot release:
git-buildpackage (0.3.7~1.gbp470ce2) UNRELEASED; urgency=low ** SNAPSHOT build @470ce29ec7877705c844474a2fd89869aea0406d ** * add support for automatic snapshot
During subsequent calls with --snapshot
, this version
number will continue to increase. Since the snapshot banners contains the
commit id of the current branch head, gbp dch can figure out what to
append to the changelog by itself:
gbp dch--snapshot
--auto
will fetch the commit id and add changelog entries from that point to the current HEAD—again auto incrementing the version number. If you don't want to start at that commit id, you can specify any id or tag with:
gbp dch--since
=e76a6a180a57701ae4ae381f74523cacb3152780
--snapshot
After testing, you can remove the snapshot header by a final gbp dch call:
gbp dch--since
=HEAD
--release
This will add no further entries but simply remove the specially crafted
version number and the snapshot header. Again you can use any commit id
or tag instead of HEAD
if you want to add further changelog
entries—or you can (of course) use --auto
again.
If the auto incrementing of the snapshot number doesn't suite your needs, you can give any Python expression that evaluates to a positive integer to calculate the new snapshot number:
gbp dch-S
-a
--snapshot-number
=1
gbp dch-S
-a
--snapshot-number
='snapshot + 2'
gbp dch-S
-a
--snapshot-number
='os.popen("git-log --pretty=oneline | wc -l").readlines()[0]'
gbp dch-S
-a
--snapshot-number
=`git-log --pretty=oneline debian/0.3.3 | wc -l`
You can also add the snapshot-number calculation to gbp.conf
:
[DEFAULT] snapshot-number = os.popen("git-log --pretty=oneline | wc -l").readlines()[0]