From: Han-Wen Nienhuys Date: Fri, 3 Nov 2006 01:20:41 +0000 (+0100) Subject: sort commits, and use .git-commits-done file. X-Git-Tag: release/2.10.0-2~34^2~11 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=00b685480bb47512f6e8a206c2679f3ec96ca297;p=lilypond.git sort commits, and use .git-commits-done file. --- diff --git a/buildscripts/git-update-changelog.py b/buildscripts/git-update-changelog.py index 5ad922be93..4b98c6c199 100644 --- a/buildscripts/git-update-changelog.py +++ b/buildscripts/git-update-changelog.py @@ -17,6 +17,15 @@ def system (x): class PatchFailed(Exception): pass +def sign (x): + if x < 0: + return -1 + if x > 0: + return 1 + + return 0 + + class Commit: def __init__ (self, dict): for v in ('message', @@ -32,6 +41,8 @@ class Commit: self.email = m.group (2).strip () self.name = m.group (1).strip () self.diff = read_pipe ('git show %s' % self.committish) + def compare (self, other): + return sign (time.mktime (self.date) - time.mktime (other.date)) def touched_files (self): files = [] @@ -173,6 +184,15 @@ Run this file from the CVS directory, with commits from the repository in --git- if first == log[:len (first)]: log = log[len (first):] + try: + previously_done = dict((c, 1) for c in open ('.git-commits-done').read ().split ('\n')) + except OSError: + previously_done = {} + + commits = [c for c in commits if not previously_done.has_key (c.committish)] + commits = sorted (commits, cmp=Commit.compare) + + file_adddel = [] collated_log = '' collated_message = '' @@ -181,6 +201,7 @@ Run this file from the CVS directory, with commits from the repository in --git- while commits: c = commits[0] commits = commits[1:] + commits_done.append (c) if not c.has_patch ():