##// END OF EJS Templates
convert: refactor head calculation for hg sources
Mads Kiilerich -
r19890:9057855d default
parent child Browse files
Show More
@@ -260,11 +260,15 b' class mercurial_source(converter_source)'
260 % startnode)
260 % startnode)
261 startrev = self.repo.changelog.rev(startnode)
261 startrev = self.repo.changelog.rev(startnode)
262 children = {startnode: 1}
262 children = {startnode: 1}
263 for rev in self.repo.changelog.descendants([startrev]):
263 for r in self.repo.changelog.descendants([startrev]):
264 children[self.repo.changelog.node(rev)] = 1
264 children[self.repo.changelog.node(r)] = 1
265 self.keep = children.__contains__
265 self.keep = children.__contains__
266 else:
266 else:
267 self.keep = util.always
267 self.keep = util.always
268 if rev:
269 self._heads = [self.repo[rev].node()]
270 else:
271 self._heads = self.repo.heads()
268
272
269 def changectx(self, rev):
273 def changectx(self, rev):
270 if self.lastrev != rev:
274 if self.lastrev != rev:
@@ -276,11 +280,7 b' class mercurial_source(converter_source)'
276 return [p for p in ctx.parents() if p and self.keep(p.node())]
280 return [p for p in ctx.parents() if p and self.keep(p.node())]
277
281
278 def getheads(self):
282 def getheads(self):
279 if self.rev:
283 return [hex(h) for h in self._heads if self.keep(h)]
280 heads = [self.repo[self.rev].node()]
281 else:
282 heads = self.repo.heads()
283 return [hex(h) for h in heads if self.keep(h)]
284
284
285 def getfile(self, name, rev):
285 def getfile(self, name, rev):
286 try:
286 try:
General Comments 0
You need to be logged in to leave comments. Login now