版本控制 Mercurial

来源:互联网 发布:java raw type 编辑:程序博客网 时间:2024/04/29 14:26

在BitBucket上使用Mercurial做代码版本控制:    BitBucket: 是一家源代码托管网站,采用Mercurial和Git作为分布式版本控制系统。
    GUI TortoiserHg: TortoiseHg is a set of graphical tools and a shell
    extension for the Mercurial distributed revision control system.
Mercurial 常用命令:

    hg clone repository :这里repository是源码的地址    hg add              :add new file    hg commit -m 'My changes'  :-m增加修改信息,    注:提交后要push,changeset才能上传到远程仓库上    hg push   :推入远程仓库    hg pull   :下拉changeset    hg merge  :合并分支    hg update :更新    hg status :show changed files in the working directory    hg forget :forget the specified files on the next commit    hg remove :remove the specified files on the next commit import
提交代码的一般步骤:
    $hg commit //为本地changes创建一个节点    $hg pull   //检查远程仓库是否有别人新的changes。    $hg merge  //如果有别人的更新。    $hg push   //将changes推入远程仓库。

在.hg/hgrc中配置扩展

配置vimdiff:

[extensions] hgext.extdiff = [extdiff]cmd.vimdiff = // 添加后使用 hg vimdiff [file] 查看

配置用户名:

    [ui]    username = 

配置扩展操作mq:

    [extensions]    mq =

补丁的常用命令:

    hg qnew 创建一个补丁    hg qpush 将补丁压栈    hg qpop  将补丁弹栈    hg qrefresh 刷新补丁,将新的changes刷入补丁    hg qfinish  将补丁转换成commit    hg qrename  补丁更名    hg qunapplied print the patches not yet applied    hg qdelete  删除某个未使用的补丁(unapplied)

关于补丁的一些官方资料:

GUI:  http://tortoisehg.bitbucket.org/manual/2.0/patches.html
http://mercurial.selenic.com/wiki/MqExtension/
http://mercurial.selenic.com/wiki/MqTutorial

HGRC:

http://www.selenic.com/mercurial/hgrc.5.html