bug-patch
[Top][All Lists]
Advanced

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

[bug-patch] [PATCH 1/2] do not version-control ChangeLog; instead, gener


From: Jim Meyering
Subject: [bug-patch] [PATCH 1/2] do not version-control ChangeLog; instead, generate it
Date: Thu, 17 Mar 2011 11:45:23 +0100

Hi Andreas,

Are you open to the idea of not version-controlling ChangeLog?
At first, you'll probably say "no way", but once you see how
things can work, I hope you'll reconsider.

I find that a VC'd ChangeLog causes more trouble than it's worth,
especially when you carry changes on a branch or two, even with
Bruno Haible's nice git-merge-changelog program.

Here's a proposal to allow continued use of a ChangeLog
(I always use one), but merely not to version-control it.
The difference with this approach is that when you write a
ChangeLog entry (in the usual non-VC'd file), you need a way
to convert that entry into a git log message.

And then you need a way to convert your collection of git logs
into a ChangeLog file, which should be included in each tarball,
since those viewing a tarball won't have access to git logs.
The log-to-ChangeLog process is automated by the patch below.

The ChangeLog-to-log part is managed by a tool called vc-dwim.
  http://www.gnu.org/s/vc-dwim/
There are several ways to use it, but I prefer the one that
is described in this example from vc-dwim's --help output:

EXAMPLE
    Here's how to use vc-dwim in a project that does not version-control a
    ChangeLog file.  Create a repository just for your personal ChangeLog file
    and make a symlink to it from the top-level directory of the project.  For
    projects that use git, I put this tiny auxiliary repository in a directory
    named .git/c.  You can use this bash/zsh alias to set it up and to create
    the symlink:

        git-changelog-symlink-init()
        {
            local d=.git/c
            test -d .git || return 1
            mkdir $d
            touch $d/ChangeLog
            (cd $d && git init && git add ChangeLog && git commit -m. -a)
            ln --backup -s $d/ChangeLog .
        }

With that, you add each new entry to ChangeLog,
and you run vc-dwim to show diffs corresponding to
files with newly-added entries in ChangeLog.
Once you're happy with all changes (and hence with
the output of vc-dwim), you rerun vc-dwim --c to
commit only those files using your ChangeLog entry
as the git log message.

I've included two change sets below.  The first is for ChangeLogs, as
described.  The second is to update to the latest gnulib, since without
that, I get warnings (fixed long ago in gnulib) when running autoconf.

===================================================

>From 764d0ea12e5fd8b15ab32f724ffcba0be33dd73f Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 17 Mar 2011 11:01:49 +0100
Subject: [PATCH 1/2] do not version-control ChangeLog; instead, generate it
 from git log

With this change, all ChangeLog entries going forward are generated
into a file named ChangeLog in each distribution tarball.
ChangeLog entries prior to today's date are in ChangeLog-2011.
* Makefile.am (gen-ChangeLog): New rule.
(dist-hook): Depend on it.
(EXTRA_DIST): Add ChangeLog-2011.
* ChangeLog-2011: Renamed from ChangeLog
* ChangeLog: Remove file.
* .gitignore: Ignore ChangeLog.
* bootstrap.conf: Ensure that ChangeLog exists.
(gnulib_modules): Add gitlog-to-changelog.
---
 .gitignore                  |    1 +
 ChangeLog => ChangeLog-2011 |    6 ++++++
 Makefile.am                 |   13 ++++++++++++-
 bootstrap.conf              |    4 ++++
 4 files changed, 23 insertions(+), 1 deletions(-)
 rename ChangeLog => ChangeLog-2011 (99%)

diff --git a/.gitignore b/.gitignore
index 1d3147f..120c9e7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
 .deps/
 /.pc/
 /.version
+/ChangeLog
 /INSTALL
 /VERSION
 /aclocal.m4
diff --git a/ChangeLog b/ChangeLog-2011
similarity index 99%
rename from ChangeLog
rename to ChangeLog-2011
index 77fb4d0..87e7fce 100644
--- a/ChangeLog
+++ b/ChangeLog-2011
@@ -1,3 +1,9 @@
+2011-03-17  Jim Meyering  <address@hidden>
+
+       don't version-control ChangeLog; instead, generate it from git log
+       * Makefile.am (gen-ChangeLog): New rule.
+       * .gitignore: List ChangeLog.
+
 2011-02-20  Jim Meyering  <address@hidden>

        maint: remove unnecessary tests before free
diff --git a/Makefile.am b/Makefile.am
index 970232d..918c5eb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -21,6 +21,7 @@ ACLOCAL_AMFLAGS = -I m4
 SUBDIRS = lib src tests
 dist_man1_MANS = patch.man
 EXTRA_DIST = \
+       ChangeLog-2011 \
        m4/mkdir.m4 \
        m4/setmode.m4 \
        m4/utimbuf.m4 \
@@ -37,9 +38,19 @@ endif
 BUILT_SOURCES = $(top_srcdir)/.version
 $(top_srcdir)/.version:
        echo $(VERSION) > address@hidden && mv address@hidden $@
-dist-hook:
+dist-hook: gen-ChangeLog
        echo $(VERSION) > $(distdir)/.tarball-version

+gen_start_date = 2011-02-22
+.PHONY: gen-ChangeLog
+gen-ChangeLog:
+       $(AM_V_GEN)if test -d .git; then                                \
+         $(top_srcdir)/build-aux/gitlog-to-changelog                   \
+           --since=$(gen_start_date) > $(distdir)/cl-t;                \
+         rm -f $(distdir)/ChangeLog;                                   \
+         mv $(distdir)/cl-t $(distdir)/ChangeLog;                      \
+       fi
+
 tell-upload:
        echo; \
        (echo "Upload with: "; \
diff --git a/bootstrap.conf b/bootstrap.conf
index 688fde0..376e26e 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -31,6 +31,7 @@ full-write
 getdate
 getopt-gnu
 gettime
+gitlog-to-changelog
 git-version-gen
 hash
 lchmod
@@ -97,3 +98,6 @@ xalloc
 #       m4/xsize.m4
 #   '
 # fi
+
+# Automake requires that ChangeLog exist.
+touch ChangeLog || exit 1
--
1.7.4.1.430.g5aa4d


>From e4e32e63bd3ae7818fe869bcca08f6450b993e7c Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 17 Mar 2011 11:21:28 +0100
Subject: [PATCH 2/2] build: update gnulib submodule to latest

---
 gnulib        |    2 +-
 m4/.gitignore |    2 ++
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/gnulib b/gnulib
index 3b1e7b9..0baae9c 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 3b1e7b987f936143f1e133401882f87fc411014e
+Subproject commit 0baae9cadd08c9704e3c704dd69fb75640293e9d
diff --git a/m4/.gitignore b/m4/.gitignore
index 057a6a6..3171a02 100644
--- a/m4/.gitignore
+++ b/m4/.gitignore
@@ -6,6 +6,7 @@ bison.m4
 canonicalize.m4
 clock_time.m4
 codeset.m4
+configmake.m4
 d-ino.m4
 dirent-safer.m4
 dirent_h.m4
@@ -62,6 +63,7 @@ mktime.m4
 mmap-anon.m4
 multiarch.m4
 onceonly.m4
+parse-datetime.m4
 pathmax.m4
 printf.m4
 quote.m4
--
1.7.4.1.430.g5aa4d



reply via email to

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