mercurialmercurial-phases

How to avoid mercurial obsolete warning on clients without evolve extension


I currently work for a company that uses mercurial, but most developers use MQ instead of the new evolve flow. Therefore, most users do not have the extension enabled.

Every time I push to the main repository, .hg/store/obsstore gets automatically pushed with the obsolete changesets. This is problematic because after that all users that do not have the extension enabled get the following message:

obsolete feature not enabled but 33 markers found!

One solution, proposed in this answer, involves deleting .obsstore locally, but that's not what I want, since I'm still working with evolve and that means I expect the obsolete changesets to remain hidden. Not only that, but obsolete markers and changesets should be available on the server repo so that we keep the benefits of using evolve such as intelligent conflict solving.

I'd expect a way to either not push the obsolete changesets to the server repo, or (the correct way) for the server to not push the obsolete data to clients without evolve enabled.

Is this possible? If not, why not?


Solution

  • I found a couple of workarounds (hacks) to this problem, since it looks like mercurial has no way to solve this issue as of the writing of this answer:

    Per-repository evolve extension

    Remove the evolve extension from the ~/.hgrc file, enable it on a per-repository basis, and then use SSH to point to the repository (in our case it is on NFS, which is the source of the problem).

    That is, on your repository's hgrc you'd have:

    # This is <repo>/.hg/hgrc
    [paths]
    default = ssh://localhost//path/to/origin/repo
    [extensions]
    evolve =
    

    and on ~/.hgrc:

    [extensions]
    # evolve =     => Disabled on purpose
    

    Removing obsolete markers using hooks

    Just use a hook to remove the .obspurge file on your repository's hgrc:

    # This is <repo>/.hg/hgrc
    [alias]
    obspurge = !echo "Purging obsolete markers" && rm /path/to/origin/repo/.hg/store/obsstore
    [hooks]
    post-push = hg obspurge