hg – 夏清然的日志 https://www.qingran.net Xia Qingran Geek Blog Sun, 07 Aug 2016 09:50:33 +0000 en-US hourly 1 https://wordpress.org/?v=4.6.1 112893047 SVN转换Mercurial,Mercurial的安装 https://www.qingran.net/2010/11/svn%e8%bd%ac%e6%8d%a2mercurial%ef%bc%8cmercurial%e7%9a%84%e5%ae%89%e8%a3%85/ https://www.qingran.net/2010/11/svn%e8%bd%ac%e6%8d%a2mercurial%ef%bc%8cmercurial%e7%9a%84%e5%ae%89%e8%a3%85/#comments Mon, 15 Nov 2010 16:19:11 +0000 https://www.qingran.net/?p=706 背景:目前的项目使用的版本控制是SVN。只建立了一个svn库并使用bdb模式。项目开始了3个月,svn的版本号就突破了7000,svn库在服务器端有9GB。而在windows下用TortoiseSVN检出所有的东西,总共近50GB大小(.svn目录貌似保留了所有的历史),居然需要3个小时以上!实在忍不了了,准备换分布式VC。目前暂时选择Mercurial。


首先需要把svn转换为Mercurial,同时还要把svn库分离一下,系统是ubuntu-10.04 server amd64:

#apt-get install mercurial meld python-subversion

#svnadmin dump ./repos/ > svn.dump
#wget http://bakacsin.ki.iif.hu/~kissg/project/svn/svngrep

#./svngrep '^dev\/core\b' svn.dump > core.dump
svngrep有重大问题,导致其导出的不全,改用svndumpfilter

#cat svn.dump | svndumpfilter include dev/core --drop-empty-revs --renumber-revs  > core.dump
#svnadmin create core/
#sed -r -e 's/^Node-path: dev\//^Node-path: /' core.dump > core.dump.new
#svnadmin load core < core.dump.new

# cat /root/.hgrc
[extensions]
hgext.convert =

#hg convert file:///data/test/core/

#mkdir -p /var/mercurial/

#mv /data/test/core-hg /var/mercurial/

#chown -R www-data:www-data /var/mercurial/

#chmod -R 700 /var/mercurial/

然后建立Mercurial:

# mkdir /var/www/cgi-bin/
# cp /usr/share/doc/mercurial/examples/hgweb.wsgi /var/www/cgi-bin/
# cat /var/www/cgi-bin/hgweb.config
[web]
style = coal
allow_push = *
push_ssl = false

[paths]
/ =  /data/mercurial/**

#chmod +x /var/www/cgi-bin/hgwebdir.wsgi

修改 /var/www/cgi-bin/hgwebdir.wsgi 文件,最后一行的“application = hgwebdir(‘hgweb.config’)“修改为:

application = hgwebdir('/var/www/cgi-bin/hgweb.config')

配置apache2,使之运行wsgi模式的Mercurial:

#apt-get install libapache2-mod-wsgi

在需要加入的VirtualHost里加入:

WSGIScriptAliasMatch ^(.*)$ /var/www/cgi-bin/hgwebdir.wsgi$1
<Directory "/data/mercurial/">
	Options FollowSymlinks
	DirectoryIndex index.html
	AuthType Basic
	AuthName "Subversion Repository"
	AuthUserFile /etc/apache2/dav_svn.passwd
	Require valid-user
</Directory>

<Directory "/var/www/cgi-bin">
	Options ExecCGI FollowSymlinks
	AddHandler wsgi-script .wsgi
	AuthType Basic
	AuthName "Subversion Repository"
	AuthUserFile /etc/apache2/dav_svn.passwd
	Require valid-user

</Directory>

重启apache2,然后就开始使用吧。

]]> https://www.qingran.net/2010/11/svn%e8%bd%ac%e6%8d%a2mercurial%ef%bc%8cmercurial%e7%9a%84%e5%ae%89%e8%a3%85/feed/ 1 706