Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compatibility with Mercurial 3.2 #28

Closed
wants to merge 4 commits into from

Conversation

fingolfin
Copy link
Contributor

This fixes issue #27.

if check_version(3, 2):
return None
else:
raise IOError

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this for? I commented out this part and it still works fine for me. Could you refer to the Mercurial changeset/documentation which prompted for this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is necessary because the getfilectx has changed in a way that makes this change necessary. The change is even documented in a comment in the mercurial sources. In any case, the git-remote-hg test suite reveals the issue.

@Lekensteyn
Copy link

It would be nice if the commit message is slightly more expanded, by referring the links/text at #27 (comment) for example.

I also see that the author uses the S-o-b line, perhaps you should use that too? (implying that you understand the conditions of the S-o-b line of course).

@fingolfin
Copy link
Contributor Author

The commit fixes failures of the test suite with Mercurial 3.2. I don't think there is much else to say. Looking at past commits by the author (and judging on past discussions with him about the subject on the git mailing list), I don't have the feeling he values this much.

Anyway, the changes are trivial and obvious. Everybody is free to rewrite them and / or the commit message to their liking. I simply wanted to fix git-remote-hg for my personal use, and thought it might be helpful for others.

@fingolfin
Copy link
Contributor Author

This needs work anyway, as according to Travis, compatibility with hg 3.0 and older has been broken (while it seems to still work with 3.1.2 on my machine). Somebody will have to look into that, too.

@michaeljones
Copy link

I'm afraid I'm not in a place to comment on the implementation details but with the current latest from this repo I ended up in a place with this error:

$ git push origin branches/branch-name
transaction abort!
rollback completed
Traceback (most recent call last):
  File "/home/mike/bin/git-remote-hg", line 1322, in <module>
    sys.exit(main(sys.argv))
  File "/home/mike/bin/git-remote-hg", line 1308, in main
    do_export(parser)
  File "/home/mike/bin/git-remote-hg", line 1099, in do_export
    parse_commit(parser)
  File "/home/mike/bin/git-remote-hg", line 871, in parse_commit
    node = hghex(repo.commitctx(ctx))
  File "..../local/lib/python2.7/site-packages/mercurial/localrepo.py", line 63, in wrapper
    return orig(repo.unfiltered(), *args, **kwargs)
  File "..../local/lib/python2.7/site-packages/mercurial/localrepo.py", line 1409, in commitctx
    fctx = ctx[f]
  File "..../local/lib/python2.7/site-packages/mercurial/context.py", line 66, in __getitem__
    return self.filectx(key)
  File "..../local/lib/python2.7/site-packages/mercurial/context.py", line 1674, in filectx
    return self._filectxfn(self._repo, self, path)
  File "/home/mike/bin/git-remote-hg", line 806, in getfilectx
    raise IOError
IOError
error: fast-export died of signal 13
fatal: Error while running fast-export

Which is awkwardly unhelpful.

And with @fingolfin changes in this pull request, it works. Thanks very much to @fingolfin as I prefer git and this error had me worried that I had to go back to mercurial.

Cheers,
Michael

They work, as long as the hg-git / dulwhich versions
are suitable. We should eventually verify that.
This needs to be investigated. Failure occurs with hg-git 0.7.0 and various
Mercurial versions, including 2.6.3 and 3.2.4).
@fingolfin
Copy link
Contributor Author

Note: Please don't be fooled by the failing tests. They are failing for the parent commit, too, and are due to an incompatibility of recent hg dev versions with hg-git 0.7.0. But hg-git dev in turn introduces problems for git-remote-hg of its own, see issue #35.

@signalpillar
Copy link

This issue is till relevant - not compatible with the latest mercurial.
I used mercurial==3.1 to make it work.

@fingolfin
Copy link
Contributor Author

@signalpillar Wait, are you talking about this repos, or are you talking about my fork?

@signalpillar
Copy link

@fingolfin, I followed instructions from this repo

  1. Installation step
wget https://raw.github.com/felipec/git-remote-hg/master/git-remote-hg -O ~/bin/git-remote-hg
chmod +x ~/bin/git-remote-hg
  1. mercurial version is the latest
$ pip show mercurial
---
Metadata-Version: 1.1
Name: mercurial
Version: 3.4.1
Summary: Fast scalable distributed SCM (revision control, version control) system
Home-page: http://mercurial.selenic.com/
Author: Matt Mackall and many others
Author-email: mercurial@selenic.com
License: GNU GPLv2 or any later version
Location: /Users/signalpillar/.pyenv/versions/2.7.8/lib/python2.7/site-packages
Requires:
  1. Clone demo repo
$ git clone "hg::http://selenic.com/repo/hello"
Cloning into 'hello'...
warning: selenic.com certificate with fingerprint f0:40:cc:b9:46:62:b6:69:48:c5:1a:65:d0:34:35:22:b6:e0:1b:87 not verified (check hostfingerprints or web.cacerts config setting)
real URL is https://selenic.com/repo/hello
Traceback (most recent call last):
  File "/Users/signalpillar/bin/git-remote-hg", line 1322, in <module>
    sys.exit(main(sys.argv))
  File "/Users/signalpillar/bin/git-remote-hg", line 1286, in main
    repo = get_repo(url, alias)
  File "/Users/signalpillar/bin/git-remote-hg", line 433, in get_repo
    repo.pull(peer, heads=None, force=True)
  File "/Users/signalpillar/.pyenv/versions/2.7.8/lib/python2.7/site-packages/mercurial/repoview.py", line 335, in __getattr__
    return getattr(self._unfilteredrepo, attr)
AttributeError: 'localrepository' object has no attribute 'pull'
  1. Rollback to version 3.1 and now clone works.

@tboegi
Copy link
Contributor

tboegi commented Jun 10, 2015

@signalpillar: Can you try the version from fingolfin:
wget https://raw.github.com/fingolfin/git-remote-hg/master/git-remote-hg
^^^^^^^

lepistone added a commit to lepistone/dotfiles that referenced this pull request Jun 29, 2015
This is because of unsolved issues with recent mercurial:
felipec/git-remote-hg#28
@sleep-walker
Copy link

@tboegi, I had the same problem as @signalpillar, using @fingolfin fork fixed it.

@fingolfin fingolfin closed this Dec 4, 2015
@fingolfin fingolfin deleted the fix-hg-3.2 branch December 4, 2015 17:19
@alexei-31
Copy link

The author of this repository does not come for a long time, all of the latest patches (with this pull request) look in the @fingolfin repository: https://github.com/fingolfin/git-remote-hg

@alexei-31
Copy link

You can see this commit at e716a9e1 in that new fork.

@drothlis
Copy link

drothlis commented Feb 8, 2016

Note that if you use Debian or Ubuntu, the git-remote-hg package contains this patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants