diff -r 3de4c61b5087 -r 3a755652ce3a mercurial/commands.py --- a/mercurial/commands.py Tue May 09 21:27:06 2017 -0700 +++ b/mercurial/commands.py Fri May 12 11:20:25 2017 -0700 @@ -2308,7 +2308,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: