一日二十四挨踢(http://1024it.net/?p=141)
hg专题文章:
有很多网站提供了免费的Mercurial版本库托管,最有名的要数Bitbucket 和 Google Code,由于博主使用的是BB,在此以BB为例来说明一下使用Mercurial来创建repository。 在此建议看官注册一个Bitbucket账号(Bitbucket注册)。
Bitbucket为我们提供了一个很友好的操作面板,当你登录后,就会看到下面的界面:
点击右边的Create repository或者蓝色部分的Create,就会出现下面面板:
填写对应信息,完成repository的创建:
1.填写repos的名称。
2.对repos的描述。
3.选择repos的访问权限,如果想私有,就勾选Access Level。
4.Forking 默认。
5.Repository type 选择Mercurial,我们这里练习Mercurial的使用
6.Issue tracking 和 Wiki也勾选吧,以后追踪bug,写说明有用。
7.选择你工程的语言类型。
8.点击Create repository 创建我们的工程。(我创建testHg为私有的测试Repos)
点击Clone,获取仓库的克隆地址:
复制地址到终端,获取刚才创建的repository:
c_wspace$ hg clone https://[email protected]/RobinLau/testhg
http authorization required
realm: Bitbucket.org HTTP
user: RobinLau
password:
destination directory: testhg
no changes found
updating to branch default
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
我们来看一下创建的名为testhg的repos的目录结构(下面是tree的结果,.hg下是隐藏文件,hgrc是hg的配置文件):
testhg$ tree -R .hg/
.hg/
├── 00changelog.i
├── branch
├── dirstate
├── hgrc
├── requires
└── store
1 directory, 5 files
为repos添加README,并且添加一个测试文件:
testhg$ ls
README testhg.c
我们把添加的文件push到BB的仓库中:
robin@ubuntu:~/workspace/c_wspace/testhg$ hg add
adding README
adding testhg.c
robin@ubuntu:~/workspace/c_wspace/testhg$ hg commit -u RobinLau -m "test hg"
robin@ubuntu:~/workspace/c_wspace/testhg$ hg push
pushing to https://[email protected]/RobinLau/testhg
http authorization required
realm: Bitbucket.org HTTP
user: RobinLau
password:
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 2 changes to 2 files
我们可以看到,testhg.c和README到我们仓库里了,README的内容也显示在了我们的面板中。
HG在windows上的使用方法(待续)