equal
deleted
inserted
replaced
73 |
73 |
74 def utcdate(date): |
74 def utcdate(date): |
75 '''Returns hgdate in cvs-like UTC format.''' |
75 '''Returns hgdate in cvs-like UTC format.''' |
76 return time.strftime('%Y/%m/%d %H:%M:%S', time.gmtime(date[0])) |
76 return time.strftime('%Y/%m/%d %H:%M:%S', time.gmtime(date[0])) |
77 |
77 |
78 templater.common_filters['utcdate'] = utcdate |
|
79 |
|
80 def kwfmatches(ui, repo, files): |
78 def kwfmatches(ui, repo, files): |
81 '''Selects candidates for keyword substitution |
79 '''Selects candidates for keyword substitution |
82 configured in keyword section in hgrc.''' |
80 configured in keyword section in hgrc.''' |
83 inc = [pat for pat, opt in ui.configitems('keyword') if opt != 'ignore'] |
81 inc = [pat for pat, opt in ui.configitems('keyword') if opt != 'ignore'] |
84 if not inc: |
82 if not inc: |
98 self.ui = ui |
96 self.ui = ui |
99 self.repo = repo |
97 self.repo = repo |
100 self.templates = dict(ui.configitems('keywordmaps')) or deftemplates |
98 self.templates = dict(ui.configitems('keywordmaps')) or deftemplates |
101 self.re_kw = re.compile(r'\$(%s)[^$]*?\$' % |
99 self.re_kw = re.compile(r'\$(%s)[^$]*?\$' % |
102 '|'.join(re.escape(k) for k in self.templates.keys())) |
100 '|'.join(re.escape(k) for k in self.templates.keys())) |
|
101 templater.common_filters['utcdate'] = utcdate |
103 self.t = cmdutil.changeset_templater(ui, repo, False, '', False) |
102 self.t = cmdutil.changeset_templater(ui, repo, False, '', False) |
104 |
103 |
105 |
104 |
106 def expand(self, mobj, path, node): |
105 def expand(self, mobj, path, node): |
107 '''Expands keyword with corresponding template.''' |
106 '''Expands keyword with corresponding template.''' |