Home   Notes   Contact Me

Mercurial

Local

External


Merge

See http://hgbook.red-bean.com/read/a-tour-of-mercurial-merging-work.html

Or if you feel lucky just run the merge command, which so far has worked for me. I usually commit before the merge, so I figure even if it messes things up I can get what I had back.

# Typical Sequence hg addremove hg commit -m "some message" hg pull -u # which responds with: not updating: crosses branches (merge branches or update --check to force update) # so then I hg merge hg status hg commit -m "some other message" # and it all seems to be fine

Ignore, Locally

Just make a .hgignore file as sibling to your .hg directory. It will start working instantly. Note that you should probably hg add .hgignore so that the settings follow the archive.


Ranges

Most recent to the 2nd version before it inclusive

$ hg log -r tip:-2 changeset: 11:88100c9d277f tag: tip user: XXXXX date: Thu Feb 23 10:31:43 2012 -0500 summary: blah blah blah changeset: 10:3cd589155e2d user: XXXXX date: Tue Feb 21 15:55:15 2012 -0500 summary: blah blah blah

Cloning over ssh

# To get from a directory relative to your home directory: hg clone ssh://{username}@{host}/directory/ # To get from a directory with an absolute path: hg clone ssh://{username}@{host}//cygdrive/path/

Ignore Per Repository

create a file .hgingore as sibling to the .hg directory.  Put ignore stuff in it
// example contents: syntax: glob *.vsprops *.user *.i *.ncb *.suo [Un]it[Tt]est[Dd]ata

Global Ignore

You can set up mercurial to use a global ignore file.

in .hgrc put:

[ui] ignore = {path to ignore file} // i.e. [ui] ignore = ~/.hgignore // or maybe [ui] ignore = %USERPROFILE%\.hgignore // or [ui] ignore = /cygdrive/d/Preserve/globalHgIgnore.txt

Setting the path used to find hg via ssh

The problem I was having, was that hg was being found in the windows path instead of the cygwin path on a
machine that had both the Windows and the cygwin version installed.
On the remote machine in the ~/.hgrc file provide the path as shown below.
[ui] remotecmd = /usr/bin/hg

Workflow, typical parts

# check status: hg status # save changes locally hg commit -m "commit message goes here" # send changes to repository hg push https://bitbucket.org/path/path # if the config file is set up properly, you can just do this to send changes: hg push # to get others changes: hg pull https://bitbucket.org/path/path # and again with correct setup: hg pull # to take a non-mercurial directory and prep it for file adding (files can already exist in it) # you can hg add after this hg init {target dir path} # i.e. hg init superproject # to revert a file to its previous state hg revert {filename}