Simple use of Hg

Source: Internet
Author: User
Document directory
  •  
1. Basic functions

In addition to Hg clone, the following commands must be executed under the Directory and subdirectory managed by Hg (the Directory and subdirectory have the same execution effect ).

1. Version library Initialization

First, run the Hg clone/hgreposity/testdev command to copy the database, for example, clone the master NGN Database: run the Hg clone/hgreposity/testdev command in the worksapce folder under the root directory of your user, the testdev directory appears under this directory. This directory is an HG library. This operation takes only one time for a project, and Hg pull will be used for synchronization with the master database in the future.

2. Add a new file and view the File status

After developing a new file in the downloaded directory, use Hg Add "file name" to submit the file to Hg for management. Then, you can use Hg status-all to check whether the file is added. The first field is 'A', which indicates the new file added after the previous commit, 'M' indicates the file modified after the previous commit, and 'C' indicates the file not modified after the previous commit, 'I' indicates that files that are ignored and do not perform version tracing (such *. O files ),'? 'Indicates that the file with an unknown state has not been managed by Hg.

You can use Hg diff to view the differences between the current file and the previous version of commit.

3. Local commit)

After modifying a managed file, run the Hg commit command and enter the commit log in the VI interface to exit and save. Here, the commit is submitted only to the local device and is irrelevant to the master database.

4. Record (log)

If you want to confirm whether the submission is complete, view the version history and use Hg log.

5. Get the file (pull) from the master database)

To obtain the software version of the current master database from the master database, use Hg pull. For example, in the previous example, Hg pull/hgreposity/ngndev will synchronize the Changeset in the master database to the local machine. (note! At this time, the file is not changed to the version on the master database.) then, update the file with Hg update to bring the file to the latest state.

6. Merge conflicts

After Hg pull and Hg update, You can prompt merge conflict, indicating that the merger produces a conflict and the commit cannot be performed. The primary reason is that the local database and the primary database modify the same file, and the Hg cannot be merged automatically. Merge manually.

Specific manual merge process:

Open the file prompting merge failure in merge conflict, and look for the following comments:

<Local

...

====================

...

>>>>>>>>>>

The content from above to <is the content of the local library and the content of the file is as follows. Select the Merged Code as the appropriate code and remove the comments it adds.

After modifying these issues in all files, use Hg resolve-m-a to mark all files as resolved. Then commit.

7. Web Interface

Use Hg serv to start web page access. The default address is http: // localhost: 8000.

 

8. Get help

Hg has a built-in help system. The parameter is help. After help, you can also use the command to be queried as the parameter. There are many other commands in Hg, and the commands described above generally have detailed parameters. You can use Hg help "command name" to query.

For example:

~ /Workspace/HG help init

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.