comparison mercurial/localrepo.py @ 8854:980f5b7c5fb6

tags: drop nested function
author Matt Mackall <mpm@selenic.com>
date Thu, 18 Jun 2009 23:08:33 -0500
parents e28b7939d430
children 5096a47d8aec
comparison
equal deleted inserted replaced
8853:e28b7939d430 8854:980f5b7c5fb6
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 tagctxs(): 293 seen = set()
294 seen = set() 294 f = None
295 f = None 295 ctxs = []
296 ret = [] 296 for node in self.heads():
297 for node in self.heads(): 297 try:
298 try: 298 fnode = self[node].filenode('.hgtags')
299 fnode = self[node].filenode('.hgtags') 299 except error.LookupError:
300 except error.LookupError: 300 continue
301 continue 301 if fnode not in seen:
302 if fnode not in seen: 302 seen.add(fnode)
303 seen.add(fnode) 303 if not f:
304 if not f: 304 f = self.filectx('.hgtags', fileid=fnode)
305 f = self.filectx('.hgtags', fileid=fnode) 305 else:
306 else: 306 f = f.filectx(fnode)
307 f = f.filectx(fnode) 307 ctxs.append(f)
308 ret.append(f)
309 return reversed(ret)
310 308
311 # read the tags file from each head, ending with the tip 309 # read the tags file from each head, ending with the tip
312 for f in tagctxs(): 310 for f in reversed(ctxs):
313 readtags(f.data().splitlines(), f, "global") 311 readtags(f.data().splitlines(), f, "global")
314 312
315 try: 313 try:
316 data = encoding.fromlocal(self.opener("localtags").read()) 314 data = encoding.fromlocal(self.opener("localtags").read())
317 # localtags are stored in the local character set 315 # localtags are stored in the local character set