mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 23:38:50 +03:00
contrib/synthrepo: only generate 2 parents if model contains merges
If `hg analyze` is run on a revision set which contains no merges, then `hg synthesize` will raise IndexError trying to select from p2distance, which will be empty.
This commit is contained in:
parent
c1d6e28494
commit
6431a1d631
@ -307,7 +307,8 @@ def synthesize(ui, repo, descpath, **opts):
|
||||
|
||||
# the number of heads will grow without bound if we use a pure
|
||||
# model, so artificially constrain their proliferation
|
||||
if pick(parents) == 2 or len(heads) > random.randint(1, 20):
|
||||
toomanyheads = len(heads) > random.randint(1, 20)
|
||||
if p2distance[0] and (pick(parents) == 2 or toomanyheads):
|
||||
r2, p2 = pickhead(heads.difference([r1]), p2distance)
|
||||
else:
|
||||
r2, p2 = nullrev, nullid
|
||||
|
Loading…
Reference in New Issue
Block a user