Cheat sheet of some useful hg(Mercurial) commands for Tryton/Heptapod


Sometimes, I forget some hg commands.
Here’s a small cheat sheet with the most used hg commands to deal with Tryton/Heptapod.


Cloning Tryton Repo:

hg clone ssh://

Updating Tryton Repo:

hg update

Listing topics:

hg topics

Create new Topic:

hg topic <topic-name>

Switching into Topic:

hg update <topic-name>

You must rebase your topic on top of default branch. Can be done with:

hg pull -u && hg update <topic> && hg rebase -d default && hg push

Seeing diff from base:

hg diff -r s0

Seeing Stack:

hg stack

Commiting first time:

hg commit -m 'your commit'

Commiting after updating patch:

hg amend

Commiting after updating patch and changing commit text:

hg amend -e

Amending the different changesets in the stack:

hg absorb

(it requires to activate the absorb extension that is distributed with mercurial)

Folding multiple commit into one (see hg stack for s1,s2,…):

hg fold -r s1::s2 --exact

Pushing Changes:

hg push --rev .

Doing Rebase:

hg rebase -d default

Update specific commit in case of multiple commits in the same topic:

hg up <commit> && hg amend && hg evolve

Original Sources:


Thanks for putting this up! Really useful.

Is it possible to add this as a howto or whatever here on discuss? Maybe even pin it so it stays on top. Mostly because of preventing link-rot.

1 Like

Yes, kudos.
Anybody have a magic command to optimize the new repository since the migration [from using sub-repositories] such that hg view responds nicely? I give up now after 5 minutes…