schacon / hg-git

mercurial to git bridge, pushed to directly from the hg-git plugin in Hg
GNU General Public License v2.0
620 stars 71 forks source link

clone fails on hg 1.3 #28

Closed efiring closed 14 years ago

efiring commented 14 years ago

Here is the traceback; see AttributeError at the end. (The clone works with hg 1.2.1.)

efiring@manini:~/programs/py/mpl$ hg clone git://github.com/jkseppan/matplotlib.git mpl-jouni-git fetching from : origin importing Hg objects into Git Counting objects: 32233, done. Compressing objects: 100% (6691/6691), done. Total 32233 (delta 25714), reused 31851 (delta 25395) importing Git objects into Hg at: 0/4121 * unknown exception encountered, details follow * report bug details to http://www.selenic.com/mercurial/bts * or mercurial@selenic.com * Mercurial Distributed SCM (version ef393d6ec030) * Extensions loaded: hgk, mq, convert, extdiff, record, bookmarks, parentrevspec, rebase, transplant, fetch, purge, svn, collapse, rdiff, hg-git Traceback (most recent call last): File "/usr/local/bin/hg", line 27, in mercurial.dispatch.run() File "/usr/local/lib/python2.6/dist-packages/mercurial/dispatch.py", line 16, in run sys.exit(dispatch(sys.argv[1:])) File "/usr/local/lib/python2.6/dist-packages/mercurial/dispatch.py", line 27, in dispatch return _runcatch(u, args) File "/usr/local/lib/python2.6/dist-packages/mercurial/dispatch.py", line 43, in _runcatch return _dispatch(ui, args) File "/usr/local/lib/python2.6/dist-packages/mercurial/dispatch.py", line 378, in _dispatch return runcommand(lui, repo, cmd, fullargs, ui, options, d) File "/usr/local/lib/python2.6/dist-packages/mercurial/dispatch.py", line 249, in runcommand ret = _runcommand(ui, options, cmd, d) File "/usr/local/lib/python2.6/dist-packages/mercurial/dispatch.py", line 430, in _runcommand return checkargs() File "/usr/local/lib/python2.6/dist-packages/mercurial/dispatch.py", line 383, in checkargs return cmdfunc() File "/usr/local/lib/python2.6/dist-packages/mercurial/dispatch.py", line 377, in d = lambda: util.checksignature(func)(ui, _args, _cmdoptions) File "/usr/local/lib/python2.6/dist-packages/mercurial/util.py", line 370, in check return func(_args, _kwargs) File "/usr/local/lib/python2.6/dist-packages/mercurial/extensions.py", line 103, in wrap util.checksignature(origfn), _args, _kwargs) File "/usr/local/lib/python2.6/dist-packages/mercurial/util.py", line 370, in check return func(_args, _kwargs) File "/home/efiring/programs/py/hg/hgsubversion/wrappers.py", line 195, in clone File "/usr/local/lib/python2.6/dist-packages/mercurial/util.py", line 370, in check return func(_args, _kwargs) File "/usr/local/lib/python2.6/dist-packages/mercurial/commands.py", line 622, in clone update=not opts.get('noupdate')) File "/usr/local/lib/python2.6/dist-packages/mercurial/hg.py", line 122, in clone src_repo = repository(ui, source) File "/usr/local/lib/python2.6/dist-packages/mercurial/hg.py", line 63, in repository repo = _lookup(path).instance(ui, path, create) File "/home/efiring/programs/py/hg/hg-git/gitrepo.py", line 17, in init git.fetch('origin') File "/home/efiring/programs/py/hg/hg-git/git_handler.py", line 107, in fetch self.import_git_objects(remote_name, refs) File "/home/efiring/programs/py/hg/hg-git/git_handler.py", line 644, in import_git_objects self.import_git_commit(commit) File "/home/efiring/programs/py/hg/hg-git/git_handler.py", line 801, in import_git_commit node = self.repo.commit_import_ctx(ctx, pa, force_files) File "/home/efiring/programs/py/hg/hg-git/hgrepo.py", line 57, in commit_import_ctx new[f] = self.filecommit(fctx, m1, m2, linkrev, trp, changed) AttributeError: 'parentrevspecrepo' object has no attribute 'filecommit'

