graft: do not try to skip rev derived from ancestor more than once (issue6024)
We check 'x in revs' in other cases, so let's do the same.
The test case credits to Tom Prince.
#require docutils gettext $ $TESTDIR/check-gendoc zh_CN checking for parse errors