在CentOS 6.5上安装Mercurial和TortoiseHG

时间:2014-03-20 09:09:17

标签: mercurial centos tortoisehg

如何在CentOS 6.5上安装Mercurial和TortoiseHG?

这不是微不足道的,因为没有正式的RPM 请参阅下面的过程作为bash脚本。

我希望这会有所帮助

4 个答案:

答案 0 :(得分:5)

此程序是来自多个地点的指示的结合 使用以下内容创建一个脚本,并将其作为 root 运行。

#!/bin/bash
# Installation of mercurial and TortoiseHG

APPS_BASE=/opt
HG_BIN=$APPS_BASE/bin
HG_REPOS=$APPS_BASE/repos

checkResult()
{
    if [ $1 -ne 0 ]
    then
        echo;echo ERROR: $2 failed;echo
        exit 1
    else
        echo;echo Action $2 OK;echo
    fi
}

######### Start here #########

echo;echo Adding epel-release repository
yum -y install http://ftp.uninett.no/linux/epel/6/i386/epel-release-6-8.noarch.rpm
checkResult $? "yum install epel-release"

# Get more prereq packages
echo;echo Install some more packages needed
yum -y install PyQt4-devel python-devel python-iniparse gcc gettext
checkResult $? "yum install PyQt4-devel python-devel python-iniparse gcc gettext"

yum --enablerepo=epel -y install qscintilla-python python-keyring python-sphinx Django
checkResult $? "yum install qscintilla-python python-keyring python-sphinx Django"

# Install Mercurial from source to bootstrap
echo;echo Get and install Mercurial from source
mkdir $HG_BIN $HG_REPOS

cd $HG_REPOS
wget https://www.mercurial-scm.org/release/mercurial-2.4.2.tar.gz
checkResult $? "wget for mercurial"

tar xzvf mercurial-2.4.2.tar.gz
cd mercurial-2.4.2/
make local
checkResult $? "make local for mercurial"

# Get a Mercurial clone, to stay up to date
echo;echo Get and install Mercurial stable
./hg clone https://www.mercurial-scm.org/repo/hg#stable ../hg
checkResult $? "hg clone https://www.mercurial-scm.org/repo/hg#stable"

cd ../hg
make local
checkResult $? "make local for mercurial stable"

echo;echo Create link for hg
cd $HG_BIN
ln -s $HG_REPOS/hg/hg .

# now get a TortoiseHg clone
echo;echo Get the TortoiseHG
cd $HG_REPOS
$HG_BIN/hg clone https://bitbucket.org/tortoisehg/thg thg
checkResult $? "hg clone https://bitbucket.org/tortoisehg/thg"

echo;echo Create links for thg
cd thg
ln -s ../hg/mercurial/
ln -s ../hg/hgext/
cd $HG_BIN
ln -s $HG_REPOS/thg/thg .

echo;echo Install kdiff3
yum -y install kdiff3
checkResult $? "yum install kdiff3"

# Cleanup
echo;echo Cleanup
rm -rf $HG_REPOS/mercurial-2.4.2/ $HG_REPOS/mercurial-2.4.2.tar.gz

echo;echo Add $HG_BIN to path
echo "export PATH=$HG_BIN:$PATH" >> /etc/profile

完成后,您将有两个链接

/opt/bin/hg - mercurial
/opt/bin/thg - tortoiseHg

当然,您可以根据需要轻松移动物品。

编辑:如果有人知道如何让 nautilus 扩展程序正常运行,请在此添加!
编辑2:(由@ Will-I-am-davidon提供)。需要安装更多软件包才能使thg正常工作:yum install PyQt qscintilla qscintilla-python

答案 1 :(得分:0)

没有为我工作抱歉!在花了2个小时找到“不正确的数据格式”的问题后,我刚刚删除了checkSum(),下面的所有地方都写了ECHO

它对我有效100%

感谢=)

答案 2 :(得分:0)

在我的情况下,我想用BitBucket.org中托管的我自己的项目更新我的生产服务器,所以你试试Installing on CentOS 6.3

答案 3 :(得分:0)

Mercurial Download所述,创建/etc/yum.repos.d/mercurial.selenic.com.repo并粘贴以下内容:

[mercurial.selenic.com]
name=mercurial.selenic.com
baseurl=https://www.mercurial-scm.org/release/centos$releasever
enabled=1
# Temporary until we get a serious signing scheme in place,
# check https://www.mercurial-scm.org/wiki/Download again
gpgcheck=0

然后您可以发出命令sudo yum install hg