hgkw/keyword.py
changeset 893 24924dfb8326
parent 892 d6b24cad9513
child 897 2ffafb688274
equal deleted inserted replaced
892:d6b24cad9513 893:24924dfb8326
   123 def svnutcdate(text):
   123 def svnutcdate(text):
   124     ''':svnutcdate: Date. Returns a UTC-date in this format: "2009-08-18
   124     ''':svnutcdate: Date. Returns a UTC-date in this format: "2009-08-18
   125     11:00:13Z".
   125     11:00:13Z".
   126     '''
   126     '''
   127     return util.datestr((text[0], 0), '%Y-%m-%d %H:%M:%SZ')
   127     return util.datestr((text[0], 0), '%Y-%m-%d %H:%M:%SZ')
       
   128 
       
   129 templatefilters.filters.update({'utcdate': utcdate,
       
   130                                 'svnisodate': svnisodate,
       
   131                                 'svnutcdate': svnutcdate})
   128 
   132 
   129 # make keyword tools accessible
   133 # make keyword tools accessible
   130 kwtools = {'templater': None, 'hgcmd': ''}
   134 kwtools = {'templater': None, 'hgcmd': ''}
   131 
   135 
   132 def _defaultkwmaps(ui):
   136 def _defaultkwmaps(ui):
   185         if kwmaps: # override default templates
   189         if kwmaps: # override default templates
   186             self.templates = dict((k, templater.parsestring(v, False))
   190             self.templates = dict((k, templater.parsestring(v, False))
   187                                   for k, v in kwmaps)
   191                                   for k, v in kwmaps)
   188         else:
   192         else:
   189             self.templates = _defaultkwmaps(self.ui)
   193             self.templates = _defaultkwmaps(self.ui)
   190         templatefilters.filters.update({'utcdate': utcdate,
       
   191                                         'svnisodate': svnisodate,
       
   192                                         'svnutcdate': svnutcdate})
       
   193 
   194 
   194     @util.propertycache
   195     @util.propertycache
   195     def escape(self):
   196     def escape(self):
   196         '''Returns bar-separated and escaped keywords.'''
   197         '''Returns bar-separated and escaped keywords.'''
   197         return '|'.join(map(re.escape, self.templates.keys()))
   198         return '|'.join(map(re.escape, self.templates.keys()))