There are a few xfailing unit tests that demonstrate that pushing tags from git to mercurial is not working. I poked around at this tonight and discovered a few useful pieces of knowledge and tidbits of information that we'll need to think about.
The main problem is that creating a tag in hg requires making a commit, whereas in git, no commit is necessary. This means we have to modify the tree somehow. I can see two options:
When we push a tag from git, we insert a mercurial commit with the new tag into the history. We would have to keep track of the tags, and if any subsequent commits have the tagged commit as a parent, we make those commits point at the inserted commit as parent instead of at the tagged commit.
I worry about special cases such as what happens if there is a named or anonymous branch immediately after taggedcommit. Can we just insert it before the branch?
Do we have to do anything special with such commits when pushing to make sure that they don't bung up the works in git's workflow? Perhaps we should just drop commits that touch .hgtags when pulling from hg to git.
We put the tag on a second anonymous head. Thus
commit1----taggedcommit----commit3
in git becomes this in Mercurial:
commit1----taggedcommit---|
\-----commit3
This means we'd have to force gitifyhg to push anonymous heads, which I don't like. I think it's been providing very healthy debugging information when gitifyhg tries to create an anonymous branch. Also, if the commit modifying .hgtags becomes the tip of the repo, the code in gitifyhg that drops anonymous heads would kill commit3... not a good scenario.
The other problem I encountered is that in the test_push_tag test, git is sending a reset refs/tags/tagname command into the remote instead of a tag command. There is code in gitifyhg that expects a tag command, but apparently it never gets called --I think this code is legacy from felipec's design. The problem here is that the tag command would have supposedly sent author information that could be attached to the commit message in mercurial for the tag. However, this may all be because I'm not applying the git-remote protocol. I haven't found good documentation or examples of the protocol (I'm certain they must exist, but where??), so I learned it by introspecting felipec's code and the output of broken tests.
There are a few xfailing unit tests that demonstrate that pushing tags from git to mercurial is not working. I poked around at this tonight and discovered a few useful pieces of knowledge and tidbits of information that we'll need to think about.
The main problem is that creating a tag in hg requires making a commit, whereas in git, no commit is necessary. This means we have to modify the tree somehow. I can see two options:
Thus history that looks like this in git:
``` commit1----taggedcommit----commit3
would look like this in mercurial:
commit1----taggedcommit----commitmarkingtag----commit3
I worry about special cases such as what happens if there is a named or anonymous branch immediately after taggedcommit. Can we just insert it before the branch?
Do we have to do anything special with such commits when pushing to make sure that they don't bung up the works in git's workflow? Perhaps we should just drop commits that touch .hgtags when pulling from hg to git.
commit1----taggedcommit----commit3
in git becomes this in Mercurial:
This means we'd have to force gitifyhg to push anonymous heads, which I don't like. I think it's been providing very healthy debugging information when gitifyhg tries to create an anonymous branch. Also, if the commit modifying .hgtags becomes the tip of the repo, the code in gitifyhg that drops anonymous heads would kill commit3... not a good scenario.
The other problem I encountered is that in the
test_push_tag
test, git is sending areset refs/tags/tagname
command into the remote instead of atag
command. There is code in gitifyhg that expects a tag command, but apparently it never gets called --I think this code is legacy from felipec's design. The problem here is that the tag command would have supposedly sent author information that could be attached to the commit message in mercurial for the tag. However, this may all be because I'm not applying the git-remote protocol. I haven't found good documentation or examples of the protocol (I'm certain they must exist, but where??), so I learned it by introspecting felipec's code and the output of broken tests.