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.
Mercurial Commands. Commands. Description. hg pull. get latest changes like git pull use flags like -u IDK why yet. hg add. only for new files. hg commit. add changes to commit with -m for message just like git.
The Mercurial source recognizes the following configuration options, which you can set on the command line with --config: convert.hg.ignoreerrors: ignore integrity errors when reading.
To control Mercurial's handling of files that it manages, many commands support the -Iand -Xoptions; see hg help <command>and hg help patternsfor details. Files that are already tracked are not affected by .hgignore, even if they appear in .hgignore.
By default, this command searches all directories in the working directory. To search just the current directory and its subdirectories, use "--include .". If no patterns are given to match, this command prints the names of all files under Mercurial control in the working directory.
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')
I have gone through the bug reports on the Mercurial website and cannot find any workarounds for this, the response being a blanket "this is deprecated".
Personally, not learning the commands to me is not a valid reason for not migrating away from default command values. A possible alternative would be to move away from per-repository settings and have some settings at the user level, so you can set your own defaults / aliases.
https://www.mercurial-scm.org/wiki/Defaults
(defaults are deprecated. Don't use them. Use aliases instead)
Try:
[alias]
blog = log --branch
Usage:
hg blog <branch name>
hg blog default
I know I'm resurrecting an old question here, but this statement
aliases cannot be created with the same names as existing commands
is incorrect.
In your .hgrc
file in the [alias]
section, you can, for example, have:
[alias]
add = add --dry-run
This will make the add
command always do a dry-run, instead of actually recursively adding all unknown files in the repository.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With