Search code examples
mercurial

How (is it possible) to create an hg command alias that runs multiple commands?


I would like to define a Mercurial command alias in my hgrc file that invokes multiple commands. For example I would like to do something like the following:

[alias]
giveup = revert --all --no-backup; purge
syncprod = fetch production; push production

This would allow me to call hg syncprod and have it invoke a fetch and then a push. Haven't been able to determine if this capability exists. (I'm guessing that means no.)


Solution

  • Use the shell alias style like this:

    giveup = !$HG revert --all --no-backup ; $HG purge
    

    Though, personally I'd just create a bash alias for those so I could skip the hg part altogether.