m4-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/3] maint: generate ChangeLog from git commits


From: Eric Blake
Subject: [PATCH 2/3] maint: generate ChangeLog from git commits
Date: Sat, 31 Dec 2016 15:55:32 -0600

Follow the practice set in numerous other GNU projects, where
the ChangeLog (since 2015) is generated from git commit messages.
This avoids duplication or subtle differences between the two,
as well as making it easier to merge patches across branches
(as good as Bruno Haible's 'git-merge-changelog' helper program
is, it still doesn't handle cross-branch cherry-picks very well).

* ChangeLog: Move...
* ChangeLog-2014: ...to this.
* Makefile.am (EXTRA_DIST): Ship renamed file.
(gen-ChangeLog): New rule, copied mostly from coreutils.
(dist-hook): Generate the ChangeLog.
* m4/gnulib-cache.m4 (gl_MODULES): Import gitlog-to-changelog.
* .gitignore: Ignore ChangeLog.
* .gitattributes: Likewise.
* HACKING: Reword to match new procedure, and simplify by
referring to an external description of ChangeLog style.

Signed-off-by: Eric Blake <address@hidden>
---
 .gitattributes              |  1 -
 .gitignore                  |  1 +
 ChangeLog => ChangeLog-2014 | 31 ----------------
 HACKING                     | 90 +++++++++++----------------------------------
 Makefile.am                 | 28 ++++++++++++--
 m4/gnulib-cache.m4          |  3 +-
 6 files changed, 50 insertions(+), 104 deletions(-)
 rename ChangeLog => ChangeLog-2014 (99%)

diff --git a/.gitattributes b/.gitattributes
index 68d2d12..da57a7e 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,4 +1,3 @@
 # See ./bootstrap for some helpful ~/.gitconfig or .git/config settings
 # needed for using these attributes effectively.
-ChangeLog merge=merge-changelog
 *.texi* diff=texinfo
diff --git a/.gitignore b/.gitignore
index 4cc8909..af84054 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,6 +19,7 @@ autom4te.cache
 !/build-aux/install-sh
 !/build-aux/mdate-sh
 !/build-aux/texinfo.tex
+/ChangeLog
 /checks/[0-9][0-9][0-9].*
 /checks/stamp-checks
 config.cache
diff --git a/ChangeLog b/ChangeLog-2014
similarity index 99%
rename from ChangeLog
rename to ChangeLog-2014
index 26998b5..0555e18 100644
--- a/ChangeLog
+++ b/ChangeLog-2014
@@ -1,34 +1,3 @@
-2016-12-31  Eric Blake  <address@hidden>
-
-       maint: make silent builds the default
-       * configure.ac (AM_SILENT_RULES): Add, to match what most projects
-       are doing these days.
-
-       maint: release no longer creates a diff file
-       * HACKING: Drop outdated steps.
-
-2016-12-30  Eric Blake  <address@hidden>
-
-       doc: drop obsolete @setcontentsaftertitlepage
-       * doc/m4.texi: Satisfy newer texinfo.
-
-2016-12-29  Eric Blake  <address@hidden>
-
-       build: update to latest gnulib
-       * gnulib: Update to latest, to fix failure in getopt tests.
-
-       maint: regenerate bootstrap
-       * bootstrap: Regenerate.
-
-       maint: bump copyright year
-       * all files: Version control now has a commit in 2016.
-
-       build: update to latest gnulib
-       * gnulib: Update to latest.
-       * m4/gnulib-cache.m4: Regenerate.
-       * src/macro.c (expand_macro): Deal with obstack API change.
-       * src/builtin.c (mkstemp_helper): Likewise.
-
 2014-05-13  Eric Blake  <address@hidden>

        doc: fix line-wrapped macro definitions
diff --git a/HACKING b/HACKING
index 4175f81..472d222 100644
--- a/HACKING
+++ b/HACKING
@@ -125,70 +125,24 @@ and is not part of a release distribution.
 5. Editing 'ChangeLog'
 ======================

+* The ChangeLog is generated from git commit comments.  Each commit log
+  should start with a one-line summary, a blank line, and then a
+  ChangeLog-style entry for all affected files.  However, it's fine --
+  even recommended -- to write a few lines of prose describing the
+  change, when the summary and ChangeLog entries don't give enough of
+  the big picture.  Omit the leading TABs that you're used to seeing in
+  a "real" ChangeLog file, but keep the maximum line length at 72 or
+  smaller, so that the generated ChangeLog lines, each with its leading
+  TAB, will not exceed 80 columns.  As for the ChangeLog-style content,
+  please follow these guidelines:
+
+    http://www.gnu.org/software/guile/changelogs/guile-changelogs_3.html
+
 * When in doubt, check that emacs can syntax-color properly in
   change-log-mode.  And preferably use emacs 'C-x 4 a'
   (add-change-log-entry-other-window) to open ChangeLog with an
-  appropriate new template.
-
-* If this change is by a different author, or on a different date to the
-  last entry start a new entry at the top of the file with the format
-  (note two spaces between each field):
-
-yyyy-mm-dd  Name of Author  <address@hidden>
-
-*  If more than one person collaborated on the change, additional
-   authors can be listed on subsequent lines, thus:
-
-yyyy-mm-dd  Name of Main Author  <address@hidden>,
-            Name of Contributor  <address@hidden>
-
-* Where a change author did not supply a copyright assignment, but the
-  changes they submitted were sufficiently trivial to commit in any case
-  (see the GCS for guidelines on this), then flag this against their
-  name in the header, thus:
-
-yyyy-mm-dd  Name of Author  <address@hidden>  (tiny change)
-
-* Preferably the next part should be a description of the overall
-  purpose of the change, separated from the header by a blank line,
-  indented by 1 tab, and filled at column 72.  The last character of the
-  description should be a colon, :.
-
-* Changes to each file come next.  Each new file starts on a new line,
-  indented by 1 tab and starting with an asterisk and a space.  Multiple
-  files can be listed here relative to $top_srcdir, and comma separated.
-  Names of functions (or sections as appropriate) to which the change
-  applies should be named inside parentheses and comma separated.  If
-  this goes beyond column 72, then parens should be closed and re-opened
-  on the next line:
-
-       * file, another/file, test/testcases/foo.test (func_foo)
-       (func_bar, func_baz): Description of changes.
-
-* If the change does not apply to particular functions (or sections),
-  the section list can be omitted:
-
-       * file, another/file, test/testcases/foo.test: General changes.
-
-* If the changes are particular to certain architectures, they should be
-  listed after the functions in square brackets:
-
-       * file, another/file (func_foo) [linux, solaris]: Description of
-       changes.
-
-* Subsequent changes in other files that are related to the same overall
-  enhancement or bugfix should be listed concurrently, without blank
-  lines.  Always start a fresh line for a new file:
-
-       * file, another/file (func_foo) [linux, solaris]: Description of
-       changes.
-       * doc/foo.texi (Invoking Foo): Document.
-       * NEWS: Updated.
-
-* If the change is in response to a problem reported by someone other
-  than the author, then credit them at the end of the description with:
-
-       Reported by Reporter Name <address@hidden>.
+  appropriate new template, which you can then paste into your git
+  commit editing session.

 * See the GNU Coding Standards document for more details on ChangeLog
   formatting.
@@ -196,8 +150,8 @@ yyyy-mm-dd  Name of Author  <address@hidden>  (tiny change)
 6. Formatting
 =============

-* Use space-only indentation in nearly all files (Makefile and
-  ChangeLogs being the exception).
+* Use space-only indentation in nearly all files (Makefile inputs being
+  the exception).

   If you use Emacs and your m4 working directory name matches,
   this code in your ~/.emacs enables the right mode:
@@ -259,8 +213,8 @@ yyyy-mm-dd  Name of Author  <address@hidden>  (tiny change)
     git submodule foreach git pull origin master
     git commit -m 'Update gnulib submodule to latest.' gnulib

-* Update the version number in NEWS and ChangeLog, and mention in README
-  whether the release is stable.  See
+* Update the version number in NEWS, and mention in README whether the
+  release is stable.  See
   http://www.gnu.org/software/libtool/contribute.html for details of the
   numbering scheme (M4 uses a similar scheme to libtool, although
   intra-release versions carry more information thanks to
@@ -301,9 +255,9 @@ yyyy-mm-dd  Name of Author  <address@hidden>  (tiny change)
   it through (the list is normally set to silently discard all posts,
   even from subscribers).

-* Update NEWS, README, and ChangeLog to start the intra-release changes,
-  and run `git commit'.  Then run `git push origin refs/tags/v<version>'
-  to push the release tag and complete the release.
+* Update NEWS and README to start the intra-release changes, and run
+  `git commit'.  Then run `git push origin refs/tags/v<version>' to push
+  the release tag and complete the release.

 * For non-alpha releases, update the webpages.  Replace manual.html with
   the new one (generate with `make web-manual').
diff --git a/Makefile.am b/Makefile.am
index f4905da..9d294c2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,7 +23,7 @@
 SUBDIRS = . examples lib src doc checks tests

 EXTRA_DIST = bootstrap c-boxes.el cfg.mk maint.mk \
-       .prev-version .version m4/gnulib-cache.m4
+       .prev-version .version m4/gnulib-cache.m4 ChangeLog-2014
 DISTCLEANFILES = stamp-h
 ## maintainer-clean should remove as much as possible that ./bootstrap can
 ## recreate.  In the m4 directory, keep only gnulib-cache.m4.
@@ -38,11 +38,33 @@ ACLOCAL_AMFLAGS = -I m4
 DISTCHECK_CONFIGURE_FLAGS = --enable-changeword --program-prefix=g \
        --enable-gcc-warnings --enable-silent-rules --enable-cxx

+# Generate the ChangeLog from git history.
+gen_start_date = 2015-01-01
+.PHONY: gen-ChangeLog
+gen-ChangeLog:
+       $(AM_V_GEN)if test -d $(top_srcdir)/.git; then                  \
+         log_fix="$(srcdir)/build-aux/git-log-fix";                    \
+         test -e "$$log_fix"                                           \
+           && amend_git_log="--amend=$$log_fix"                        \
+           || amend_git_log=;                                          \
+         $(top_srcdir)/build-aux/gitlog-to-changelog $$amend_git_log   \
+          --since='$(gen_start_date)' > $(distdir)/cl-t                \
+         && rm -f $(distdir)/ChangeLog                                 \
+         && mv $(distdir)/cl-t $(distdir)/ChangeLog;                   \
+       fi
+
+# Dummy rule, to pacify automake "gnu" strictness and allow a clean
+# bootstrap.  Creates a dummy ChangeLog (unless one is already present,
+# as might be the case for users of vc-dwim) that will be overridden
+# with a proper one at distribution time.
+$(srcdir)/ChangeLog:
+       @echo dummy > $@
+
 BUILT_SOURCES = $(top_srcdir)/.version
 $(top_srcdir)/.version:
        echo $(VERSION) > address@hidden && mv address@hidden $@

 # Arrange so that .tarball-version appears only in the distribution
 # tarball, and never in a checked-out repository.
-dist-hook:
-       echo $(VERSION) > $(distdir)/.tarball-version
+dist-hook: gen-ChangeLog
+       $(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4
index 034e368..612512c 100644
--- a/m4/gnulib-cache.m4
+++ b/m4/gnulib-cache.m4
@@ -27,7 +27,7 @@


 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --local-dir=gl --lib=libm4 --source-base=lib 
--m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --with-tests 
--with-c++-tests --avoid=lock-tests --avoid=tls-tests --makefile-name=gnulib.mk 
--no-conditional-dependencies --no-libtool --macro-prefix=M4 announce-gen 
assert autobuild avltree-oset binary-io c-stack clean-temp cloexec close-stream 
closein config-h dirname error execute fclose fdl-1.3 fflush filenamecat fopen 
fopen-safer fseeko gendocs getopt-gnu git-version-gen gnu-web-doc-update 
gnumakefile gnupload gpl-3.0 ignore-value intprops maintainer-makefile 
manywarnings memchr2 mkstemp obstack progname regex rename sigaction sigpipe 
spawn-pipe stdbool stdint stdlib-safer strsignal strstr strtod unlocked-io 
update-copyright vc-list-files verror version-etc version-etc-fsf wait-process 
xalloc xoset xprintf xvasprintf-posix
+#   gnulib-tool --import --local-dir=gl --lib=libm4 --source-base=lib 
--m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --with-tests 
--with-c++-tests --avoid=lock-tests --avoid=tls-tests --makefile-name=gnulib.mk 
--no-conditional-dependencies --no-libtool --macro-prefix=M4 announce-gen 
assert autobuild avltree-oset binary-io c-stack clean-temp cloexec close-stream 
closein config-h dirname error execute fclose fdl-1.3 fflush filenamecat fopen 
fopen-safer fseeko gendocs getopt-gnu git-version-gen gitlog-to-changelog 
gnu-web-doc-update gnumakefile gnupload gpl-3.0 ignore-value intprops 
maintainer-makefile manywarnings memchr2 mkstemp obstack progname regex rename 
sigaction sigpipe spawn-pipe stdbool stdint stdlib-safer strsignal strstr 
strtod unlocked-io update-copyright vc-list-files verror version-etc 
version-etc-fsf wait-process xalloc xoset xprintf xvasprintf-posix

 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([gl])
@@ -56,6 +56,7 @@ gl_MODULES([
   gendocs
   getopt-gnu
   git-version-gen
+  gitlog-to-changelog
   gnu-web-doc-update
   gnumakefile
   gnupload
-- 
2.9.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]