免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1378 | 回复: 0
打印 上一主题 下一主题

Mercurial Hg [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-12-12 17:17 |只看该作者 |倒序浏览

Installation
Linux
In a terminal, type:
sudo apt-get install mercurial
Also install KDiff3 for merge tool:
sudo apt-get install kdiff3
Note : each sudo command may prompt you for your password.
Windows
Go to
Mercurial download site
, get the latest released version binary package and install (should be fairly straightforward).
Also install KDiff3 for merge tool, get it
Also install KDiff3 for merge tool, get it
An extra step for Windows is to install SSH. Get Putty and Plink at the
Putty page
. Then edit Mercurial.ini in the Mercurial folder with this line :
[ui]
ssh = c:\progra~1\putty\plink.exe -ssh -pw 'your password without quotes'
In a DOS prompt, run :
plink -ssh 'servername without quotes'
It will ask you to accept the remote key, just say 'y'. Then you can enter your login, password and 'exit'.
Windows GUI
For a more graphical interface to Mercurial, checkout
TortoiseHg
.
Introduction for CVS users
There are several fundamental differences between CVS and Mercurial :

  • There is no version per file, but instead per tree. Commits of several files are atomic and when you commit changes (possibly spread over several files), the version of the whole database changes.
  • When you "checkout" (called clone in Mercurial) the code, in fact you are creating your own database / repository locally. Later you will need to resynchronize your own database with the remote database; both check-ins and check-outs will be two steps process.
  • There is no concept of branch in Mercurial, but each clone is a branch.

Clone (Checkout)
To get the code from the database, open a terminal (dos command prompt for Windows) and type the command :
hg clone ssh://login@host//path
Pull (Update)
To update your local database with the most recent code from the database, run the command :
hg pull
from a directory of that database.
To do a CVS-like query update, you can run the command :
hg incoming
to check what would change in case of a pull command.
That only updates your local database, but does not touch your local files. To do that, run :
hg update
Looking at the history
To check the history of the database, run the command :
hg log
For a bit more graphical, there is an extension installed by default and you can run the command :
hg glog
You can also run a mini local server to browse the files, diffs and history with a web browser. To do that, run the command :
hg serve
The go to the address :
http://localhost:8000/
in your favorite browser.
Check-in / Commit
After you make some changes, you can check the status of your repository (what file has changed) :
hg status
This will show the files that have been modified, added, deleted...
you can run commit :
hg commit
Note that this commits all the files you changed.
This only records the changes you made in your local database.
Merging changes
When pulling changes, if some of your modified files have been changed remotely, Mercurial will detect the conflict and warn you. You will need to resolve the conflict, by running :
hg merge
This is the place where it will run your external diff tool. When you are done, you can run hg commit and resume your work as usual.
Adding a file After you created a new file, it will show with a '?' when you run hg status. To add it to the database, you just need to run : hg add [filename]
You will still need to push to the remote database.
Removing a file Very similar to adding a file, the removed file will be shown with a '!' when you run hg status, then run : hg remove [filename]
You will still need to push to the remote database.
Getting help To get more help about some commands, you can run : hg help [command]
Submit for integration At this point you have 2 choices. 1) If there's more work to do, keep working and commit again later, or 2) It's time to submit the changeset for integration.
In order to submit your changeset, it must first be rebased to the latest version of the mainline. To rebase use:
hg commit
hg pull ssh://login@host//path
At this point hg will warn if multiple heads exist and or a merge is required. If a merge is required use:
hg merge
Next step is to ensure the database is pointing to the latest, which includes all your changes as well as the result of the rebase activity. To do this use:
hg update
At this point, the code is ready for submission. For now, you can be "nice" and do a build test. Later (Q1 09), it will be a mandatory step. In any case, now is the last chance to check the changeset is coherent and functional.
After testing the rebased changeset use:
hg bundle
Here the name of file should contain your username and something about the changeset. For example, ppanagas_bugfix90210, or ylin_atapi_direct_command, etc.
Send this file to your integrator. For MAPI_DB and KERNEL_DB, this is
Similar to the query update, before you create the bundle, you can check what is actually going out :
hg outgoing
There is also much more information, a
tutorial
and a good
book
on the
Mercurial website
.
-- Main.matthieu - 02 Dec 2008
-- Main.ppanagas - 08 Dec 2008


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/19273/showart_1716269.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP