Differences between revisions 46 and 72 (spanning 26 versions)
Revision 46 as of 2008-01-16 19:45:51
Size: 4112
Editor: abuehl
Comment: Perforce: +p4hg
Revision 72 as of 2012-02-24 20:48:55
Size: 7565
Editor: WagnerBruna
Comment: fix broken links
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
[[TableOfContents]] #pragma section-numbers 2
= Converting Repositories =
Line 3: Line 4:
Your first option should probably be the ConvertExtension recently bundled with mercurial. It supports branches, incremental imports, and a few other nice features, and is maintained by the Mercurial authors. It currently only understands CVS, subversion, Darcs and git. Otherwise, the following tools may be useful. Your first option should probably be the ConvertExtension bundled with Mercurial. It supports branches, incremental imports, and a few other nice features, and is maintained by the Mercurial authors. It currently only understands CVS, Subversion, Git, Darcs, Monotone, Bazaar, GNU Arch, Perforce and Mercurial as source formats and Mercurial and Subversion as destination formats.

Otherwise, the followin
g tools may be useful.

<<Table
OfContents>>
Line 7: Line 12:
Tools for Arch conversion can be found at ArchConversion.  * The ConvertExtension supports GNU Arch since (df659eb23360, 0.9.5+)
 * Other t
ools for Arch conversion can be found at ArchConversion.
Line 11: Line 17:
 * ["Tailor"] - a generic conversion tool.  * [[ConvertExtension]]
 * [[Tailor]] - a generic conversion tool.

== ClearCase ==

 * ClearCaseConversion - some ideas

