]> git.droids-corp.org - git-central.git/commitdiff
Drop dependency on the trac repo (and hence git plugin).
authorStephen Haberman <shaberman@payflex.com>
Wed, 8 Oct 2008 21:43:24 +0000 (16:43 -0500)
committerStephen Haberman <shaberman@payflex.com>
Wed, 8 Oct 2008 21:43:24 +0000 (16:43 -0500)
server/post-receive-trac
server/post-receive-trac.py

index 4748adc43fb1e25e45a8982e148da0ba33e16d12..4e4432a90acf4673eb5024cd514b8a686149f503 100644 (file)
@@ -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
 
index 78ab6e453b5976f1740324111ccf5f1c3ff81756..a615aa60397d9fc2fb8bce0763c0b78c470bd5a6 100644 (file)
@@ -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()