chiark / gitweb /
blame: Print the filename with blame #last
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 29 May 2019 14:19:03 +0000 (15:19 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 30 May 2019 10:15:59 +0000 (11:15 +0100)
In principle we could have got this from "git blame" but (1) that
makes parsing this more annoying and (2) by rights this should come
from the fish cfg so that it can be a display name at some point.

The main effect is to print something like:
  13:41 <Servus> Modified flirts 2011-05-31: new fish from Alice
rather than:
  13:41 <Servus> Modified 2011-05-31: new fish from Alice

I have not taken the trouble to touch the three open-coded special
cases for blame #trouts etc.  I thought that was beyond the call of
duty.  In those cases it will print:
  13:41 <Servus> Modified fish? 2011-05-31: new fish from Alice

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
commands.py

index 8cc34f03ac6f4dc4997b4f435523842bc7b40601..964dacfa41a4c1e782d0ce643798f29606672802 100755 (executable)
@@ -323,6 +323,7 @@ def blameq(bot,cmd,nick,conn,public,fish,cfgs):
        bot.automsg(public,nick,"Who or what do you want to blame?")
        return
     cwhat=' '.join(clist[2:])
+    kindsfile = "fish?"
     if clist[1]=="#last":
        if fish.last_cfg is None:
            bot.automsg(public,nick,"Nothing")
@@ -344,7 +345,7 @@ def blameq(bot,cmd,nick,conn,public,fish,cfgs):
        if len(ans[0])==1:
            bot.automsg(public,nick,ans[0])
        else:
-           bot.automsg(public,nick,"Modified %s: %s" % (ans[0][2].isoformat(),ans[0][1]))
+           bot.automsg(public,nick,"Modified %s %s: %s" % (kindsfile, ans[0][2].isoformat(),ans[0][1]))
     elif len(ans)>4:
        bot.automsg(public,nick,"I found %d matches, which is too many. Please be more specific!" % (len(ans)) )
     else:
@@ -352,7 +353,7 @@ def blameq(bot,cmd,nick,conn,public,fish,cfgs):
            if len(a)==1:
                bot.automsg(public,nick,a)
            else:
-               bot.automsg(public,nick,"'%s' modified on %s: %s" % (a[0],a[2].isoformat(),a[1]))
+               bot.automsg(public,nick,"%s '%s' modified on %s: %s" % (kindsfile, a[0],a[2].isoformat(),a[1]))
 
 ### say to msg/channel            
 def sayq(bot, cmd, nick, conn, public):