Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1351679
  • 博文数量: 281
  • 博客积分: 8800
  • 博客等级: 中将
  • 技术积分: 3346
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-17 22:31
文章分类

全部博文(281)

文章存档

2013年(1)

2012年(18)

2011年(16)

2010年(44)

2009年(86)

2008年(41)

2007年(10)

2006年(65)

我的朋友

分类: LINUX

2008-12-12 17:17:52

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 . 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 .

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 : 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 on the Mercurial website.

-- Main.matthieu - 02 Dec 2008

-- Main.ppanagas - 08 Dec 2008

阅读(1705) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~