源碼安裝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 <>
username = zhuliting <> //只修改這一行。
### --- Extensions
[注] 修改配置文件不正確時,運行hg debuginstall會出現
hg: config error at /root/.hgrc:12: ' username = Joe Who <>'
再運行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
[root@localhost ~]# rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
然後再yum install mercurial