Mercurial > hg
comparison hgext/convert/__init__.py @ 5203:653790c2fa52
convert: wrap cached commits author remapping
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sun, 19 Aug 2007 17:38:07 +0200 |
parents | 33015dac5df5 |
children | 6f636d13f6b8 |
comparison
equal
deleted
inserted
replaced
5200:c7e8fe11f34a | 5203:653790c2fa52 |
---|---|
79 parents = {} | 79 parents = {} |
80 while visit: | 80 while visit: |
81 n = visit.pop(0) | 81 n = visit.pop(0) |
82 if n in known or n in self.map: continue | 82 if n in known or n in self.map: continue |
83 known[n] = 1 | 83 known[n] = 1 |
84 self.commitcache[n] = self.source.getcommit(n) | 84 commit = self.cachecommit(n) |
85 cp = self.commitcache[n].parents | |
86 parents[n] = [] | 85 parents[n] = [] |
87 for p in cp: | 86 for p in commit.parents: |
88 parents[n].append(p) | 87 parents[n].append(p) |
89 visit.append(p) | 88 visit.append(p) |
90 | 89 |
91 return parents | 90 return parents |
92 | 91 |
185 except IndexError: | 184 except IndexError: |
186 self.ui.warn( | 185 self.ui.warn( |
187 'Ignoring bad line in author file map %s: %s\n' | 186 'Ignoring bad line in author file map %s: %s\n' |
188 % (authorfile, line)) | 187 % (authorfile, line)) |
189 afile.close() | 188 afile.close() |
189 | |
190 def cachecommit(self, rev): | |
191 commit = self.source.getcommit(rev) | |
192 commit.author = self.authors.get(commit.author, commit.author) | |
193 self.commitcache[rev] = commit | |
194 return commit | |
190 | 195 |
191 def copy(self, rev): | 196 def copy(self, rev): |
192 commit = self.commitcache[rev] | 197 commit = self.commitcache[rev] |
193 do_copies = hasattr(self.dest, 'copyfile') | 198 do_copies = hasattr(self.dest, 'copyfile') |
194 filenames = [] | 199 filenames = [] |
241 for c in t: | 246 for c in t: |
242 num -= 1 | 247 num -= 1 |
243 desc = self.commitcache[c].desc | 248 desc = self.commitcache[c].desc |
244 if "\n" in desc: | 249 if "\n" in desc: |
245 desc = desc.splitlines()[0] | 250 desc = desc.splitlines()[0] |
246 author = self.commitcache[c].author | |
247 author = self.authors.get(author, author) | |
248 self.commitcache[c].author = author | |
249 self.ui.status("%d %s\n" % (num, desc)) | 251 self.ui.status("%d %s\n" % (num, desc)) |
250 self.copy(c) | 252 self.copy(c) |
251 | 253 |
252 tags = self.source.gettags() | 254 tags = self.source.gettags() |
253 ctags = {} | 255 ctags = {} |