notes-computer-programming-hg

Warning: i am still learning hg (mercurial), so some of the following may be incorrect.

Mercurial vs. git

i haven't used git so i dunno. Things i read suggest that the main differences are currently:

Note that the unofficial hg-git mercurial extension lets you access git repos with an hg client.

Basic mercurial terms

Basic mercurial commands

Intermediate mercurial commands

Also, the 'color' extension is easy and colorizes the output of some commands.

Note that any mercurial command can be abbreviated to the shortest disambiguous prefix.

Advanced mercurial stuff

Serving a repo over http

Top mercurial extensions

See http://mercurial.selenic.com/wiki/ExtensionHitlist , http://stackoverflow.com/questions/1869040/what-are-the-best-and-must-have-hg-mercurial-extensions

Mercurial Queues Extension

When you are working on something you want to commit intermediate states frequently so that you can revert to previous states if you change your mind; or so that you can stop working on feature A, revert to a version that runs, and do something else, then go back to working on feature A.

However, if you do this, it clutters up the repo with all these tiny commits which have no permanent value, which don't pass the testing suite, and whose content is not very well described by their commit messages. This may be annoying to you and the other programmers on the project later on.

So, Mercurial Queues adds another layer of versioning. While working on something, you save state as versioned (but temporary) "patches". When you are done, you make an actual commit, and forget about the patches.

See http://mercurial.selenic.com/wiki/MqTutorial , 'hg help mq', http://mercurial.selenic.com/wiki/MqExtension

Basic mq commands

Intermediate mq commands

Advanced mq commands

xargs -I'{}' hg qfold '{}' __merge all patches in series into the first patch (this should be qfold -a)__