例说hg(一)————hg sum 与hg tip区别

 

开篇:

        之前一直用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 <6yalong@gmail.com>
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 <6yalong@gmail.com>
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 <6yalong@gmail.com>
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 <6yalong@gmail.com>
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 ————查看工程的所有提交信息,任何分支下查看的信息应该相同

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值