Showing posts with label mercurial. Show all posts
Showing posts with label mercurial. Show all posts

Wednesday, November 21, 2012

hg over ssh

I'm working with a repo that I can't access using http, so it's just as well that Mercurial works just fine and dandy over ssh as well - you just have to do a little bit of tweaking to the basic configuration to get things working smoothly.

Add the following to the client .hgrc:
[ui]
remotecmd=<path_to_hg>
Where <path_to_hg> is the path to the hg executable on the main repo machine.

This was from StackOverflow: cloning-a-mercurial-repository-over-ssh

Now, I'm working very remotely from the main repo (6000 miles) so it is worth using compression. Just add the following to the [ui] section of .hgrc:
ssh = ssh -C
You could also configure ssh to use compression by default (see details in link below).

This page has a good overview of using ssh with mercurial: collaborating-with-other-people

Monday, October 8, 2012

Mercurial file patterns

I wanted to add all the scripts in a directory tree to the local Mercurial repository. I was going to do something like this:
> find . -name \*.sh | xargs hg add
Which is nice enough (find and xargs go well together), but you can also do it using just Mercurial using patterns. e.g.
> hg add 'glob:**.sh'
The two most useful patterns (for me) are:
  • '*' match any text in the current directory only
  • '**' match anything in the entire tree
The patterns are much richer than this though; see hg help patterns for more on what's available (including regexes).