[SCM] source code management-mercurial

Source: Internet
Author: User
Tags mercurial

A Distributed Source code management tool, mercurial

Mercurial is widely used as the three mainstream distributed source code management tools. For example, both googlecode.com and codeplex.com support mercurial as source code management tools.

Home: http://mercurial.selenic.com/

More help: http://hgbook.red-bean.com/and tortoisehg. CHM

Super good PPT: http://www.slideshare.net/tednaleid/distributed-version-control-dvcs-with-mercurial

 

Windows Installation is very convenient, just double-click MSI (such as mercurial-1.9.1-x64.msi or tortoisehg-2.1.2-hg-1.9.1-x64.msi. Mercurial also supports Linux and MACOs.

Command line download: http://mercurial.selenic.com/downloads/

Download tortoisehg for Shell integration: http://mercurial.selenic.com/downloads/

Introduction to command line

The mercurial server used in this article is the https://code.google.com/p/mercurial001, if the reader needs to test, you can leave your googlecode username, I can add you as committer, you can test all the functions.

 

1) clone the project from the remote repository to the local machine, and then modify and submit it to the remote Repository

 

Explanation:
# Clone mercurial001 repository to a local machine.
$ Hg clone https://code.google.com/p/mercurial001
# Switch to the mercurial directory
$ CD mercurial001
# Add a new file t2.txt under the current directory mercurial001.
# The t2.txt is in the Add status.
$ Hg add
# Configure your own user information before commit and push. If no user is configured, the logon user of the local machine is used by default in commit, in this case, the default server value in the configuration file is the clone source by default.
Bytes.
# Submit the modification to the local repository.
$ Hg commit-m'add t2.txt '[-u AAA]
# Connect the local repository to the remote mercurial001 repository.
$ Hg push [http://selenic.com/repo/hello]
# If you are pushing to googlecode, you need to use the username and password of googlecode.

 

2) configuration:. HG/hgrc configuration file

 

Explanation:

[Paths]

# Default is the target address to be pushed and also the source address of pull.

Default = https://code.google.com/p/mercurial001
[UI] # username is the user name of the local commit. It can be different from the username submitted to googlecode.
Username = aaa <AAA@gmail.com>

3) Other common functions

Explanation:

# Synchronize the remote mercurial repository to the local repository.
$ Hg pull
# Synchronize the local repository to the working copy.
$ Hg update
# MARK t4.txt as deleted.
$ Hg remove t4.txt
# View the modification status of the current working copy
$ Hg status
# Apply the modification to the local repository
$ Hg commit-M "Remove t4.txt"
# View the modification history of the local repository
$ Hg log
# Connect the local repository to the remote mercurial001 repository.
$ Hg push [http://selenic.com/repo/hello]
# If you are pushing to googlecode, you need to use the username and password of googlecode.

4) create a new repository and project, and then submit the changes.
# Create a new repository.
$ Hg Init (Project-directory)
# Enter the repository directory.
$ Cd (Project-directory)
# Add a new file.
$ (Add some files)
# Mark the newly added file as the newly added status.
$ Hg add
# Apply the previous changes to repository.
$ Hg commit-m'initial commit'

5) Enable repository to be accessed by other users through HTTP
# Enable HTTP access for the current repository.
$ Hg serve
# Access repository through HTTP.
$ Hg clone http: // ip: 8000/

 

Three other good distributed source code management tools are git and bazaar, but it is most convenient to install mecurial on Windows.

 

Complete!

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.