1
votes

I am trying to convert a mercurial (hg) repository to Subversion (svn). (The reason for this is I'm using a tool that uses SVNKit, and I want to run it on the data from the hg repo.)

So to do this I ran the Mercurial convert extension:

hg convert --dest-type svn mercurialrepo svnrepo

It all seems to be working correctly as it starts with this output:

initializing svn working copy 'svnrepo-wc'
scanning source...
sorting...
converting...
4336 Some commit message
4335 Some other commit message

Up until the point it gives me the message abort: svn exited with status 1:

4175 Another commit message
abort: svn exited with status 1

Any idea what this means and/or how to solve it?

Moreover it looks as though he converted 160 revisions, but when I go into the svn working copy and do svn log it only shows 35 revisions!

Update: adding the --debug and --traceback flags as per DJanssens' suggestion:

This is the last one that went fine:

4302 Removed file ProjectService in ext
source: afb26afbb72ba500fcb0b42c3c386540fbfa11fa
converting: 34/4337 revisions (0.78%)
getting files: historia4-web/src/main/webapp/META-INF/maven/be.vlaanderen.awv.historia4/historia4-web/pom.properties 1/3 (33.33%)
getting files: historia4-web/src/main/webapp/index.jsp 2/3 (66.67%)
getting files: historia4-web/src/main/webapp/js/be/vlaanderen/awv/historia4/services/ProjectService.js 3/3 (100.00%)
running: 'svn' 'delete' 'historia4-web/src/main/webapp/js/be/vlaanderen/awv/historia4/services/ProjectService.js'
D         historia4-web/src/main/webapp/js/be/vlaanderen/awv/historia4/services/ProjectService.js
running: 'svn' 'commit' '--username=schoovlo' '--file=/var/folders/q1/pxdczzk90xz28qdkk3r0krsw0000gn/T/hg-convert-SVLDzc' '--encoding=utf-8'
Sending        historia4-web/src/main/webapp/META-INF/maven/be.vlaanderen.awv.historia4/historia4-web/pom.properties
Sending        historia4-web/src/main/webapp/index.jsp
Deleting       historia4-web/src/main/webapp/js/be/vlaanderen/awv/historia4/services/ProjectService.js
Transmitting file data ..
Committed revision 35.
running: 'svn' 'propset' 'hg:convert-branch' 'HISTIV-8-projectDef' '--revprop' '--revision=35'
property 'hg:convert-branch' set on repository revision 35

Here it started doing weird stuff:

4301 HISTIV-8-projectDef afgerond
source: 55f79e40185fe81420008da5489e5736bb938818
converting: 35/4337 revisions (0.81%)
running: 'svn' 'commit' '--username=schoovlo' '--file=/var/folders/q1/pxdczzk90xz28qdkk3r0krsw0000gn/T/hg-convert-VBOvIH' '--encoding=utf-8'
4300 HISTIV-8 merged into default
source: dc46a9b84cebf41cd1cc1a771678a14c2cbce780
converting: 36/4337 revisions (0.83%)

And at the end I get:

4175 Wat wijzigingen en optimalisaties
source: efd1149f1f767e2f3afff2bc1f5573041c446b5f
converting: 161/4337 revisions (3.71%)
getting files: historia2-data-import/src/main/java/be/vlaanderen/awv/etl/common/transformers/CachedLookupTransformer.groovy 1/2 (50.00%)
getting files: historia2-data-import/src/main/java/be/vlaanderen/awv/etl/common/transformers/SourceDestColumnMapper.java 2/2 (100.00%)
running: 'svn' 'delete' 'historia2-data-import/src/main/java/be/vlaanderen/awv/etl/common/transformers/CachedLookupTransformer.groovy' 'historia2-data-import/src/main/java/be/vlaanderen/awv/etl/common/transformers/SourceDestColumnMapper.java'
svn: E155007: '/Users/quinten/Desktop/EXPERIMENT/TEST_SELECTION_QMINO/QMINO/cloneSVN/cloneSVN-wc/historia2-data-import/src/main/java/be/vlaanderen/awv/etl/common/transformers/CachedLookupTransformer.groovy' is not a working copy
run hg source post-conversion action
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/mercurial/dispatch.py", line 138, in _runcatch
return _dispatch(req)
  File "/Library/Python/2.7/site-packages/mercurial/dispatch.py", line 819, in _dispatch
cmdpats, cmdoptions)
  File "/Library/Python/2.7/site-packages/mercurial/dispatch.py", line 599, in runcommand
ret = _runcommand(ui, options, cmd, d)
  File "/Library/Python/2.7/site-packages/mercurial/dispatch.py", line 910, in _runcommand
return checkargs()
  File "/Library/Python/2.7/site-packages/mercurial/dispatch.py", line 881, in checkargs
return cmdfunc()
  File "/Library/Python/2.7/site-packages/mercurial/dispatch.py", line 816, in <lambda>
