releases.sgml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <chapter id="gbp.releases">
  2. <title>Releases and Snapshots</title>
  3. <para>When branching and merging frequently, the different &debian; changelog
  4. entries on the different branches tend to get into the way of the automatic
  5. merge and the the merge fails&mdash;leaving the (pathological) merge to the
  6. committer. In order to avoid this, &gbp-dch; offers a way for creating
  7. changelog entries from &git; commits before doing a
  8. release or anytime between releases.</para>
  9. <para>
  10. The simplest way is doing all the changes to the
  11. <option>debian-branch</option> without touching
  12. <emphasis>debian/changelog</emphasis> at all. Then, when done, do:
  13. </para>
  14. <programlisting>
  15. &gbp-dch; <option>--release</option>
  16. </programlisting>
  17. <para>This will look up the latest released version in the changelog,
  18. increment the version in the &debian; changelog, generate changelog
  19. messages from the corresponding &git; commit id up to the branch head, and
  20. finally spawns an editor for final changelog file editing by invoking &dch;
  21. <option>--release</option>.</para>
  22. <para>
  23. But what if you want to have an (unreleased) snapshot for intermediate testing:
  24. </para>
  25. <programlisting>
  26. &gbp-dch; <option>--snapshot</option>
  27. </programlisting>
  28. <para>will generate a snapshot release with a specially crafted version number
  29. and a warning in the changelog that this is a snapshot release:
  30. </para>
  31. <programlisting>
  32. git-buildpackage (0.3.7~1.gbp470ce2) UNRELEASED; urgency=low
  33. ** SNAPSHOT build @470ce29ec7877705c844474a2fd89869aea0406d **
  34. * add support for automatic snapshot
  35. </programlisting>
  36. <para>During subsequent calls with <option>--snapshot</option>, this version
  37. number will continue to increase. Since the snapshot banners contains the
  38. commit id of the current branch head, &gbp-dch; can figure out what to
  39. append to the changelog by itself:
  40. <programlisting>
  41. &gbp-dch; <option>--snapshot</option> <option>--auto</option>
  42. </programlisting>
  43. will fetch the commit id and add changelog entries from that point to the
  44. current HEAD&mdash;again auto incrementing the version number. If you don't want
  45. to start at that commit id, you can specify any id or tag with:</para>
  46. <programlisting>
  47. &gbp-dch; <option>--since</option>=<replaceable>e76a6a180a57701ae4ae381f74523cacb3152780</replaceable> <option>--snapshot</option>
  48. </programlisting>
  49. <para>
  50. After testing, you can remove the snapshot header by a final &gbp-dch; call:
  51. </para>
  52. <programlisting>
  53. &gbp-dch; <option>--since</option>=<replaceable>HEAD</replaceable> <option>--release</option>
  54. </programlisting>
  55. <para>
  56. This will add no further entries but simply remove the specially crafted
  57. version number and the snapshot header. Again you can use any commit id
  58. or tag instead of <option>HEAD</option> if you want to add further changelog
  59. entries&mdash;or you can (of course) use <option>--auto</option> again.
  60. </para>
  61. <sect1 id="gbp.release.numbers">
  62. <title>Customizing snapshot numbers</title>
  63. <para>If the auto incrementing of the snapshot number doesn't suite your needs, you
  64. can give any Python expression that evaluates to a positive integer to
  65. calculate the new snapshot number:</para>
  66. <programlisting>
  67. &gbp-dch; <option>-S</option> <option>-a</option> <option>--snapshot-number</option>=<replaceable>1</replaceable>
  68. &gbp-dch; <option>-S</option> <option>-a</option> <option>--snapshot-number</option>=<replaceable>'snapshot + 2'</replaceable>
  69. &gbp-dch; <option>-S</option> <option>-a</option> <option>--snapshot-number</option>=<replaceable>'os.popen("git-log --pretty=oneline | wc -l").readlines()[0]'</replaceable>
  70. &gbp-dch; <option>-S</option> <option>-a</option> <option>--snapshot-number</option>=<replaceable>`git-log --pretty=oneline debian/0.3.3 | wc -l`</replaceable>
  71. </programlisting>
  72. <para>
  73. You can also add the snapshot-number calculation to <filename>gbp.conf</filename>:
  74. </para>
  75. <programlisting>
  76. [DEFAULT]
  77. snapshot-number = os.popen("git-log --pretty=oneline | wc -l").readlines()[0]
  78. </programlisting>
  79. </sect1>
  80. <sect1 id="gbp.release.commit">
  81. <title>More on commit messages</title>
  82. <para>You can use <option>--full</option> to include the full commit
  83. message in the changelog; note that you will lose the formatting though,
  84. since &dch; wraps lines by itself.</para>
  85. <para>Additionally, there are tags <option>Closes:</option> and
  86. <option>Thanks:</option> available to customize the commit message. Each tag
  87. has to start at the beginning of a single line. For example, the git commit message
  88. <screen>
  89. New upstream version
  90. Closes: #1000
  91. Thanks: cool upstream
  92. </screen>
  93. would result in a changelog entry:
  94. <screen>
  95. * New upstream version (Closes: #1000) - thanks to cool upstream
  96. </screen>
  97. You can use the <option>Closes:</option> tag multiple times.
  98. </para>
  99. <para>
  100. There are several tags to further customize what (and how) commit messages get
  101. included into the changelog:
  102. </para><para>
  103. To exclude a commit from the generated changelog, use:
  104. </para><para>
  105. <screen>
  106. Gbp-Dch: Ignore
  107. </screen>
  108. This is e.g. useful if you're just fixing up a previous commit and couldn't
  109. amend it, or for other janitorial commits that really don't need to end up in
  110. the changelog. For example, the following git commit message
  111. <screen>
  112. Set correct branchnames in debian/gbp.conf
  113. Gbp-Dch: Ignore
  114. </screen>
  115. will not show up in the generated changelog in any way.
  116. </para>
  117. <para>
  118. To include the full commit message in the changelog, use:
  119. <screen>
  120. Gbp-Dch: Full
  121. </screen>
  122. </para>
  123. <para>
  124. To only include the short description in the changelog and skip the body, use:
  125. <screen>
  126. Gbp-Dch: Short
  127. </screen>
  128. The latter only takes effect when running &gbp-dch; with the
  129. <option>--full</option> option since including only the short
  130. description is the default.
  131. </para>
  132. <para>
  133. Usually, changelog entries should correspond to a single &git; commit. In this case, it's
  134. convenient to include the commit id in the changelog entry.
  135. This has the advantage that it's easy for people to identify changes without
  136. having to write very extensive changelog messages&mdash;the link back to &git; can be
  137. automated via the <option>Vcs-Browser</option> and <option>Vcs-Git</option>
  138. fields in <filename>debian/control</filename>. See <ulink url="https://honk.sigxcpu.org/cl2vcs">
  139. Cl2vcs</ulink> for how this looks.
  140. </para>
  141. <para>
  142. The inclusion of the commit id can be done automatically
  143. via &gbp-dch;'s <option>--id-length</option> option. Using
  144. <option>--id-length</option>=<replaceable>7</replaceable> would change the above example to:
  145. <screen>
  146. * [571bfd4] New upstream version (Closes: #1000) - thanks to cool upstream
  147. </screen>
  148. This makes it much easier to see which commit actually fixed bug #1000.
  149. </para>
  150. </sect1>
  151. </chapter>