undees commented 14 years ago

Hi, efiring. Mercurial 1.3 is still in development, so I'm a little hesitant to go diving into an API that might change between now and July 1, the slated release date. But I'm leaving myself a reminder to try "hg gclone" once 1.3 hits code freeze in a few weeks.

abderrahim commented 14 years ago

this should be fixed in 53ef6f725598 (on bitbucket)

undees commented 14 years ago

Hi, abderrahim.

Thanks for the patch. This does indeed get gclone working with a fresh copy of Mercurial 1.3. I've transplanted your fix into github, tried it out, and will send Scott a pull request.

--Ian

abderrahim commented 14 years ago

No, you shouldn't transplant public changes like this (it will cause merge problems later). Besides, this patch is pullable as-is, it has the same parent you transplanted it to (if this isn't the case, it's been cobrrupted by some buggy version of hg-git and should be handled carefully).

(about the pull request, Scott hasn't committed to hg-git since a month, he may be busy. Besides, he should be able to pull from me directly :-))

undees commented 14 years ago

The patch is not pullable as-is, which is why I transplanted it. Its parent is 559f in a fresh clone of Scott's repo (using the current hg-git version), and 88fd on BitBucket.

Scott's been busy the last couple of weeks with version 1.0 of a brand new project: http://twitter.com/chacon/status/2456605736. He'll get to it eventually.

abderrahim commented 14 years ago

This needs to be handled carefully (transplant is not the way to go) see issue #26 the transplanted changeset message contains an --HG-- section, and this isn't good. undees@e9384a19bdf73af966f847fc4920455b4c85c382

I'll try to look at the issue once Scott is back (he needs to update the bitbucket repo).

abderrahim commented 14 years ago

The more I think about this, the more I think code shouldn't have gone through hg-git in the first place. the solution I see actually is to take one of the different versions the repo and replicate it all over the place.

undees commented 14 years ago

Well, there's something to be said for dog-fooding, which is why I've used hg-git to submit patches for hg-git. You raise a good point about hashes from old versions, though. Still, it's not the end of the world if some folks work on the project purely in Mercurial, and some through hg-git. We're not exactly talking about thousands of kernel patches a day....

abderrahim commented 14 years ago

yes, I'm just thinking that Scott's local clone won't need to transplant. by the way, I've also made mistakes by transplanting and rebasing local changes, these appear in the git changelog.

Still, it's not the end of the world if some folks work on the project purely in Mercurial, and some through hg-git.

That's why I proposed to take some version of a repo and replicate it using a current hg-git.

ghost commented 14 years ago

Hi guys,

As my first post here I would like to thank you all for the amazing work around hg-git. Congratulation !

Since Hg 1.3 is out now (and included in distros such Fedora), is it possible to have a quick status about the inclusion of this patch, please ?

I tried abderrahim's branch at http://bitbucket.org/abderrahim/hg-git but it does not seem to work, the gclone command is missing ...

No urgency of course ! Thanks a lot ! Cheers, Chicha

undees commented 14 years ago

Hi, chicha.

In abderrahim's version, the gclone functionality is rolled into the regular clone command. So you just type:

hg clone git://github.com/username/repo

or:

hg clone git+ssh://github.com/username/repo

Hope this helps...

ghost commented 14 years ago

It helps a lot :-) Thanks ! The more I think about hg-git the more I find the idea awsome ...

ctrochalakis commented 14 years ago

Yes but how can you clone a local git repo with the git::// syntax?

a few minutes later: This is apparently a known issue, http://bitbucket.org/abderrahim/hg-git/issue/5/unable-to-communicate-with-a-local-git