diff -r 78fb569e2c33 -r b4e1e30528c7 mercurial/commands.py --- a/mercurial/commands.py Tue May 09 00:11:30 2017 +0200 +++ b/mercurial/commands.py Thu May 11 17:18:40 2017 +0200 @@ -2295,7 +2295,9 @@ # check ancestors for earlier grafts ui.debug('scanning for duplicate grafts\n') - for rev in repo.changelog.findmissingrevs(revs, [crev]): + # The only changesets we can be sure doesn't contain grafts of any + # revs, are the ones that are common ancestors of *all* revs: + for rev in repo.revs('only(%d,ancestor(%ld))', crev, revs): ctx = repo[rev] n = ctx.extra().get('source') if n in ids: