public
Rubygem
Description: Git based distributed ticketing system, including a command line client and web viewer
Clone URL: git://github.com/schacon/ticgit.git
Search Repo:
added an example post-commit hook file
yob (author)
Mon May 12 07:15:06 -0700 2008
schacon (committer)
Mon May 12 17:13:12 -0700 2008
commit  6e453f523fa1da50ecb04431101112b3611c6a4d
tree    4e4ba94c72504d6afc792d8e70a870a7940c6bf3
parent  74b835f70b3228258bc1442a1a464155efddd3d8
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
0
@@ -0,0 +1,28 @@
0
+#!/usr/bin/env ruby
0
+
0
+require 'tempfile'
0
+
0
+commit_log = `git log -1`.chomp
0
+m, commit_id = * commit_log.match(/commit\W*([A-Fa-f0-9]+)/)
0
+
0
+Tempfile.open('ticgit_comment') do |tmp|
0
+ tmp.write commit_log
0
+ actions = {}
0
+
0
+ # comment on any tickets this commit references
0
+ commit_log.scan(/\(\W*[Rr]efs?\W*:*\W*\#([a-fA-F0-9]+)\W*\)/).each do |ticked_id|
0
+ actions[ticket_id] = :ref
0
+ end
0
+
0
+ # close any tickets this commit solves
0
+ # overwrite any refs, as the commit log will still
0
+ # be added to the ticket as a comment, but will also be closed
0
+ commit_log.scan(/\(\W*[Cc]loses\W*:*\W*\#([a-fA-F0-9]+)\W*\)/).each do |ticket_id|
0
+ actions[ticket_id] = :close
0
+ end
0
+
0
+ actions.each do |ticket_id, action|
0
+ `ti comment #{ticket_id} --file #{tmp.path}` if action
0
+ `ti state #{ticket_id} resolved` if action == :close
0
+ end
0
+end

Comments

    No one has commented yet.