comparison hgext/convert/git.py @ 8456:e9e2a2c9b294

convert: use set instead of dict
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sun, 17 May 2009 03:04:17 +0200
parents e3d3dad805f9
children 25e572394f5c
comparison
equal deleted inserted replaced
8455:a858b54d072b 8456:e9e2a2c9b294
61 61
62 def getchanges(self, version): 62 def getchanges(self, version):
63 self.modecache = {} 63 self.modecache = {}
64 fh = self.gitcmd("git diff-tree -z --root -m -r %s" % version) 64 fh = self.gitcmd("git diff-tree -z --root -m -r %s" % version)
65 changes = [] 65 changes = []
66 seen = {} 66 seen = set()
67 entry = None 67 entry = None
68 for l in fh.read().split('\x00'): 68 for l in fh.read().split('\x00'):
69 if not entry: 69 if not entry:
70 if not l.startswith(':'): 70 if not l.startswith(':'):
71 continue 71 continue
72 entry = l 72 entry = l
73 continue 73 continue
74 f = l 74 f = l
75 if f not in seen: 75 if f not in seen:
76 seen[f] = 1 76 seen.add(f)
77 entry = entry.split() 77 entry = entry.split()
78 h = entry[3] 78 h = entry[3]
79 p = (entry[1] == "100755") 79 p = (entry[1] == "100755")
80 s = (entry[1] == "120000") 80 s = (entry[1] == "120000")
81 self.modecache[(f, h)] = (p and "x") or (s and "l") or "" 81 self.modecache[(f, h)] = (p and "x") or (s and "l") or ""