##// END OF EJS Templates
templatekw: allow getlatesttags() to match a specific tag pattern...
Matt Harbison -
r26482:d2e69584 default
parent child Browse files
Show More
@@ -122,14 +122,21 b' def getfiles(repo, ctx, revcache):'
122 revcache['files'] = repo.status(ctx.p1(), ctx)[:3]
122 revcache['files'] = repo.status(ctx.p1(), ctx)[:3]
123 return revcache['files']
123 return revcache['files']
124
124
125 def getlatesttags(repo, ctx, cache):
125 def getlatesttags(repo, ctx, cache, pattern=None):
126 '''return date, distance and name for the latest tag of rev'''
126 '''return date, distance and name for the latest tag of rev'''
127
127
128 if 'latesttags' not in cache:
128 cachename = 'latesttags'
129 if pattern is not None:
130 cachename += '-' + pattern
131 match = util.stringmatcher(pattern)[2]
132 else:
133 match = util.always
134
135 if cachename not in cache:
129 # Cache mapping from rev to a tuple with tag date, tag
136 # Cache mapping from rev to a tuple with tag date, tag
130 # distance and tag name
137 # distance and tag name
131 cache['latesttags'] = {-1: (0, 0, ['null'])}
138 cache[cachename] = {-1: (0, 0, ['null'])}
132 latesttags = cache['latesttags']
139 latesttags = cache[cachename]
133
140
134 rev = ctx.rev()
141 rev = ctx.rev()
135 todo = [rev]
142 todo = [rev]
@@ -139,7 +146,8 b' def getlatesttags(repo, ctx, cache):'
139 continue
146 continue
140 ctx = repo[rev]
147 ctx = repo[rev]
141 tags = [t for t in ctx.tags()
148 tags = [t for t in ctx.tags()
142 if (repo.tagtype(t) and repo.tagtype(t) != 'local')]
149 if (repo.tagtype(t) and repo.tagtype(t) != 'local'
150 and match(t))]
143 if tags:
151 if tags:
144 latesttags[rev] = ctx.date()[0], 0, [t for t in sorted(tags)]
152 latesttags[rev] = ctx.date()[0], 0, [t for t in sorted(tags)]
145 continue
153 continue
General Comments 0
You need to be logged in to leave comments. Login now