---
title: "从SVN迁移到TortoiseHg Linux"
author: "yuankai"
date: "2011-04-06T18:15:18Z"
tags: []
categories: ["操作系统"]
slug: "svn-tortoisehg-linux"
draft: false
lastmod: "2011-04-06T18:40:14Z"
id: 988231
url: "https://pirateyk.iteye.com/blog/988231"
---

Linux 下从svn项目迁移到TortoiseHg,下面是我在操作过程中的步骤！

1. 默认安装的hg没有convert命令，需要将下面注释掉的内容打开。
我本地Path -> /usr/share/mercurial/hgext.rc 
hgext.convert =

2. 重启服务(7000为hg服务器端口号)
killall hg    //野蛮操作
hg serve -d -p 7000 --webdir-conf webdirconf

3.为文件或目录改名或将文件由一个目录移入另一个目录中（这里卡了很久，linux很菜）
mv hgrc .hgrc

3.安装依赖包 python-subversion (这里以为python-subversion 与 subversion没区别，结果杯具)
sudo apt-get install python-subversion

4.使用hg convert命令 执行转换 
hg convert -s svn -d hg svn_path path

e.g  (/tmp/test 是svn项目文件包   /opt/hg/test  会生成一个.hg的文件夹)
hg convert -s svn -d hg  /tmp/test /opt/hg/test 


//项目分支名如果不是标准的svn分支名 需要使用下面的配置
--config convert.svn.branches=branches    (directory name)
        specify the directory containing branches

--config convert.svn.tags=tags            (directory name)
        specify the directory containing tags

--config convert.svn.trunk=trunk          (directory name)
        specify the name of the trunk branch


5. cd /opt/hg/test

更新
6. hg update

7. ls -la
可以看到已经将svn项目 完全转换为hg项目


参考:http://www.douhua.im/tag/mercurial/