Mercurial > hg
changeset 22472:2e2577b0ccbe
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.
author | Mike Edgar <adgar@google.com> |
---|---|
date | Fri, 12 Sep 2014 17:43:37 -0400 |
parents | cc5f94db672b |
children | ca85306b3eb2 |
files | contrib/synthrepo.py |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/synthrepo.py Fri Sep 12 12:28:30 2014 -0700 +++ b/contrib/synthrepo.py Fri Sep 12 17:43:37 2014 -0400 @@ -307,7 +307,8 @@ # 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