d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/Library/Python/2.7/site-packages/mercurial/util.py", line 518, in check
return func(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/hgext/convert/__init__.py", line 283, in convert
return convcmd.convert(ui, src, dest, revmapfile, **opts)
  File "/Library/Python/2.7/site-packages/hgext/convert/convcmd.py", line 527, in convert
c.convert(sortmode)
  File "/Library/Python/2.7/site-packages/hgext/convert/convcmd.py", line 444, in convert
self.copy(c)
  File "/Library/Python/2.7/site-packages/hgext/convert/convcmd.py", line 412, in copy
source, self.map)
  File "/Library/Python/2.7/site-packages/hgext/convert/subversion.py", line 1257, in putcommit
self.xargs(self.delete, 'delete')
  File "/Library/Python/2.7/site-packages/hgext/convert/common.py", line 386, in xargs
self.run0(cmd, *(list(args) + l), **kwargs)
  File "/Library/Python/2.7/site-packages/hgext/convert/common.py", line 341, in run0
self.checkexit(status, output)
  File "/Library/Python/2.7/site-packages/hgext/convert/common.py", line 337, in checkexit
raise util.Abort('%s %s' % (self.command, msg))
Abort: svn exited with status 1
abort: svn exited with status 1

So apparently it doesn't like the *.groovy files. My next move was to exclude the problematic files using the filemap option:

hg convert --debug --traceback --filemap filemap --dest-type svn . cloneSVN 

With filemap a file containing:

exclude whateverfileismakingtheproblem

But then the same problem occurs a little ways down the road with a different file.

The way I see it now, the problem is that at some point there is a revisions in which a file X is deleted. But there was a problem earlier, when the converter for some reason skipped the revison in which file X was added. So svn is then complaining that we're deleting something that isn't there to be deleted in the first place.

1
The error code is quite cryptic, perhaps you get more detailed information if you use the --debug and --traceback options?DJanssens
Tried the --debug --traceback problems, made it more clear as to what the problem is, but still don't know how to solve it.Quinten Soetens
Sadly I'm not an expert on this either. I've had my part of issues with svn in the past and remembered that the --debug option could save some time. Let's hope an expert can shed some light on the issue. I guess the extra debug information can only help speeding this process up. Goodluck!DJanssens
@QuintenSoetens: abort: svn exited with status 1 just means that when mercurial called svn, svn reported an error. Nothing specific, just an error. The error was svn: E155007: '/Users/quinten/Desktop/EXPERIMENT/TEST_SELECTION_QMINO/QMINO/cloneSVN/cloneSVN-wc/historia2-data-import/src/main/java/be/vlaanderen/awv/etl/common/transformers/CachedLookupTransformer.groovy' is not a working copy, but I think you worked that out. Is that path a directory? Is it something to do with mercurial not storing empty directories?Paul S

1 Answers

1
votes

I'm not Mercurial expert in any way, but I'll suggest some (own) observations and ideas

  1. You can|have to use REVMAP additional parameter on conversion

REVMAP is a a simple text file that maps each source commit ID to the destination ID for each revision

says Convert Extension wiki

In ideal conversion case (full conversion, no errors) left column on REVMAP-file will be identical to

hg log -T "{node}\n" -r :

Parts of my REVMAP and log of SRC-repo

2c96d0cff382e13bb39d1b064ed098cbab230142 svn:d4a602fb-2afa-8b43-af74-725bfcbd86c9@1
3f05a3b07a29e8772e22cca847ce07e461d972f5 svn:d4a602fb-2afa-8b43-af74-725bfcbd86c9@2
696aa5701fd7822fec76cc1b7b203ad1772e38c8 svn:d4a602fb-2afa-8b43-af74-725bfcbd86c9@3
2f09429039a6d062d8135f652bbcb8be7a798443 svn:d4a602fb-2afa-8b43-af74-725bfcbd86c9@4
97419f57d7db28ace15066df7fb7ec7692536a30 svn:d4a602fb-2afa-8b43-af74-725bfcbd86c9@5

2c96d0cff382e13bb39d1b064ed098cbab230142
3f05a3b07a29e8772e22cca847ce07e461d972f5
696aa5701fd7822fec76cc1b7b203ad1772e38c8
2f09429039a6d062d8135f652bbcb8be7a798443
97419f57d7db28ace15066df7fb7ec7692536a30

In your case it will be trimmed at first "bad" changeset, but in REVMAP (comparing it with log) you'll be able to find skipped earlier changesets

  1. Convert Extension can convert only part of repo (-r parameter) and, if in sequential usage

    hg convert --dest-type svn SRC DST REVMAP -r N

DST and REVMAP aren't changed, convert perform incremental conversion and >> additional conversions to REVMAP instead of overwriting it at each step. I.e I converted 40-changesets SRC with single hg convert --dest-type svn SRC DST REVMAP or with hg convert --dest-type svn SRC DST REVMAP -r (10|20|30|40) and got identical DSTs as result. This way you can try to convert only problematic (identified as skipped at step 1) revisions without redoing all work (convert with -r $SKIPPED-1 once and -r $SKIPPED a lot times later). Maybe you'll fill bug-report with such "skippable" changesets to Mercurial devs as result of your research (as last resort) and they will be able to change something at their side

  1. If you task isn't preparing convert's oddities, but getting result (usable SVN-repo), you can think about "conversion" to SVN with hgsubversion and pushing to SVN-repository (create empty SVN-repo, publish it with any access-protocol except file:///, push to repo /probably with -f, if "Repositories unrelated"/)