[geany/infrastructure] fa4025: Add !commit command to display a Github link for a commit hash

Enrico Tröger git-noreply at xxxxx
Wed Nov 13 20:20:03 UTC 2013


Branch:      refs/heads/master
Author:      Enrico Tröger <enrico.troeger at uvena.de>
Committer:   Enrico Tröger <enrico.troeger at uvena.de>
Date:        Wed, 13 Nov 2013 20:20:03 UTC
Commit:      fa4025a05cdb6dafba1537f56925a7945b37789d
             https://github.com/geany/infrastructure/commit/fa4025a05cdb6dafba1537f56925a7945b37789d

Log Message:
-----------
Add !commit command to display a Github link for a commit hash

This is already present on IRC, I just forgot to commit this piece.


Modified Paths:
--------------
    ircbot-plugins/Geany/plugin.py

Modified: ircbot-plugins/Geany/plugin.py
14 files changed, 14 insertions(+), 0 deletions(-)
===================================================================
@@ -268,6 +268,19 @@ def moo(self, irc, msg, args):
         else:
             irc.reply('I have Super Cow Powers. Have you mooed today?')
 
+    def commit(self, irc, msg, args, idx):
+        """takes one argument, a Git ID SHA
+
+        Type '!commit <SHA-ID-HERE>' to print a URL/link to view the commit
+        in Geany's online Git repository browser.
+        """
+        idx = str(idx).lower().strip()
+        if all(ch in 'abcdef0123456789' for ch in idx):
+            irc.reply('https://github.com/geany/geany/commit/' + idx)
+            # using Github since it allows shortened SHAs also
+            #irc.reply('http://git.geany.org/geany/commit/?id=' + idx)
+        else:
+            irc.reply('Malformed Git SHA')
 
     # "decorate" our commands (wrap is a decorator replacement for old Python versions)
     tea = wrap(goodie, [ optional(many('text')) ])
@@ -297,6 +310,7 @@ def moo(self, irc, msg, args):
 
     test = wrap(test, [ optional(many('text')) ])
     moo = wrap(moo)
+    commit = wrap(commit, [ 'text' ])
 
 
 



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list