]> git.droids-corp.org - git-central.git/commitdiff
Try passing in git describe too.
authorStephen Haberman <stephen@exigencecorp.com>
Sat, 23 Aug 2008 05:45:33 +0000 (00:45 -0500)
committerStephen Haberman <stephen@exigencecorp.com>
Sat, 23 Aug 2008 05:45:33 +0000 (00:45 -0500)
server/post-receive-trac
server/post-receive-trac.py
tests/t3000-server-post-receive-trac.sh

index a4c08d3e321b9f21bc4505e248c54c14b55ebc09..21ac0f44094b5d054cd19439b2f3e75387a0c8d7 100644 (file)
@@ -17,8 +17,11 @@ while read oldrev newrev refname ; do
        esac
 
        set_new_commits
+       set_rev_types
+       set_describe
+
        echo "$new_commits" | git rev-list --reverse --stdin | while read commit ; do
-               "$PYTHON" "$POST_RECEIVE_TRAC" "$TRAC_ENV" "$short_refname" "$commit"
+               "$PYTHON" "$POST_RECEIVE_TRAC" "$TRAC_ENV" "$short_refname" "$describe" "$commit"
        done
 done
 
index 2814effeeb21d8c904138826897383afb6313f4e..768b308f3d035f5f719477122bbc41d7b0839703 100644 (file)
@@ -18,7 +18,8 @@ from trac.versioncontrol.api import NoSuchChangeset
 
 project = sys.argv[1]
 refname = sys.argv[2]
-rev = sys.argv[3]
+describe = sys.argv[3]
+rev = sys.argv[4]
 
 def refs(ticket):
        pass
@@ -64,7 +65,7 @@ for ticketId, commands in tickets.iteritems():
 
        username = authorPattern.findall(changeset.author)[0]
        now = datetime.now(utc)
-       message = "(On %s [%s]) %s" % (refname, rev, changeset.message)
+       message = "(On %s [../changeset/%s %s]) %s" % (refname, rev, describe, changeset.message)
        ticket['branch'] = refname
        ticket.save_changes(username, message, now, db, cnum+1)
        db.commit()
index 46881c8b60e0a2a4ab34a57b694c155180a9213d..8468b57fafd6c5e658f4913777af827ec0931950 100644 (file)
@@ -25,14 +25,14 @@ test_expect_success 'new branch' '
        git commit -a -m "changed on topic1" &&
        new_commit_hash=$(git rev-parse HEAD) &&
        git push origin topic1 2>push.err &&
-       cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic1 $new_commit_hash"
+       cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic1 $new_commit_hash $new_commit_hash"
 '
 
 test_expect_success 'new branch with already existing does not double tap' '
        git checkout -b topic2 topic1 &&
        existing_commit_hash=$(git rev-parse HEAD) &&
        git push origin topic2 2>push.err &&
-       ! cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic2 $existing_commit_hash"
+       ! cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic2 $existing_commit_hash $existing_commit_hash"
 '
 
 test_expect_success 'update branch' '
@@ -41,7 +41,7 @@ test_expect_success 'update branch' '
        git commit -a -m "changed on topic2" &&
        new_commit_hash=$(git rev-parse HEAD) &&
        git push origin topic2 2>push.err &&
-       cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic2 $new_commit_hash"
+       cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic2 $new_commit_hash $new_commit_hash"
 '
 
 test_expect_success 'update branch to an already published commit does not double tap' '
@@ -55,8 +55,21 @@ test_expect_success 'update branch to an already published commit does not doubl
 
        git push 2>push.err &&
 
-       ! cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic2 $topic2_hash"
-       ! cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic1 $topic1_hash"
+       ! cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic2 $topic2_hash $topic2_hash"
+       ! cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic1 $topic1_hash $topic1_hash"
+'
+
+test_expect_success 'update branch with abbreviation' '
+       git checkout topic2
+       git tag -m "release1" release1 &&
+       git push --tags &&
+
+       echo "$test_name" >a &&
+       git commit -a -m "changed on topic2" &&
+       new_commit_describe=$(git describe HEAD) &&
+       new_commit_hash=$(git rev-parse HEAD) &&
+       git push origin topic2 2>push.err &&
+       cat push.err | grep "/foo/post-receive-trac.py /foo/trac topic2 $new_commit_describe $new_commit_hash"
 '
 
 test_done