comparison hgext/hgk.py @ 3981:180670f14045

hgk: (re)optimize reading of changelog and manifest
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Tue, 26 Dec 2006 03:42:17 +0100
parents e0d13267f7a4
children cc08d2543593
comparison
equal deleted inserted replaced
3980:e9460fe2f548 3981:180670f14045
10 10
11 def difftree(ui, repo, node1=None, node2=None, *files, **opts): 11 def difftree(ui, repo, node1=None, node2=None, *files, **opts):
12 """diff trees from two commits""" 12 """diff trees from two commits"""
13 def __difftree(repo, node1, node2, files=[]): 13 def __difftree(repo, node1, node2, files=[]):
14 assert node2 is not None 14 assert node2 is not None
15 mmap = repo.changectx(node1).manifest()
15 mmap2 = repo.changectx(node2).manifest() 16 mmap2 = repo.changectx(node2).manifest()
16 status = repo.status(node1, node2, files=files)[:5] 17 status = repo.status(node1, node2, files=files)[:5]
17 modified, added, removed, deleted, unknown = status 18 modified, added, removed, deleted, unknown = status
18 19
19 mmap = repo.changectx(node1).manifest()
20 empty = hg.short(hg.nullid) 20 empty = hg.short(hg.nullid)
21 21
22 for f in modified: 22 for f in modified:
23 # TODO get file permissions 23 # TODO get file permissions
24 print ":100664 100664 %s %s M\t%s\t%s" % (hg.short(mmap[f]), 24 print ":100664 100664 %s %s M\t%s\t%s" % (hg.short(mmap[f]),
151 if i + x >= count: 151 if i + x >= count:
152 l[chunk - x:] = [0] * (chunk - x) 152 l[chunk - x:] = [0] * (chunk - x)
153 break 153 break
154 if full != None: 154 if full != None:
155 l[x] = repo.changectx(i + x) 155 l[x] = repo.changectx(i + x)
156 l[x].changeset() # force reading
156 else: 157 else:
157 l[x] = 1 158 l[x] = 1
158 for x in xrange(chunk-1, -1, -1): 159 for x in xrange(chunk-1, -1, -1):
159 if l[x] != 0: 160 if l[x] != 0:
160 yield (i + x, full != None and l[x] or None) 161 yield (i + x, full != None and l[x] or None)