hgkw/keyword.py
branchself_initializing_hook
changeset 90 2e930f842242
parent 89 16f1a5ed70ce
child 92 3c7c187e4001
--- a/hgkw/keyword.py	Fri Jan 12 01:20:51 2007 +0100
+++ b/hgkw/keyword.py	Fri Jan 12 01:41:33 2007 +0100
@@ -13,12 +13,12 @@
 
 Supported $keywords$ and their $keyword: substition $ are:
     Revision: changeset id
-    Author:   full username
-    Date:     %a %b %d %H:%M:%S %Y %z $
+    Author:   short username
+    Date:     %Y/%m/%d %H:%M:%S [UTC]
     RCSFile:  basename,v
     Source:   /path/to/basename,v
-    Id:       basename,v csetid %Y-%m-%d %H:%M:%S %z shortname
-    Header:   /path/to/basename,v csetid %Y-%m-%d %H:%M:%S %z shortname
+    Id:       basename,v csetid %Y/%m/%d %H:%M:%S shortname
+    Header:   /path/to/basename,v csetid %Y/%m/%d %H:%M:%S shortname
 
 Simple setup in hgrc:
 
@@ -34,7 +34,7 @@
 '''
 
 from mercurial import context, util
-import os.path, re, sys
+import os.path, re, sys, time
 
 
 re_kw = re.compile(
@@ -48,23 +48,19 @@
     c = context.filectx(repo, path,
             changeid=changeid, fileid=fileid, filelog=filelog)
     def Revision():
-        return c.changectx()
+        return str(c.changectx())
     def Author():
-        return c.user()
+        return util.shortuser(c.user())
     def Date():
-        return util.datestr(date=c.date())
+        return time.strftime('%Y/%m/%d %H:%M:%S', time.gmtime(c.date()[0]))
     def RCSFile():
         return os.path.basename(path)+',v'
     def Source():
         return repo.wjoin(path)+',v'
-    def revdateauth():
-        return '%s %s %s' % (c.changectx(),
-            util.datestr(date=c.date(), format=util.defaultdateformats[0]),
-            util.shortuser(c.user()))
     def Header():
-        return '%s %s' % (Source(), revdateauth())
+        return ' '.join([Source(), Revision(), Date(), Author()])
     def Id():
-        return '%s %s' % (RCSFile(), revdateauth())
+        return ' '.join([RCSFile(), Revision(), Date(), Author()])
     return '$%s: %s $' % (matchobj.group(1), eval('%s()' % matchobj.group(1)))
 
 def kwfmatches(ui, repo, files):