I've setup a small mercurial extension, which sets a config parameter with ui.setconfig
on start. It works without javahg but it does not with javahg.
Extension:
def uisetup(ui):
ui.setconfig(b"http_proxy", b"host", b"localhost:3128")
If i add the extension to the hgrc and use hg config
, i can see the config entry http_proxy.host=localhost:3128
. But if i try to use the extension with javahg i can't see the entry:
void printConfigWithExtension() throws IOException {
RepositoryConfiguration conf = RepositoryConfiguration.DEFAULT;
conf.addExtension(ProxyConfigExtension.class);
BaseRepository repository = Repository.create(conf, new File("/tmp/hg"));
ConfigCommand command = new ConfigCommand(repository);
System.out.println(command.execute());
}
public static class ConfigCommand extends AbstractCommand {
protected ConfigCommand(Repository repository) {
super(repository);
}
@Override
public String getCommandName() {
return "config";
}
public String execute() throws IOException {
return launchString();
}
}
public static class ProxyConfigExtension extends MercurialExtension {
static final String NAME = "proxyconfig";
@Override
public String getName() {
return NAME;
}
@Override
public String getPath() {
return "/absolute/path/to/proxyconfig.py";
}
}
I have verified that the extension is executed, by adding simple logging to the extension:
def uisetup(ui):
ui.setconfig(b"http_proxy", b"host", b"localhost:3128")
f = open("/tmp/extension.log", "a")
f.write("proxyconfig ext")
f.close()
The file is created, but the output does not contain the config parameter