Skip to content

Automatically exported from code.google.com/p/hg2svn

Notifications You must be signed in to change notification settings

svaningelgem/hg2svn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 

Repository files navigation

hg2svn - Converts a Mercurial repo into a Subversion one.

Features:

+  Converts mercurial repositories into subversion ones.
+  Migrate revisions and commit logs
+  Support incremental runs via parameters. (init or sync)

Potential issues for reuse:

- incomplete sanity checks.
- no handling of branches
- certain layout of the results of hg commands is assumed
- all commits come from the user running the script
- move operations probably won't appear in the history as such
- we assume the SVN side doesn't change

How to use:

Edit config.ini and add the temp_path (working directory)

Usage:

First we need to initialize repositories:

hg2svn.php init <mercurial_repo_src> <svn_target_repo>

Now to sync! :

hg2svn.php init <svn_target_repo>

Real world example:

I have already cloned dclib_hg to /home/psteyn/dclib_hg/ and I have a new svn repo called /home/psteyn/svnrepo
(Both local and remote URI's can be given)
To sync dclib_hg to /home/psteyn/svnrepo:

php hg2svn.php init /home/psteyn/dclib_hg/ file:///home/psteyn/svnrepo

Succesfully created /var/tmp/hg2svn/
Cloning Mercurial repository at /home/psteyn/dclib_hg/ into Mercurial working copy at /var/tmp/hg2svn/hg2svntq8JFt_hg.

Checking out file:///home/psteyn/svnrepo as /var/tmp/hg2svn/hg2svntq8JFt_svn

Converting Mercurial repository at /var/tmp/hg2svn/hg2svntq8JFt_hg into Subversion working copy at /var/tmp/hg2svn/hg2svntq8JFt_svn.

Succesfully initialized.  Ready for sync.

psteyn@elegua:~/hg2svn$ php hg2svn.php sync file:///home/psteyn/svnrepo
Ensuring SVN repo is up to date before sync.

Ensuring HG repo is up to date before sync.

Fetching Mercurial revision 1/2178

- removing deleted files

- removing empty directories

- adding files to SVN control
--snip--





Win32 running:
--------------
- You need PHP (obviously), mercurial, svn & patch.

The links for these:
--------------------
HG: http://mercurial.selenic.com/downloads/ [ I took MSI installer ]
SVN: http://www.sliksvn.com/en/download
patch: https://sourceforge.net/projects/gnuwin32/files/patch/ [Just take latest version + read below if you're on Win Vista/7]


Hint for patch under UAE:
-------------------------
http://jameswynn.com/2010/03/gnu-patch-in-windows-7-or-vista/
I just had a little fight with Windows 7 about permissions. It seems that it demands that any executable with the word "patch" in the name must be run with administrative privileges. After fighting with it for a few minutes about the absurdity of the problem, I resorted to a simple hack.

    Rename patch.exe to patsh.exe.
    Then create patch.bat in the same directory containing the following command:
    @patsh.exe %*

You will never notice a difference, and Windows 7 can go politely F*** itself.

About

Automatically exported from code.google.com/p/hg2svn

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published