本文由博主原创,转载请注明出处(保留此处和链接):
一日二十四挨踢(http://1024it.net/?p=132)
hg专题文章:
例说hg(一)————hg sum 与hg tip区别
例说hg(二)———— hg merge的使用
例说hg(三)———— hg的图形界面安装
例说hg(四)———— 杂说hg使用场景
例说hg(五)————创建repository
例说hg(六)———— hg branch 创建分支
开篇:
之前一直用hg进行代码仓库管理,总是把hg sum 和hg tip的关系搞混。当时有人帮忙,现在得自己摸索了。在此把自己的实例在此记录,希望对大家有帮助吧!!!!!
仓库介绍:
仓库很简单,只有两个branch,即default和home。只进行了6此提交操作,可以从下面的hg log信息查看。
hg sum 和 hg tip实例操作:
实例一:
robin@ubuntu:~/workspace/ctags_wspace/rtags$ hg update home //更新到home分支上 0 files updated, 0 files merged, 0 files removed, 0 files unresolved robin@ubuntu:~/workspace/ctags_wspace/rtags$ hg tip //查看hg tip信息 changeset: 6:e4c4994bd378 branch: home tag: tip user: Robin Lau <[email protected]> date: Thu Jan 02 13:54:08 2014 +0000 summary: Created new branch home robin@ubuntu:~/workspace/ctags_wspace/rtags$ hg sum //查看hg sum信息 parent: 6:e4c4994bd378 tip Created new branch home branch: home commit: (clean) update: (current) robin@ubuntu:~/workspace/ctags_wspace/rtags$ hg log //查看hg log信息 changeset: 6:e4c4994bd378 branch: home tag: tip user: Robin Lau <[email protected]> date: Thu Jan 02 13:54:08 2014 +0000 summary: Created new branch home changeset: 5:f7d4728abe29 user: RobinLau date: Tue Dec 31 00:33:03 2013 +0800 summary: add file rstring.h\rstring.c实例二:
robin@ubuntu:~/workspace/ctags_wspace/rtags$ hg update default //更新到default分支上 0 files updated, 0 files merged, 0 files removed, 0 files unresolved robin@ubuntu:~/workspace/ctags_wspace/rtags$ hg tip //查看hg tip信息 changeset: 6:e4c4994bd378 branch: home tag: tip user: Robin Lau <[email protected]> date: Thu Jan 02 13:54:08 2014 +0000 summary: Created new branch home robin@ubuntu:~/workspace/ctags_wspace/rtags$ hg sum //查看hg sum信息 parent: 5:f7d4728abe29 add file rstring.h\rstring.c branch: default commit: (clean) update: (current) robin@ubuntu:~/workspace/ctags_wspace/rtags$ hg log //查看hg log信息 changeset: 6:e4c4994bd378 branch: home tag: tip user: Robin Lau <[email protected]> date: Thu Jan 02 13:54:08 2014 +0000 summary: Created new branch home changeset: 5:f7d4728abe29 user: RobinLau date: Tue Dec 31 00:33:03 2013 +0800 summary: add file rstring.h\rstring.c
上面两个例子中,在开始分别执行了hg update home 和 hg update default,这两个操作表示更新到home 分支 和 更新到default分支。我们可以看到,无论是在default分支,还是在home分支,他们的hg tip信息是相同的,hg log信息也是相同的。home分支的hg sum信息是home分支的;default分支的hg sum信息是default分支的。
结论:
1. hg update + 分支名 ————更新工程到你所指定的分支,也可以说切换到你所指定的分支
2. hg tip ————查看工程的最新提交信息,也就说该工程所有分支中的最新提交信息,任何分支下查看的信息应该相同。
3. hg sum ————查看当前分支的最新提交信息,不同分支下查看的信息应该不同。
4. hg log ————查看工程的所有提交信息,任何分支下查看的信息应该相同