Checkout the Last Public Revision with Mercurial
Publikováno: 19.6.2019
I’ve always preferred git over Mercurial (hg) because the feature branch workflow makes organizing code and working off of master very easy. You don’t get that with vanilla mercurial — instead, commits can just sort of apply on top of each other, without much organization. Sometimes mercurial can feel a bit chaotic. When working on […]
The post Checkout the Last Public Revision with Mercurial appeared first on David Walsh Blog.
I’ve always preferred git over Mercurial (hg
) because the feature branch workflow makes organizing code and working off of master very easy. You don’t get that with vanilla mercurial — instead, commits can just sort of apply on top of each other, without much organization. Sometimes mercurial can feel a bit chaotic.
When working on Mozilla’s mozilla-central repository (for your beloved Firefox!), I always start new commits off of the latest public commit. “public means it has been merged into mozilla-central, “draft” means it was created locally and is only on my machine.
Getting the last public revision ID required a bit of command line hackery and search so I found a better way to check out the last public revision:
hg checkout $(hg log -r "last(public())" --template "{node|short}")
That command is a bit much to remember so I created an alias in my .bash_profile
:
alias hgmaster='hg checkout $(hg log -r "last(public())" --template "{node|short}")'
As with every alias I create, whether a git alias or a bash alias, I wish I had created this sooner — I’d have saved so much time!
The post Checkout the Last Public Revision with Mercurial appeared first on David Walsh Blog.