Using the --quiet tag with the Mercurial extension

I am writing a Mercurial extension in Python and you need to call the "Pull" command using the Mercurial API , but I want to suppress its output using the -quiet flag.

In terms of Hg, I want to execute the following code, but from within my extension:

hg pull --quiet 

Given the documentation of the Mercurial API, I thought it would be as simple as:

 commands.pull(ui, repo, quiet=True) 

Unfortunately, although this does not lead to errors and successfully executes the "Pull" command, the -quiet flag does not seem to pass, since I still see the standard output.

All examples show only passing non-global flags, so I'm a little worried that this is not possible.

What am I doing wrong? How to pass the --quiet flag?

+6
python mercurial mercurial-extension
source share
1 answer

Global parameters are affected through the ui object. It allows you to manage many things that you usually installed in your (or repository) hgrc. In this case, you want to set the quiet parameter in the ui section to True.

 ui.setconfig('ui', 'quiet', True) commands.pull(ui, repo) 
+8
source share

All Articles