== RCS ==
Convert to CVS (see [[ConvertExtension#Converting_from_RCS]]) and then use CVS tools.
Line 17: Line 31:
 * ["ConvertExtension"] - the convert extension supports CVS
 * ["Tailor"] - a generic conversion tool
 * ["fromcvs"] - a fast, incremental CVS to Mercurial converter
 * [http://hg.beekhof.net/hg/cvs-import hg-cvs-import] - InstructionsforHgcvsimport
 * [[ConvertExtension]] - the convert extension supports simple CVS repositories
 * [[http://hg.gerg.ca/cvs2svn|cvs2hg]] is a branch of cvs2svn with native Mercurial output
 * [[Tailor]] - a generic conversion tool
 * [[fromcvs]] - a fast, incremental CVS to Mercurial converter
 * [[http://hg.beekhof.net/hg/cvs-import|hg-cvs-import]] - InstructionsforHgcvsimport

'''Note''': Mercurial's [[ConvertExtension]] uses a naive algorithm to understand CVS. If your CVS repository contains no tags and no branches, it'll work just fine. If you, and everyone who has ever used your CVS repository, have always tagged/branched the tip of your entire source tree, it should work just fine. But if you have ever played any funny games with tagging or branching, [[ConvertExtension]] will not work. It doesn't even try to handle those cases because it is based on cvs2ps, which doesn't even try to understand the full range of strange things people do with CVS tags/branches. The only tool known to handle all of CVS' weird corner cases is cvs2svn. Luckily, there is now a version of cvs2svn with a native Mercurial backend called cvs2hg. See [[http://hg.gerg.ca/cvs2svn/raw-file/tip/README.cvs2hg|its README.cvs2hg file]] for more information.

In the past, other options have included:
  * use cvs2svn to convert to Subversion, then ConvertExtension to import the Subversion repository: cvs2hg is faster and more flexible
  * use cvs2git to convert to git fast-import format, then use FastImportExtension to import that: again, cvs2hg is faster and more flexible
Line 28: Line 49:
The ConvertExtension supports Darcs.

An older sample Darcs conversion script is available in the contrib/ directory of the Mercurial source.

Also see ["Tailor"].
 * The ConvertExtension supports Darcs.
 * An older sample Darcs conversion script is available in the contrib/ directory of the Mercurial source.
 * Also see [[Tailor]].
Line 40: Line 59:
The ConvertExtension included in Mercurial 0.9.5 can import Subversion trees. It uses the Subversion API, so it can speak any Subversion repository access protocol. The ConvertExtension included in Mercurial 0.9.5 can import Subversion trees. It uses the Subversion API, so it can speak any Subversion repository access protocol. It's a good idea to work against a local copy of the Subversion repository you want to convert. Make a local copy of your svn repo using [[http://svnbook.red-bean.com/en/1.5/svn.ref.svnsync.html|svnsync]].

Examples and details about Subversion interoperability can be found in WorkingWithSubversion.
Line 47: Line 68:
 * http://ajayu.memi.umss.edu.bo/viborita/weblog/svn2hg.py-convertir-repositorio-subversion-mercurial - simple script that downloads every rev info from svn server. Works on subdirectories of the repo. Handles branches, tags, etc. inefficiently (does not tell hg that they are different from any other diff). Requires pysvn, mercurial source. Use the download link, not copy&paste.
 * [http://hg.rosdahl.net/yasvn2hg yasvn2hg] - yet another SVN to HG converter. Handles branches, tags and file copies/renames. Calls the svn client for each changeset, so it's not very fast. Converts whole repository only. Direct links: [http://hg.rosdahl.net/yasvn2hg/raw-file/tip/yasvn2hg yasvn2hg program], [http://hg.rosdahl.net/yasvn2hg/raw-file/tip/README README file].
 * [http://dingoskidneys.com/cgi-bin/hgwebdir.cgi/queue-convert-svn/] - Patch queue against Mercurial. Patches create a convert-repo hacked to support SVN as a source. Uses the SVN API, not SVN command line + subprocess.
 * http://ajayu.memi.umss.edu.bo/viborita/weblog/svn2hg.py-convertir-repositorio-subversion-mercurial - simple script that downloads every rev info from svn server. Works on subdirectories of the repo. Handles branches, tags, etc. inefficiently (does not tell hg that they are different from any other diff). Requires pysvn, Mercurial source. Use the download link, not copy&paste.
 * [[http://hg.rosdahl.net/yasvn2hg|yasvn2hg]] - yet another SVN to HG converter. Handles branches, tags and file copies/renames. Calls the svn client for each changeset, so it's not very fast. Converts whole repository only. Direct links: [[http://hg.rosdahl.net/yasvn2hg/raw-file/tip/yasvn2hg|yasvn2hg program]], [[http://hg.rosdahl.net/yasvn2hg/raw-file/tip/README|README file]].
 * [[http://dingoskidneys.com/cgi-bin/hgwebdir.cgi/queue-convert-svn/]] - Patch queue against Mercurial. Patches create a convert-repo hacked to support SVN as a source. Uses the SVN API, not SVN command line + subprocess.
Line 52: Line 73:
 * [http://cheeseshop.python.org/pypi/hgsvn hgsvn] allows you to work on SVN checkouts using Mercurial (mirroring all SVN history in a local Mercurial repository on which you can also do local development). It is useful for managing private branches, submitting patches to project maintainers, have fast local operations instead of slow remote "svn up/log/blame", etc. Also useful as "one-shot" conversion tool if you just remove all the svn directories ("find . -name '.svn' |xargs rm -r") afterwards.  * [[http://cheeseshop.python.org/pypi/hgsvn|hgsvn]] allows you to work on SVN checkouts using Mercurial (mirroring all SVN history in a local Mercurial repository on which you can also do local development). It is useful for managing private branches, submitting patches to project maintainers, have fast local operations instead of slow remote "svn up/log/blame", etc. Also useful as "one-shot" conversion tool if you just remove all the svn directories ("find . -name '.svn' |xargs rm -r") afterwards.
Line 54: Line 75:
 * The HgSubversion Mercurial extension. Read about it in its own page on this wiki.
Line 57: Line 79:
[http://hg.omnifarious.org/~hopper/p4_to_hg p4_to_hg] The ConvertExtension supports conversion from Perforce since version 1.2.
Line 59: Line 81:
The [[PerfarceExtension|Perfarce extension]] allows you to pull changelists from Perforce, and to push Mercurial changesets back to it.

There is also a stand-alone script [[http://hg.omnifarious.org/~hopper/p4_to_hg|p4_to_hg]]
Line 61: Line 86:
Currently, it's slapped together and built to serve my particular needs, but it could probably be modified into something more general. It currently makes no attempt to do anything with Perforce's ability to track branches or the movement of changesets from branch to branch. -- EricHopper 2005-09-27 06:31:03 Currently, it's slapped together and built to serve my particular needs, but it could probably be modified into something more general. It currently makes no attempt to do anything with Perforce's ability to track branches or the movement of changesets from branch to branch.   But it hasn't received any love since 2007 or so, and I don't have access to a Perforce repository to use anymore, so I'm not doing any development on it. The other options are probably better. -- EricHopper 2010-10-29 10:29
Line 63: Line 88:
["p4hg"] See also posting http://selenic.com/pipermail/mercurial/2008-July/020241.html: "Start of Mercurial git-fast-import importer (was p4 to hg)" by Paul Crowley

See also posting http://unixsadm.blogspot.com/2010/07/converting-perforce-depots-to-mercurial.html: "Converting Perfoce depots to Mercurial" by Criveti Mihai
Line 67: Line 94:
Because of the threatening behavior of Larry McVoldemort of Bitmover, no Bitkeeper conversion tools have been made publically available. See GenericConversion for details on building your own repository conversion tool. Because of the threatening behavior of Larry !McVoldemort of Bitmover, no Bitkeeper conversion tools have been made publicly available. See GenericConversion for details on building your own repository conversion tool.

== TeamWare ==

Very experimental conversion script available if you can find nothing better:

[[http://blogs.sun.com/jglick/entry/teamware_to_mercurial_history_conversions]]

== Visual SourceSafe ==

 * [[SourceSafeConversion]] - A script to convert a [[WikiPedia:Visual_SourceSafe|Visual SourceSafe]] project to a Mercurial Repository

== Monotone ==

 * [[ConvertExtension]]

== Team Foundation Server (TFS) ==

 * [[http://blog.dabide.no/idabide/2010/10/18/converting-from-tfs-to-mercurial/]]
Line 71: Line 116:
["Tailor"] is a conversion tool that can do simple conversions from a variety of systems. [[Tailor]] is a conversion tool that can do simple conversions from a variety of systems.
Line 73: Line 118:
----
CategoryConversion

Converting Repositories

Your first option should probably be the ConvertExtension bundled with Mercurial. It supports branches, incremental imports, and a few other nice features, and is maintained by the Mercurial authors. It currently only understands CVS, Subversion, Git, Darcs, Monotone, Bazaar, GNU Arch, Perforce and Mercurial as source formats and Mercurial and Subversion as destination formats.

Otherwise, the following tools may be useful.

1. Arch / TLA / Baz 1.5

2. Bazaar?

3. ClearCase

4. RCS

Convert to CVS (see ConvertExtension#Converting_from_RCS) and then use CVS tools.

5. CVS

Multiple convertors exist for converting from CVS to Mercurial:

Note: Mercurial's ConvertExtension uses a naive algorithm to understand CVS. If your CVS repository contains no tags and no branches, it'll work just fine. If you, and everyone who has ever used your CVS repository, have always tagged/branched the tip of your entire source tree, it should work just fine. But if you have ever played any funny games with tagging or branching, ConvertExtension will not work. It doesn't even try to handle those cases because it is based on cvs2ps, which doesn't even try to understand the full range of strange things people do with CVS tags/branches. The only tool known to handle all of CVS' weird corner cases is cvs2svn. Luckily, there is now a version of cvs2svn with a native Mercurial backend called cvs2hg. See its README.cvs2hg file for more information.

In the past, other options have included:

  • use cvs2svn to convert to Subversion, then ConvertExtension to import the Subversion repository: cvs2hg is faster and more flexible

  • use cvs2git to convert to git fast-import format, then use FastImportExtension to import that: again, cvs2hg is faster and more flexible

You can also convert from Mercurial to CVS:

6. Darcs

  • The ConvertExtension supports Darcs.

  • An older sample Darcs conversion script is available in the contrib/ directory of the Mercurial source.
  • Also see Tailor.

7. Git

See GitConversion (incremental).

8. Subversion

The ConvertExtension included in Mercurial 0.9.5 can import Subversion trees. It uses the Subversion API, so it can speak any Subversion repository access protocol. It's a good idea to work against a local copy of the Subversion repository you want to convert. Make a local copy of your svn repo using svnsync.

Examples and details about Subversion interoperability can be found in WorkingWithSubversion.

Converters that work on local repositories or data (faster, if this is an option for you):

Converters that work on remote repositories:

Syncing tools:

  • hgsvn allows you to work on SVN checkouts using Mercurial (mirroring all SVN history in a local Mercurial repository on which you can also do local development). It is useful for managing private branches, submitting patches to project maintainers, have fast local operations instead of slow remote "svn up/log/blame", etc. Also useful as "one-shot" conversion tool if you just remove all the svn directories ("find . -name '.svn' |xargs rm -r") afterwards.

  • SubversionToMercurialSync (like hgsvn, but more primitive)

  • The HgSubversion Mercurial extension. Read about it in its own page on this wiki.

9. Perforce

The ConvertExtension supports conversion from Perforce since version 1.2.

The Perfarce extension allows you to pull changelists from Perforce, and to push Mercurial changesets back to it.

There is also a stand-alone script p4_to_hg This utility can actually keep two repositories in sync.

Currently, it's slapped together and built to serve my particular needs, but it could probably be modified into something more general. It currently makes no attempt to do anything with Perforce's ability to track branches or the movement of changesets from branch to branch. But it hasn't received any love since 2007 or so, and I don't have access to a Perforce repository to use anymore, so I'm not doing any development on it. The other options are probably better. -- EricHopper 2010-10-29 10:29

See also posting http://selenic.com/pipermail/mercurial/2008-July/020241.html: "Start of Mercurial git-fast-import importer (was p4 to hg)" by Paul Crowley

See also posting http://unixsadm.blogspot.com/2010/07/converting-perforce-depots-to-mercurial.html: "Converting Perfoce depots to Mercurial" by Criveti Mihai

10. Bitkeeper

Because of the threatening behavior of Larry McVoldemort of Bitmover, no Bitkeeper conversion tools have been made publicly available. See GenericConversion for details on building your own repository conversion tool.

11. TeamWare

Very experimental conversion script available if you can find nothing better:

http://blogs.sun.com/jglick/entry/teamware_to_mercurial_history_conversions

12. Visual SourceSafe

13. Monotone

14. Team Foundation Server (TFS)

15. Other systems

Tailor is a conversion tool that can do simple conversions from a variety of systems. See GenericConversion for details on building your own repository conversion tool.


CategoryConversion

RepositoryConversion (last edited 2020-07-05 13:34:51 by MarcinKasperski)