comparison mercurial/localrepo.py @ 8853:e28b7939d430

tags: generate contexts directly
author Matt Mackall <mpm@selenic.com>
date Thu, 18 Jun 2009 23:04:54 -0500
parents a81652fcaf6b
children 980f5b7c5fb6
comparison
equal deleted inserted replaced
8852:a81652fcaf6b 8853:e28b7939d430
288 an = bn 288 an = bn
289 ah.extend([n for n in bh if n not in ah]) 289 ah.extend([n for n in bh if n not in ah])
290 globaltags[k] = an, ah 290 globaltags[k] = an, ah
291 tagtypes[k] = tagtype 291 tagtypes[k] = tagtype
292 292
293 def tagnodes(): 293 def tagctxs():
294 seen = set() 294 seen = set()
295 f = None
295 ret = [] 296 ret = []
296 for node in self.heads(): 297 for node in self.heads():
297 c = self[node]
298 try: 298 try:
299 fnode = c.filenode('.hgtags') 299 fnode = self[node].filenode('.hgtags')
300 except error.LookupError: 300 except error.LookupError:
301 continue 301 continue
302 if fnode not in seen: 302 if fnode not in seen:
303 ret.append((node, fnode))
304 seen.add(fnode) 303 seen.add(fnode)
304 if not f:
305 f = self.filectx('.hgtags', fileid=fnode)
306 else:
307 f = f.filectx(fnode)
308 ret.append(f)
305 return reversed(ret) 309 return reversed(ret)
306 310
307 # read the tags file from each head, ending with the tip 311 # read the tags file from each head, ending with the tip
308 f = None 312 for f in tagctxs():
309 for node, fnode in tagnodes():
310 f = (f and f.filectx(fnode) or
311 self.filectx('.hgtags', fileid=fnode))
312 readtags(f.data().splitlines(), f, "global") 313 readtags(f.data().splitlines(), f, "global")
313 314
314 try: 315 try:
315 data = encoding.fromlocal(self.opener("localtags").read()) 316 data = encoding.fromlocal(self.opener("localtags").read())
316 # localtags are stored in the local character set 317 # localtags are stored in the local character set