源碼安裝xen時,用到了mercurial。google了很久,重點介紹一下源碼安裝,然後是兩種簡便的方法。
1、下載源碼
[root@localhost mercurial-1.4.1]wget http://mercurial.selenic.com/release/mercurial-1.4.1.tar.gz
2、 編譯安裝
[root@localhost mercurial-1.4.1] # make all
[root@localhost mercurial-1.4.1]# make install-home
3、 安裝檢查
[root@localhost mercurial-1.4.1]hg debuginstall
會出現abort: couldn't find mercurial libraries in。。。
[root@localhost mercurial-1.4.1]export PYTHONPATH=${HOME}/lib/python
此時再運行hg debuginstall ,會出現
[root@localhost mercurial-1.4.1]# hg debuginstall
Checking encoding (UTF-8)...
Checking extensions...
Checking templates...
Checking patch...
Checking commit editor...
Checking username...
no username supplied (see "hg help config")
(specify a username in your .hgrc file)
1 problems detected, please check your install!
這是由於設定檔的原因。源碼中contrib檔案夾下提供了一個sample.hgrc,可以拷貝過來修改
[root@localhost mercurial-1.4.1]# cd contrib/
[root@localhost contrib]# cp sample.hgrc /root/.hgrc
[root@localhost contrib]# vim /root/.hgrc
這裡改一下:
### show changed files and be a bit more verbose if True
# verbose = True
### username data to appear in comits
### it usually takes the form: Joe User <joe.user@host.com>
username = zhuliting <zhuliting@example.com> //只修改這一行。
### --- Extensions
[注]修改設定檔不正確時,運行hg debuginstall會出現
hg: config error at /root/.hgrc:12: ' username = Joe Who <j.user@example.com>'
再運行hg debuginstall ,出現這個提示就可以了
[root@localhost contrib]# hg debuginstall
Checking encoding (UTF-8)...
Checking extensions...
Checking templates...
Checking patch...
Checking commit editor...
Checking username...
No problems detected
運行hg,出現
[root@localhost contrib]# hg
分布式軟體組態管理工具 - 水銀
基本命令:
add add the specified files on the next commit
annotate show changeset information by line for each file
clone make a copy of an existing repository
commit commit the specified files or all outstanding changes
diff diff repository (or selected files)
export dump the header and diffs for one or more changesets
forget forget the specified files on the next commit
init create a new repository in the given directory
log show revision history of entire repository or files
merge merge working directory with another revision
pull pull changes from the specified source
push push changes to the specified destination
remove remove the specified files on the next commit
serve export the repository via HTTP
status show changed files in the working directory
summary summarize working directory state
update update working directory
使用 "hg help" 獲得全部命令的列表,或 "hg -v" 獲得詳細資料
到這裡,mercurial已經安裝成功了。下一次使用hg命令時,首先要設定一下
[root@localhost mercurial-1.4.1]export PYTHONPATH=${HOME}/lib/python
當然,也可以 建立一個軟連結。
[注]其它的簡便安裝方法:
1、安裝軟體時,如果只是簡單的應用,可安裝編譯好的二進位包,即yum install mercurial ,我的CentOS 5.4版本下也能成功安裝,但剛開始幾次都不行,可先安裝rpmforge.
[root@localhost ~]# wget ftp://ftp.univie.ac.at/systems/linux/dag/redhat/el5/en/i386/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
[root@localhost ~]# rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
然後再yum install mercurial