标签:des blog http io os ar 使用 for sp
这个叫水银的源码管理工具虽然默默无闻,但还是得到了很多团队的使用。为了迎合某些团队的需要,我们也要用它来管理我们的代码。
今天的任务是先突击学习,磨刀不误砍柴工。对工具的掌握越快,工作的效率就会越高。
首先从官网下载最新的版本,我这次做个实验,下载了3.2-rc。
解压到你指定的目录下:
[linc@localhost mercurial]$ ls mercurial-3.2-rc.tar.gz [linc@localhost mercurial]$ tar xzvf mercurial-3.2-rc.tar.gz
mercurial/base85.c:13:20: fatal error: Python.h: No such file or directory只要看看/usr/include/python2.7/下有没有上述的头文件就知晓了。
sudo apt-get install python-devfedora下使用:
[linc@localhost etc]$ sudo yum install python-devel来到mercurial-3.2-rc路径下,执行:
[linc@localhost mercurial-3.2-rc]$ make install-home python setup.py build running build running build_mo running build_ext building ‘mercurial.base85‘ extension ...
make[1]: *** [hg.1] Error 255 make[1]: Leaving directory `/home/linc/dev/mercurial/mercurial-3.2-rc/doc‘ make: *** [doc] Error 2最后的错误是关于文档的,这里被我无视了,尝试执行hg,得到了反馈,说明基本功能是安装完成了。
[linc@localhost mercurial-3.2-rc]$ hg Mercurial Distributed SCM basic commands: 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 start stand-alone webserver status show changed files in the working directory summary summarize working directory state update update working directory (or switch revisions) (use "hg help" for the full list of commands or "hg -v" for details)2.简单的使用
下面就要试着创建一个项目并提交代码。
创建init目录:
[linc@localhost testHG]$ hg init testMercurial [linc@localhost testHG]$ ls testMercurial [linc@localhost testHG]$ cd testMercurial/添加我的小项目,将其他目录下的源码拷到这里:
[linc@localhost testMercurial]$ cp -r ../../hello/* . [linc@localhost testMercurial]$ ls Debug Release src查看当前状态:
[linc@localhost testMercurial]$ hg status ? Debug/makefile ? Debug/objects.mk ? Debug/sources.mk ? Debug/src/subdir.mk ? Release/makefile ? Release/objects.mk ? Release/sources.mk ? Release/src/subdir.mk ? src/hello.c问号表示还没有纳入版本管理,下面就给它们添加进来:
[linc@localhost testMercurial]$ hg add adding Debug/makefile adding Debug/objects.mk adding Debug/sources.mk adding Debug/src/subdir.mk adding Release/makefile adding Release/objects.mk adding Release/sources.mk adding Release/src/subdir.mk adding src/hello.c [linc@localhost testMercurial]$ hg status A Debug/makefile A Debug/objects.mk A Debug/sources.mk A Debug/src/subdir.mk A Release/makefile A Release/objects.mk A Release/sources.mk A Release/src/subdir.mk A src/hello.cA就是add的标识了。下面我们提交这些代码吧。
[linc@localhost testMercurial]$ hg commit -m ‘initial commit‘ abort: no username supplied (use "hg config --edit" to set your username) [linc@localhost testMercurial]$ hg config --edit可惜由于我没有编辑好我的名称在配置文件中,先去添加一下,然后继续提交代码:
[linc@localhost testMercurial]$ hg commit -m ‘initial commit‘ [linc@localhost testMercurial]$ hg status [linc@localhost testMercurial]$ hg log changeset: 0:23ac3f5bfc59 tag: tip user: Lincoln <linc@xxx.com> date: Mon Oct 27 21:05:10 2014 +0800 summary: initial commit上面的changeset就是git中的commit id,冒号前面的0就是你的changeset id,越靠前表示它的资历越老。
hg push /the remote repository我想要看看这一版都修改了那些地方怎么查?记得git中用show命令,hg呢?export就好了:
[linc@localhost testMercurial]$ hg export 0:23ac3f5bfc59 # HG changeset patch # User Lincoln <linc@xxx.com> # Date 1414415110 -28800 # Mon Oct 27 21:05:10 2014 +0800 # Node ID 23ac3f5bfc592c7bd2b293e8ace0f42b9e541ece # Parent 0000000000000000000000000000000000000000 initial commit diff -r 000000000000 -r 23ac3f5bfc59 Debug/makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Debug/makefile Mon Oct 27 21:05:10 2014 +0800 @@ -0,0 +1,44 @@
标签:des blog http io os ar 使用 for sp
原文地址:http://blog.csdn.net/lincyang/article/details/40513073