2---当前状态

当我们clone下来代码后,默认会在某个default分支上。

hg clone your-src-url  

代码库克隆下来后,查看一下当前代码库的状态

  14:30linc@Linc-Ubuntu:Demo$ hg summary  
  parent: 2014:xxxxxxxxxxxxxxx  
  This is a description.  
  branch: default  
  commit: 3 unknown (clean)  
  update: (current)  

上述我们可以看到,最新的版本(changeset)是2014,当前的分支是default,已经update到最新。

或者我们也可以直接查看当前的branch:

  14:42linc@Linc-Ubuntu:Demo$ hg branch  
  default  

还可以查看parent的详细信息:

  14:49linc@Linc-Ubuntu:Demo$ hg parents  
  changeset:   2014:xxxxxxxxxxxxxxx  
  user:        Linc Yang   
  date:        Mon Nov 14 15:59:36 2014 +0800  
  summary:     This is a description.  

再看看库中有几个分支:

  14:42linc@Linc-Ubuntu:Demo$ hg branches  
  cool_version               2089:xxxxxxxxxx  
  default                    2014:xxxxxxxxxx  
  little_thing               1999:xxxxxxxxxx  

还有另两个分支,并且我们当前的default也不是最新的。我们变换到cool_version上去看看。

  14:58linc@Linc-Ubuntu:Demo$ hg update cool_version  
  38 files updated, 10 files merged, 7 files removed, 0 files unresolved  
  14:58linc@Linc-Ubuntu:Demo$ hg branch  
  cool_version  
  14:58linc@Linc-Ubuntu:Demo$ hg sum  
  parent: 2089:xxxxxxxxxx tip  
   This is my test version.  
  branch: cool_version  
  commit: 3 unknown (clean)  
  update: (current)  

另外:
1. hg branch + “要创建的分支名”    创建新分支(这里必须进行一次hg commit操作才能真正创建分支)
hg branch newbranch

2. hg push --new-branch ————把在本地创建的branch 上传到远端
hg push --newbranch
3.hg update -r + ”版本号“ ———— 切到指定的版本

文章导航