Mercurial > hg
comparison mercurial/templatekw.py @ 33865:af20468eb0a4
merge with stable
author | Sean Farley <sean@farley.io> |
---|---|
date | Mon, 21 Aug 2017 21:35:06 -0700 |
parents | 6f6c87888b22 fb672eac2702 |
children | e278d6d2d7d2 |
comparison
equal
deleted
inserted
replaced
33864:70354bd4f19b | 33865:af20468eb0a4 |
---|---|
206 and match(t))] | 206 and match(t))] |
207 if tags: | 207 if tags: |
208 latesttags[rev] = ctx.date()[0], 0, [t for t in sorted(tags)] | 208 latesttags[rev] = ctx.date()[0], 0, [t for t in sorted(tags)] |
209 continue | 209 continue |
210 try: | 210 try: |
211 # The tuples are laid out so the right one can be found by | 211 ptags = [latesttags[p.rev()] for p in ctx.parents()] |
212 # comparison. | 212 if len(ptags) > 1: |
213 pdate, pdist, ptag = max( | 213 if ptags[0][2] == ptags[1][2]: |
214 latesttags[p.rev()] for p in ctx.parents()) | 214 # The tuples are laid out so the right one can be found by |
215 # comparison in this case. | |
216 pdate, pdist, ptag = max(ptags) | |
217 else: | |
218 def key(x): | |
219 changessincetag = len(repo.revs('only(%d, %s)', | |
220 ctx.rev(), x[2][0])) | |
221 # Smallest number of changes since tag wins. Date is | |
222 # used as tiebreaker. | |
223 return [-changessincetag, x[0]] | |
224 pdate, pdist, ptag = max(ptags, key=key) | |
225 else: | |
226 pdate, pdist, ptag = ptags[0] | |
215 except KeyError: | 227 except KeyError: |
216 # Cache miss - recurse | 228 # Cache miss - recurse |
217 todo.append(rev) | 229 todo.append(rev) |
218 todo.extend(p.rev() for p in ctx.parents()) | 230 todo.extend(p.rev() for p in ctx.parents()) |
219 continue | 231 continue |