Getting started with mercurial and tortoisehg

Source: Internet
Author: User
Tags mercurial

Getting started with mercurial and tortoisehg

Reprinted: http://www.cnblogs.com/meetrice/archive/2010/07/12/1775707.html

Among distributed version management tools, git and mercurial are the most popular tools. The well-known Linux uses Git for source code management, while Python and Firefox use Hg (you can find a bunch of projects using Hg here ).

 

1. Why use distributed configuration management?(Cause reference: http://wiki.woodpecker.org.cn/moin/DistributedScm)

 

2. Why choose mercurial?

Because git's main advantage lies in its branches, and localization does not require too many branches, git's support for Windows seems to be inferior to mercurial, and SSH is more troublesome than HTTP, which is hard to be used by members of the localization group; another special reason is that Hg is mainly implemented in Python (a small part is implemented in C ).
Hg also has a serious drawback: it does not support the branch targeting a single folder. If you want to build a branch for script translation and rebuild, you must copy the entire repository. for translation, image files are not what they need.

Appendix: Google also published analysis of git and mercurial, which shows why Google Code decided to support Hg rather than git.

Git advantages:

  • Client storage control. You can delete any version without having to consider the subsequent version of the branch.
  • Unlimited number of parent nodes. Hg can only be divided into two branches at a time. Merging n branches requires many operations. Git has no restrictions.
  • Supports rebase. It can move the current version to the latest branch. For example, assume that a local database is developing a new feature of 1.0, and the baseline has been upgraded to 1.1. Generally, it needs to be merged to 1.1, and rebase can avoid this operation.

Advantages of Hg:

  • Learning curve. Due to many factors, git has a steep learning curve than HG.
  • Windows is supported.
  • Maintenance. Git needs regular maintenance.
  • History cannot be violated. Git is very powerful and can do almost anything, so it will also lose historical information.

 

It seems that git is technically better than HG, but because the implementation of file operations depends on the operating system, porting to bigtable will be troublesome; in addition, Hg has a good HTTP-based stateless pushing and pulling, which is easy to integrate with Google's architecture (almost all Google services are based on HTTP ).
Google also provides test data specifically, indicating that git is one order of magnitude slower than HG When HTTP is used. (Two numbers are mentioned, which are 22 times slower and 12 times slower .)

 

3. Where can I host code for free:

  • GitHub: This website is famous for its MB free space built with ror. It supports git, but does not support Hg (although there are plug-ins, it is too troublesome to teach others ), there is no private library.
  • Bitbucket: This is created using Django. You can create a private library, free space of MB, and support for Hg.
  • Projectlocker: only (unlimited) Private libraries, free space of MB, support for SVN and git, but only 5 users. Closed-source project recommendation, but obviously not suitable for a large Tomo Chinese group.
  • Unfuddle: Free Space of MB. It supports SVN and git and can only have one database and two users.

In the end, I chose the smallest Bitbucket, because it is almost enough.
(Note: Google Code now supports Hg, but it can only host source code and cannot be used for other purposes, so I can only give up. However, if you are developing open-source software, Google Code is the most generous. You can also send a mail application to expand the quota, but occasionally get gFW .)

 

4. tortoisehg Installation

Then we started to install the software. I am used to SVN turtles, so I still chose tortoisehg ).
Currently, this version supports Windows XP, Vista, and Windows 7, so you do not have to worry about compatibility.
The installation is very simple. After the installation is complete, you need to restart (in fact, you can also use it without restarting ).
If you like the command line, you can also enter Hg in cmd to try.

 

5. display Chinese characters on the tortoisehg Interface

You need to create an environment variable "language" (in system attributes) with the value "zh_cn ".

Then you have to go to this folder: C: \ Program Files \ tortoisehg \ cmenu_i18n to import the thg-cmenu-zh_CN.reg file.
After the modification, the software interface and command line (Hg and hgtk) are now in Chinese, but the right-click menu is still in English. Restart or log out to become Chinese.

 

6. Basic mercurial operations

  • Before using mercurial, we recommend that you take a look at the mercurial tutorial to learn about several terms. Init refers to initialization, that is, creating an empty repository.
    Clone refers to the creation of a repository. The source can be an HTTP or SSH link or a local repository.
  • Commit refers to the submission, that is, accepting all changes and using the current version as the latest version (also called tip ). Note that this submission is different from the centralized SCM. It only submits the local repository, and the local repository records all changes in detail (called Change set or change set ). Therefore, it is okay to submit multiple times because it does not affect others' warehouses. If you are afraid of affecting yourself, you can clone a duplicate and then rewrite and submit it.
  • A revert is a restoration, that is, all changes are revoked and restored to the unchanged state. You cannot find it in the right-click menu.
  • Pull means to pull the changes that are available in other warehouses but not in the current warehouse to the current warehouse. However, this only adds a change set, and the file will not be changed. (The change set has a unique hash ID, so it is easy to differentiate .)
  • Update means update. When other Change sets are obtained and the changes need to be consistent with those of other warehouses, You can execute the update.
  • Push means to upload the change set of the current warehouse to another warehouse. Other repositories must support this operation and may need to be verified. If it is pushed from the local warehouse A to the local warehouse B, it is equivalent to using B pull. In addition, push does not update the repository version, because it is shared, and you can directly select the desired version.
  • Merge means merge. When a file is modified multiple times and stored in multiple warehouses, a unified version must be obtained and merged. For translation, a text may be distributed to multiple people at the same time, so you only need to accept the changes made by each person during the merge.

 

If you want to learn more, read mercurial: the definitive guide.

After the introduction of these terms, you can look at the usage methods written by others:
Git vs mercurial Hg? Remote Collaborative Development and distributed SCM solution selection!
Codebeamer + mercurial Practical Operation Manual
Of course, that PDF document is also useful.

However, for the sake of the comrades in the localization group, I 'd like to explain how to complete the operation.

 

First, go to my Bitbucket homepage and find the familyproject project.
The following are some tips:

Reference:

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.