This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: ChangeLog's: do we have to?
- From: Trevor Saunders <tbsaunde at tbsaunde dot org>
- To: "Maciej W. Rozycki" <macro at linux-mips dot org>
- Cc: Tom Tromey <tom at tromey dot com>, Florian Weimer <fw at deneb dot enyo dot de>, Paul Koning <paulkoning at comcast dot net>, Aldy Hernandez <aldyh at redhat dot com>, GCC Mailing List <gcc at gcc dot gnu dot org>, Jakub Jelinek <jakub at redhat dot com>
- Date: Tue, 31 Jul 2018 20:19:35 -0400
- Subject: Re: ChangeLog's: do we have to?
- References: <6f84c126-136e-7f6d-ec69-4775a58610a4@redhat.com> <87r2khg2v8.fsf@mid.deneb.enyo.de> <9702A2D4-9DD3-4985-B804-72F8CD3E6610@comcast.net> <87fu0xg15w.fsf@mid.deneb.enyo.de> <87fu0xmjer.fsf@tromey.com> <alpine.LFD.2.21.1807312350570.4967@eddie.linux-mips.org>
ga, forgot to attach the script in my previous message, so here it is.
thanks
Trev
On Wed, Aug 01, 2018 at 12:16:57AM +0100, Maciej W. Rozycki wrote:
> On Thu, 5 Jul 2018, Tom Tromey wrote:
>
> > I use git-merge-changelog from gnulib. If you want to use git am and
> > avoid manually copying ChangeLog text from the commit message back into
> > the appropriate files, then it's much better to install the driver and
> > include the ChangeLog diffs in the patch submission.
>
> FWIW, I've found it quite quick to paste ChangeLog text from the commit
> message after `git am' (directly invocable for the intended submission
> from alpine e-mail client, which has a "pipe message" command) by adding
> an empty first line to the intended ChangeLog file, marking it with ^V and
> then issuing:
>
> :'<,'>!git log -1
>
> in vim, removing any commit description preceding the ChangeLog entry and
> fixing up formatting of the newly-added entry by marking it with ^V and
> then with:
>
> :'<,'>s/^ //g
>
> If more than one ChangeLog file is used, then parts of the entry can be
> carried over via buffers. Perhaps the most involving is adding the date
> and author heading, but I don't think you can completely avoid manual
> intervention here anyway. Then:
>
> $ git commit -a --amend
> $ git rebase --ignore-date origin/master
>
> For ChangeLog entries contained in a single file it takes maybe a few
> seconds, for more complex one a couple dozens perhaps.
>
> Of course the amount of effort required for that will likely vary between
> e-mail clients and editors.
>
> Maciej
#!/usr/bin/python
import sys
import os
import re
def finish_logfile(logfile):
logfile.write('\n')
oldfile = open(logfile.name[:len(logfile.name) - 1], 'r')
logfile.write(oldfile.read())
logfile.close()
os.rename(logfile.name, logfile.name[:len(logfile.name) - 1])
commit = sys.stdin.readlines()
logfile = None
did_date = False
for line in commit:
newfile = None
if '/' in line and not line.startswith('\t'):
print line
line = line.strip(' \n\t\r:')
if os.path.isfile(line):
newfile = open(line + '~', 'w')
else:
if os.path.isdir(line):
newfile = open(line + '/ChangeLog~', 'w')
if newfile:
if logfile:
finish_logfile(logfile)
logfile = newfile
did_date = False
continue
if re.match('[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] .* <.*@.*>', line):
dateline = line.strip();
logfile.write(dateline)
logfile.write('\n\n')
did_date = True
continue
if not line.startswith('\t'):
if (not logfile) or line == '\n':
continue
else:
print('error: baddly indented line')
exit(1)
if not did_date:
generate_date(logfile)
logfile.write(line)
finish_logfile(logfile)