3

I'm trying to convert our company's CVS to Mercurial but so far without success. Remote file history should be retained.

I tried the conversion tools described on RepositoryConversion - Mercurial

Convert extension

e:\Hg>hg convert -s CVS H:\Cvs
assuming destination cvs-hg
initializing destination cvs-hg repository
abort: CVS: invalid source repository type

What's going on!?

cvs2hg

Looks very promising, but errors out at the last moment.

python cvs2hg -v --encoding=UTF8 --hgrepos=e:/Hg h:/Cvs

Result after 10 minutes and 9 miles of text:

----- pass 14 (SortSymbolOpeningsClosingsPass) -----
Sorting symbolic name source revisions...
Done
Time for pass14 (SortSymbolOpeningsClosingsPass): 0.150 seconds.
Deleting cvs2svn-tmp\statistics-13.pck
Deleting cvs2svn-tmp\symbolic-names.txt
----- pass 15 (IndexSymbolsPass) -----
Determining offsets for all symbolic names...
  VERSION_0_22
  VERSION_0_18
  VERSION_0_11
  VERSION_0_9
  VERSION_0_5
  VERSION_0_1
Done.
Time for pass15 (IndexSymbolsPass): 0.130 seconds.
Deleting cvs2svn-tmp\statistics-14.pck
----- pass 16 (OutputPass) -----
Traceback (most recent call last):
  File "cvs2hg", line 91, in <module>
    hg_main(os.path.basename(sys.argv[0]), sys.argv[1:])
  File "c:\Portable progs\cvs2svn-19b322d42b1f\cvs2svn_lib\main.py", line 135, in hg_main
    main(progname, run_options, pass_manager)
  File "c:\Portable progs\cvs2svn-19b322d42b1f\cvs2svn_lib\main.py", line 96, in main
    pass_manager.run(run_options)
  File "c:\Portable progs\cvs2svn-19b322d42b1f\cvs2svn_lib\pass_manager.py", line 181, in run
    the_pass.run(run_options, stats_keeper)
  File "c:\Portable progs\cvs2svn-19b322d42b1f\cvs2svn_lib\passes.py", line 1771, in run
    svn_commit.output(Ctx().output_option)
  File "c:\Portable progs\cvs2svn-19b322d42b1f\cvs2svn_lib\svn_commit.py", line 238, in output
    output_option.process_primary_commit(self)
  File "c:\Portable progs\cvs2svn-19b322d42b1f\cvs2svn_lib\hg_output_option.py", line 291, in process_primary_commit
    svn_commit, [parent1, parent2], filenames, getfilectx, lod)
  File "c:\Portable progs\cvs2svn-19b322d42b1f\cvs2svn_lib\hg_output_option.py", line 715, in _commit_primary
    return self._commit(svn_commit, parents, filenames, getfilectx, lod)
  File "c:\Portable progs\cvs2svn-19b322d42b1f\cvs2svn_lib\hg_output_option.py", line 733, in _commit
    return self._commit_memctx(mctx)
  File "c:\Portable progs\cvs2svn-19b322d42b1f\cvs2svn_lib\hg_output_option.py", line 739, in _commit_memctx
    node = self.repo.commitctx(mctx)
  File "mercurial\localrepo.pyo", line 63, in wrapper
  File "mercurial\localrepo.pyo", line 1399, in commitctx
  File "mercurial\localrepo.pyo", line 1193, in _filecommit
  File "mercurial\filelog.pyo", line 76, in cmp
AttributeError: 'bool' object has no attribute 'startswith'

Tailor, fromcvs

Initially blocked by link rot, but after Googling a lot, turn out to be Linux-only tools (?). I do have cygwin but I never had any good experiences compiling source distributions.

hg-cvs-import

Link rot too, and can't find anything. Moreover about the last three tools, I read on Would you migrate from cvs to svn or directly to git or hg?: "The Tailor extension, hg-cvs-import, fromcvs seems to be old code and aren't maintained any more."


I also tried the trick on Convert cvs to mercurial, even though it probably only retains local file history, but got the same result as in my first try.

Any other tools I somehow missed? Maybe a user-friendly application for Windows?

Community
  • 1
  • 1
Mark Jeronimus
  • 9,278
  • 3
  • 37
  • 50
  • What version of hg are you on? It might make sense to rollback to the current version that aligns with the tool you're using. – Edward Oct 27 '14 at 15:03
  • 1
    Is `H:\Cvs` working directory of CVS and is it fresh checkout? – Lazy Badger Oct 27 '14 at 20:34
  • Mercurial 3.1.1. Just saw a newer version, testing it out now. `H:\Cvs` is the server repository, not a checkout. – Mark Jeronimus Oct 28 '14 at 07:51
  • Same result. Any idea if the script requires a specific older version of Hg? (going by date, I guess 1.8.1) – Mark Jeronimus Oct 28 '14 at 08:04
  • **READ** about convert extension requirements **carefully**!!! Source of CVS-code **MUST BE** 1) CVS-checkout 2) performed by the same version of CVS CLI-tool, which you have at the moment of conversion. **RTFM!!!** – Lazy Badger Oct 28 '14 at 11:39

1 Answers1

1

I succeeded with cvs2hg and Mercurial 2.0 source (not a newer version)

  • Download the Mercurial 2.0 source,
  • Copy the Mercurialfolder (found inside the Mercurial-2.0 folder) to the cvs2svn folder,
  • Go into cvs2svn/Mercurial/pure,
  • Copy the contents to cvs2svn/Mercurial,
  • Execute python cvs2hg
Mark Jeronimus
  • 9,278
  • 3
  • 37
  • 50