This is basically an import of the pullcreatemarkers extension[1] from the FB
repo, with minor adjustments to getmatchingdiff() to work with modern hg.
Since this is very phabricator specific, it makes more sense to me to bundle it
into the existing extension. It wasn't very obvious from the old name what
functionality was provided, and it may make sense to do this in other scenarios
besides hg pull.
There are two use cases that I can see- first, ensuring that old revisions are
cleaned up for a contributor (I seem to recall something I submitted recently
needed to be explicitly pruned, though most submissions do clean up
automatically). Second, any hg phabread | hg import - would otherwise need to
be manually cleaned up. The latter is annoying enough that I tend not to grab
the code and try it when reviewing.
It is currently guarded by a config option (off by default), because @marmoute
expressed concerns about duplicate marker creation if the pushing reviewer also
creates a marker. I don't think that's possible here, since the obsolete
revisions are explicitly excluded. But maybe there are other reasons someone
wouldn't want older revisions obsoleted. The config name reflects the fact that
I'm not sure if other things like import should get this too.
I suspect that we could wrap a function deeper in the pull sequence to improve
both the code and the UX. For example, when pulling an obsolete marker, it can
print out a warning that the working directory parent is obsolete, but that
doesn't happen here. (It won't happen with this test. It *should* without the
--bypass option, but doesn't.) It should also be possible to not have to
query the range of new revisions, and maybe it can be added to the existing
transaction.
[1] https://bitbucket.org/facebook/hg-experimental/src/default/hgext3rd/pullcreatemarkers.py
So, this only checks the diff number, right ? So in theory, we could obsolete a later version of this, silently dropping change (instead of detecting potential phase-divergence)