My Wiki!

Clone

hg

  hg clone https://thuydang@bitbucket.org/thuydang/cmsplugin-news
  

Commit

Recording changes in a new changeset

We can modify files, build and test our changes, and use hg status and hg diff to review our changes, until we're satisfied with what we've done and arrive at a natural stopping point where we want to record our work in a new changeset. 2 comments

The hg commit command lets us create a new changeset; we'll usually refer to this as “making a commit” or “committing”. 2 comments Setting up a username

When you try to run hg commit for the first time, it is not guaranteed to succeed. Mercurial records your name and address with each change that you commit, so that you and others will later be able to tell who made each change. Mercurial tries to automatically figure out a sensible username to commit the change with. It will attempt each of the following methods, in order: 7 comments

  • If you specify a -u option to the hg commit command on the command line, followed by a username, this is always given the highest precedence. 2 comments
  • If you have set the HGUSER environment variable, this is checked next. 2 comments
  • If you create a file in your home directory called .hgrc, with a username entry, that will be used next. To see what the contents of this file should look like, refer to the section called “Creating a Mercurial configuration file” below. 2 comments
  • If you have set the EMAIL environment variable, this will be used next. 1 comment

Mercurial will query your system to find out your local user name and host name, and construct a username from these components. Since this often results in a username that is not very useful, it will print a warning if it has to do this. 6 comments

If all of these mechanisms fail, Mercurial will fail, printing an error message. In this case, it will not let you commit until you set up a username. No comments

You should think of the HGUSER environment variable and the -u option to the hg commit command as ways to override Mercurial's default selection of username. For normal use, the simplest and most robust way to set a username for yourself is by creating a .hgrc file; see below for details. 4 comments Creating a Mercurial configuration file

To set a user name, use your favorite editor to create a file called .hgrc in your home directory. Mercurial will use this file to look up your personalised configuration settings. The initial contents of your ~/.hgrc should look like this.

# This is a Mercurial configuration file.
[ui]
username = Firstname Lastname <email.address@example.net>

Commit

 hg commit 
 # edit and save
 

Push changes to remote repo

show outgoing changes

Show the changes that will be pushed.

 hg outgoing
 

Pushing

 hg push
 

If no remote location is given, the recorded location in .hg/hgrc will be used. Have alook at it.

[paths]
default = https://thuydang@bitbucket.org/thuydang/cmsplugin-news



http://hgbook.red-bean.com/read/a-tour-of-mercurial-the-basics.html


Navigation