mercurialaliasdefaults

In Mercurial, how to run original command if default arguments are present?


I have configured hg log in ~/.hgrc to only list commits from the current branch by default:

[defaults]
log = --branch .

However, occasionally I'd like to really see commits from all branches. Is there a way to tell hg log when invoked form the command line to not use the configured defaults but fall back to the built-in behavior? As a brute-force solution ignoring ~/.hgrc altogether for this particular invocation of hg log would be fine for me.

I'm aware that defaults are deprecated in favor of aliases, but aliases cannot be created with the same names as existing commands, which is what I want in order to not have to learn new command names, esp. when ~/.hgrc settings are to be shared by multiple developers.

Edit: Not being able to create aliases with the same names as existing commands was a regression that has been fixed.


Solution

  • You should be able to use --config to override the setting in your .hgrc:

    hg --config defaults.log= log
    

    From the man page:

    --config    set/override config option (use 'section.name=value')