epcim
10/20/2015 - 4:04 PM

mercurial.howto.md

Mercurial

doc

http://mercurial.selenic.com/wiki/QuickStart

config

~/.hgrc:

[ui]
username = John Doe <john@example.com>

.hgignore:

syntax: glob
*.orig
*.rej
*~
*.o
tests/*.err

syntax: regexp
.*\#.*\#$

cli

hg clone http://selenic.com/hg mercurial-repo
hg sum

hg status         # show all non-ignored files
hg add            # add those 'unknown' files
hg commit         # commit all changes into a new changeset, edit changelog entry
hg parents        # see the currently checked out revision (or changeset)

workflow

hg clone project project-work    # clone repository
cd project-work
<make changes>
hg commit
cd ../project
<make other changes>
hg commit
hg pull ../project-work   # pull changesets from project-work
hg merge                  # merge the new tip from project-work into our working directory
hg parents                # see the revisions that have been merged into the working directory
hg commit                 # commit the result of the merge

Exporting a patch

(make changes)
$ hg commit
$ hg export tip    # export the most recent commit

clone from the primary Mercurial repo

$ hg clone http://selenic.com/hg/
$ cd hg

pull new changesets from an existing other repo into the repository (.hg)

$ hg pull http://selenic.com/hg/

export your current repo via HTTP with browsable interface on port 8000

$ hg serve -n "My repo"

push changesets to a remote repo with SSH

$ hg push ssh://user@example.com/hg/