comparison hgext/convert/filemap.py @ 25742:d859123e0f47

convert: add config option for disabling ancestor parent checks When converting merge commits, convert checks if any of the parents are ancestors of any of the other parents. To do this, it builds an ancestor list for every commit in the repository. On large repos this can take a long time (30min+). Let's add an option for disabling this check to preserve performance. The downside of this is that it may create unnecessary parent connections when enabled (which is unfortunate, but not incorrect). To verify, I ran the convert tests with the flag enabled, and verified the graph changes were all just to add new parents that were ancestors of existing parents.
author Durham Goode <durham@fb.com>
date Mon, 29 Jun 2015 13:44:24 -0700
parents 3f0744eeaeaf
children db677b70a298
comparison
equal deleted inserted replaced
25741:86fe3c404c1e 25742:d859123e0f47
154 self.convertedorder = None 154 self.convertedorder = None
155 self._rebuilt = False 155 self._rebuilt = False
156 self.origparents = {} 156 self.origparents = {}
157 self.children = {} 157 self.children = {}
158 self.seenchildren = {} 158 self.seenchildren = {}
159 # experimental config: convert.ignoreancestorcheck
160 self.ignoreancestorcheck = self.ui.configbool('convert',
161 'ignoreancestorcheck')
159 162
160 def before(self): 163 def before(self):
161 self.base.before() 164 self.base.before()
162 165
163 def after(self): 166 def after(self):
304 wrev.add(rev) 307 wrev.add(rev)
305 self.wantedancestors[rev] = wrev 308 self.wantedancestors[rev] = wrev
306 309
307 def getchanges(self, rev, full): 310 def getchanges(self, rev, full):
308 parents = self.commits[rev].parents 311 parents = self.commits[rev].parents
309 if len(parents) > 1: 312 if len(parents) > 1 and not self.ignoreancestorcheck:
310 self.rebuild() 313 self.rebuild()
311 314
312 # To decide whether we're interested in rev we: 315 # To decide whether we're interested in rev we:
313 # 316 #
314 # - calculate what parents rev will have if it turns out we're 317 # - calculate what parents rev will have if it turns out we're
330 hasbranchparent = False 333 hasbranchparent = False
331 for i, p1 in enumerate(parents): 334 for i, p1 in enumerate(parents):
332 mp1 = self.parentmap[p1] 335 mp1 = self.parentmap[p1]
333 if mp1 == SKIPREV or mp1 in knownparents: 336 if mp1 == SKIPREV or mp1 in knownparents:
334 continue 337 continue
335 isancestor = any(p2 for p2 in parents 338
336 if p1 != p2 and mp1 != self.parentmap[p2] 339 isancestor = (not self.ignoreancestorcheck and
337 and mp1 in self.wantedancestors[p2]) 340 any(p2 for p2 in parents
341 if p1 != p2 and mp1 != self.parentmap[p2]
342 and mp1 in self.wantedancestors[p2]))
338 if not isancestor and not hasbranchparent and len(parents) > 1: 343 if not isancestor and not hasbranchparent and len(parents) > 1:
339 # This could be expensive, avoid unnecessary calls. 344 # This could be expensive, avoid unnecessary calls.
340 if self._cachedcommit(p1).branch == branch: 345 if self._cachedcommit(p1).branch == branch:
341 hasbranchparent = True 346 hasbranchparent = True
342 mparents.append((p1, mp1, i, isancestor)) 347 mparents.append((p1, mp1, i, isancestor))