From e1c9b1190cab8a889aaeafea220a63838b7e6d2b Mon Sep 17 00:00:00 2001 From: Stephen Haberman Date: Wed, 8 Oct 2008 16:43:24 -0500 Subject: [PATCH] Drop dependency on the trac repo (and hence git plugin). --- server/post-receive-trac | 4 +++- server/post-receive-trac.py | 13 +++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/server/post-receive-trac b/server/post-receive-trac index 4748adc..4e4432a 100644 --- a/server/post-receive-trac +++ b/server/post-receive-trac @@ -22,7 +22,9 @@ while read oldrev newrev refname ; do echo "$new_commits" | git rev-list --reverse --stdin | while read commit ; do set_describe "$commit" set_describe_tags "$commit" - "$PYTHON" "$POST_RECEIVE_TRAC" "$TRAC_ENV" "$short_refname" "$describe" "$describe_tags" "$commit" + author="$(git rev-list -n 1 $commit --pretty=format:'%cn <%ce>' | grep -v $commit)" + message="$(git rev-list -n 1 $commit --pretty=format:'%s%n%b' | grep -v $commit)" + "$PYTHON" "$POST_RECEIVE_TRAC" "$TRAC_ENV" "$short_refname" "$describe" "$describe_tags" "$commit" "$author" "$message" done done diff --git a/server/post-receive-trac.py b/server/post-receive-trac.py index 78ab6e4..a615aa6 100644 --- a/server/post-receive-trac.py +++ b/server/post-receive-trac.py @@ -21,6 +21,8 @@ refname = sys.argv[2] describe = sys.argv[3] describe_tags = sys.argv[4] rev = sys.argv[5] +author = sys.argv[6] +message = sys.argv[7] def refs(ticket): pass @@ -40,12 +42,7 @@ authorPattern = re.compile(r'<(.+)@') tickets = {} env = open_environment(project) -repos = env.get_repository() -repos.sync() - -changeset = repos.get_changeset(rev) - -for command, ticketList in commandPattern.findall(changeset.message): +for command, ticketList in commandPattern.findall(message): if commands.has_key(command.lower()): for ticketId in ticketPattern.findall(ticketList): tickets.setdefault(ticketId, []).append(commands[command.lower()]) @@ -64,9 +61,9 @@ for ticketId, commands in tickets.iteritems(): if change['permanent']: cnum += 1 - username = authorPattern.findall(changeset.author)[0] + username = authorPattern.findall(author)[0] now = datetime.now(utc) - message = "(On %s [changeset:%s %s]) %s" % (refname, rev, describe_tags, changeset.message) + message = "(On %s [changeset:%s %s]) %s" % (refname, rev, describe_tags, message) ticket['branch'] = refname ticket.save_changes(username, message, now, db, cnum+1) db.commit() -- 2.39.5