##// 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 122 revcache['files'] = repo.status(ctx.p1(), ctx)[:3]
123 123 return revcache['files']
124 124
125 def getlatesttags(repo, ctx, cache):
125 def getlatesttags(repo, ctx, cache, pattern=None):
126 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 136 # Cache mapping from rev to a tuple with tag date, tag
130 137 # distance and tag name
131 cache['latesttags'] = {-1: (0, 0, ['null'])}
132 latesttags = cache['latesttags']
138 cache[cachename] = {-1: (0, 0, ['null'])}
139 latesttags = cache[cachename]
133 140
134 141 rev = ctx.rev()
135 142 todo = [rev]
@@ -139,7 +146,8 b' def getlatesttags(repo, ctx, cache):'
139 146 continue
140 147 ctx = repo[rev]
141 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 151 if tags:
144 152 latesttags[rev] = ctx.date()[0], 0, [t for t in sorted(tags)]
145 153 continue
General Comments 0
You need to be logged in to leave comments. Login now