试用 TortoiseHg

试用 TortoiseHg

====================================
原来的方案: VisualSVN(服务器)+tortoiseSVN(客户端)
====================================
我的svn repo其实并不是专门存储某个project, 而是集中存放了工作中要用的所有文档, 所以文档非常之多, 大概2GB多.
VisualSVN+tortoiseSVN 这个组合原本非常好. VisualSVN 配置简单, 只是tortoiseSVN的TSVNCache.exe进程时不时占用太多的CPU, 优化几次icon overlap 设置, 这个问题也没有最终解决. 另外, 提交有时也报错, 也许是文件太多的缘故.


====================================
试用 TortoiseHg, 这是我目前使用的
====================================
试用感受: TortoiseHg 确实是一个非常好的版本管理工具. 官方提示: 禁止anti_virus和windows index service扫描 TortoiseHg 的repo目录.  tortoiseSVN和tortoiseGit看起来是同一个团队开发的, 界面以及风格非常相似. TortoiseHg和它们个差异还是很大的.
TortoiseHg优势体现在:
(1) 有一个特别的icon overlap 服务, 没有TGitCache.exe/TSVNCache.exe进程狂吃CPU的问题.
(2) commit/add 等界面有很灵活的文件过滤机制.
(3) workbench 功能强大,  可以给revision打tag/bookmark和导出patch和导出archive, 可以对repository做sync/purge操作.
(4) 操作比git简单多
(5) 和windows版的git相比, 非常小巧
(6) 集成Issue Tracking和Review Board
缺点:
  (1)不支持针对单个文件夹的分支.
  (2)thgw.exe占用内存较多  
我启用的Extensions有:
  progress, largefiles
 
====================================
hg的分支和合并操作(最好是使用hg命令行, 或者使用workbench的sync功能)
====================================
http://mercurial.selenic.com/wiki/NamedBranches

#创建基于tipmost的分支,之后 commit 的都会进入 newfeature 这个分支
hg branch newfeature #创建 newfeature 分支

#创建基于一个revision 500的分支
hg update -r 500
hg branch newfeature

#列出所有的分支
hg branches   

#切换回default 分支
hg update default  

两repo合并示例(拉模式)
hg branch newfeature # 创建一个newfeature 分支
hg incoming http://some.net/repos/remote  # 查看远端库的changeset, 也可以指定某个branch
hg pull http://some.net/repos/remote  #将远端库的changeset pull到本地, 也可以指定某个branch
hg merge #merge远端的changeset 到本地 newfeature 分支

本地repo两个分支的合并示例
1.在workbench中, 选择源分支新近的几个revision, 导出patch.
2.在workbench中, 在目标分支最新的tip上, 导入这些这些patch.


====================================
顺便试用 git
====================================
windows下有gitextensions和tortoisegit, 以及github发布的github-for-windows. github-for-windows 功能很少, 我没有使用. gitextensions和tortoisegit我两个结合着:
gitextensions主要用来做一些设置, 比如初始化repo, 设置.gitignore文件; tortoisegit做一些日常的commit等操作.

gitextensions
    http://code.google.com/p/gitextensions/
    gitextensions是.net开发的, 不像tortoisegit集成在windows explorer, 它仅有一个统一的work bench. 安装和配置非常方便, 已经在安装包中集成了 msgit.
命令行中使用git
    在安装 gitextensions 后, Git bash也就装好了. 可直接使用, 结合putty+WinSshD使用, 感觉更好.       
tortoisegit
    http://code.google.com/p/tortoisegit/
    tortoisegit 集成在windows explorer中, 受控的folder图标会有icon overlap.
    我发现TGitCache.exe和TSvnCache.exe一样, 比较消耗资源.
    (1)调整Icon Overlaps设置为Default 模式, 同时设置禁掉"所有"的Drive Type, 然后设置Include paths为需要git管理的目录. 这样tgitcache就仅仅监控这些目录了.
    (2)手动调整TGitCache.exe进程的优先级为"低于标准".     
     

====================================
hg的相关教程
虽然不用hg了, 但是如下教程对于理解git也很有帮助
====================================
首先, 理解几个概念: Revision, Changeset, Head, Tip
http://www.ibm.com/developerworks/cn/opensource/os-cn-mercurial/

接着, 图解hg的几个命令
http://en.wikipedia.org/wiki/Mercurial
http://en.wikipedia.org/wiki/File:Mercurial_commandd_and_their_relations.png

一个简单的hg教程
Mercurial examples
http://faculty.washington.edu/rjl/uwamath583s11/notes/hgex.html

hg英文完整教程, Joel Spolsky写的
Joel Spolsky's Mercurial tutorial
http://hginit.com/

创建、合并 Hg 分支
http://rex.zhang.name/index.php/2012/05/705/

hg中文图解教程, Keakon的文章, 决定采用Mercurial(Hg)了
http://www.keakon.net/2009/12/09/%E5%86%B3%E5%AE%9A%E9%87%87%E7%94%A8Mercurial(Hg)%E4%BA%86



====================================
.hgignore和.gitignore的配置
====================================
#use Shell-style glob
syntax: glob # .gitignore 只需要注释这一行

#ignore thumbnails created by windows
Thumbs.db
#Ignore created files of Other VCS
*.svn
*.hg
*.git
#Ignore created files of Eclipse
*.metadata
#Ignore created files of Python
*.pyc
#Ignore created files of Delphi
*.dcu
*.~pas
*.~dof
*.~dfm
*.~ddp
*.~dpr 

posted @ 2012-12-24 13:37  harrychinese  阅读(1382)  评论(0编辑  收藏  举报