hg convert from git doesn't follow renames
Paul Molodowitch
elrond79 at gmail.com
Tue Nov 3 10:23:45 CST 2009
>> Was looking to switch my repo over from git to hg, but I ran into a
>> bit of a snag - it seems hg convert from git doesn't preserve renaming
>> information.
>
> One possibility is to use fastimport. That is, dump the git repo with
> 'git fast-export', then use the hg-fastimport extension
> (http://mercurial.selenic.com/wiki/FastImportExtension) to load it
> into Mercurial. *If* it works, I think it will do a more accurate
> conversion than hg convert does.
Hmm.. this seems promising! Unfortunately, when I tested it out with a
simple git repo, which I'd dumped using:
cd gitRepo
git fast-export --all -M -C > ..\gitDump
cd ..
hg init hgFastImp
cd hgFastImp
hg fastimport ..\gitDump
...I got the following traceback:
Traceback (most recent call last):
File "C:\Dev\Python25\Scripts\hg", line 5, in <module>
pkg_resources.run_script('mercurial==1.3.1', 'hg')
File "C:\Dev\Python25\lib\site-packages\pkg_resources.py", line 448,
in run_script
self.require(requires)[0].run_script(script_name, ns)
File "C:\Dev\Python25\lib\site-packages\pkg_resources.py", line
1166, in run_script
execfile(script_filename, namespace, namespace)
File "c:\dev\python25\lib\site-packages\mercurial-1.3.1-py2.5-win32.egg\EGG-INFO\scripts\hg",
line 27, in <module>
mercurial.dispatch.run()
File "C:\Dev\Python25\lib\site-packages\mercurial-1.3.1-py2.5-win32.egg\mercurial\dispatch.py",
line 16, in run
sys.exit(dispatch(sys.argv[1:]))
File "C:\Dev\Python25\lib\site-packages\mercurial-1.3.1-py2.5-win32.egg\mercurial\dispatch.py",
line 27, in dispatch
return _runcatch(u, args)
File "C:\Dev\Python25\lib\site-packages\mercurial-1.3.1-py2.5-win32.egg\mercurial\dispatch.py",
line 43, in _runcatch
return _dispatch(ui, args)
File "C:\Dev\Python25\lib\site-packages\mercurial-1.3.1-py2.5-win32.egg\mercurial\dispatch.py",
line 449, in _dispatch
return runcommand(lui, repo, cmd, fullargs, ui, options, d)
File "C:\Dev\Python25\lib\site-packages\mercurial-1.3.1-py2.5-win32.egg\mercurial\dispatch.py",
line 317, in runcommand
ret = _runcommand(ui, options, cmd, d)
File "C:\Dev\Python25\lib\site-packages\mercurial-1.3.1-py2.5-win32.egg\mercurial\dispatch.py",
line 501, in _runcommand
return checkargs()
File "C:\Dev\Python25\lib\site-packages\mercurial-1.3.1-py2.5-win32.egg\mercurial\dispatch.py",
line 454, in checkargs
return cmdfunc()
File "C:\Dev\Python25\lib\site-packages\mercurial-1.3.1-py2.5-win32.egg\mercurial\dispatch.py",
line 448, in <lambda>
d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
File "C:\Dev\Python25\lib\site-packages\mercurial-1.3.1-py2.5-win32.egg\mercurial\util.py",
line 402, in check
return func(*args, **kwargs)
File "C:\Dev\Python25\Lib\site-packages\hg-fastimport\hgfastimport\__init__.py",
line 44, in fastimport
c.convert(sortmode)
File "C:\Dev\Python25\lib\site-packages\mercurial-1.3.1-py2.5-win32.egg\hgext\convert\convcmd.py",
line 311, in convert
heads = self.source.getheads()
File "C:\Dev\Python25\lib\site-packages\hg-fastimport\hgfastimport\hgimport.py",
line 50, in getheads
self._parse()
File "C:\Dev\Python25\lib\site-packages\hg-fastimport\hgfastimport\hgimport.py",
line 112, in _parse
processor.parseMany(self.sources, parser.ImportParser, self.processor)
File "C:\Dev\Python25\Lib\site-packages\pyfastimport\fastimport\processor.py",
line 219, in parseMany
processor.process(parser.parse())
File "C:\Dev\Python25\Lib\site-packages\pyfastimport\fastimport\processor.py",
line 76, in process
handler(self, cmd)
File "C:\Dev\Python25\lib\site-packages\hg-fastimport\hgfastimport\hgimport.py",
line 275, in commit_handler
commit_handler.process()
File "C:\Dev\Python25\Lib\site-packages\pyfastimport\fastimport\processor.py",
line 154, in process
handler(self, fc)
File "C:\Dev\Python25\lib\site-packages\hg-fastimport\hgfastimport\hgimport.py",
line 408, in rename_handler
self.copies[filecmd.oldname] = filecmd.newname
AttributeError: 'FileRenameCommand' object has no attribute 'newname'
I'll poke around in hg-fastimport's code a little later - hopefully
there's an easy fix!
- Paul
More information about the Mercurial
mailing list