Skip to content

hg-git interacts poorly with phases.new-commit = secret

Created originally on Bitbucket by kamalmarhubi (Kamal Marhubi)

If phases.new-commit = secret, the changesets created by hg-git are secret. But the localrepo object it uses appears to filter out secret changesets. This results in the following sequence of events when cloning:

  1. hg-git imports the root commit with sha1 ababab as a root changeset with id 121212 whose phase is secret
  2. hg-git goes to import that next commit whose sha1 is cdcdcd, and for this it needs the mercurial changeset id of the parent, ababab
  3. hg-git looks up the ababab in the git-sha1-to-hg-commit-id map, and finds 121212
  4. hg-git then looks up this changeset id in the mercurial repo object
  5. the repo is filtering this revision out since it'ss secret, so it results in FilteredRepoLookupErrror
  6. boom

The two phase-related options—hggit.usephases and git.public—appear to affect other aspects of the import. Neither of them change either the phase of new commits, or the filter on the repo object.

This is the cause of the error I wrote about in my second mercurial blog post.

I'd be happy to submit a patch, but I'm not sure what the right fix is. I see at least two options:

  • set phases.new-commit to draft or public during clone and pull
  • change the filter on the localrepo to include secret changesets

While at this, it might make sense to redesign the phase-related options a little, but I'm too new at this to have a good feel of how to make them more intuitive.

Edited by Dan Villiom Podlaski Christiansen
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information