Mercurial > hg > mercurial
changeset 368:7d9620034403 Eluru-6.5.x
Remove private data from debug logs
author | Dmitry Neverov <dmitry.neverov@jetbrains.com> |
---|---|
date | Wed, 08 Feb 2012 10:33:34 +0400 |
parents | e8f0eb6d4ca4 |
children | 0b2e9154d26e dbdee21f2893 |
files | mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/BaseCommand.java mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/MercurialCommandLine.java |
diffstat | 2 files changed, 35 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/BaseCommand.java Wed Jan 11 12:50:45 2012 +0400 +++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/BaseCommand.java Wed Feb 08 10:33:34 2012 +0400 @@ -62,27 +62,12 @@ } protected GeneralCommandLine createCL() { - GeneralCommandLine cl = new EscapingCommandLineDecorator(); + GeneralCommandLine cl = new MercurialCommandLine(getPrivateData()); setupExecutable(cl); return cl; } /** - * Escape its parameters - */ - private static class EscapingCommandLineDecorator extends GeneralCommandLine { - @Override - public void addParameter(@NotNull String parameter) { - String escaped = escape(parameter); - super.addParameter(escaped); - } - - private String escape(String s) { - return StringUtil.escapeQuotesIfWindows(s); - } - } - - /** * Since mercurial 1.7 on Windows the only file inside '<mercurial_install_dir>/bin' is 'hg.cmd' * which run hg.exe placed in the parent dir. GeneralCommandLine will not find hg.cmd, in the * case when $PATH contains <mercurial_install_dir>/bin and doesn't contain <mercurial_install_dir> @@ -126,6 +111,7 @@ } public Set<String> getPrivateData() { - return Collections.singleton(mySettings.getPassword()); + String password = mySettings.getPassword(); + return password != null ? Collections.singleton(password) : Collections.<String>emptySet(); } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mercurial-common/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/command/MercurialCommandLine.java Wed Feb 08 10:33:34 2012 +0400 @@ -0,0 +1,32 @@ +package jetbrains.buildServer.buildTriggers.vcs.mercurial.command; + +import com.intellij.execution.configurations.GeneralCommandLine; +import jetbrains.buildServer.util.StringUtil; +import org.jetbrains.annotations.NotNull; + +import java.util.Set; + +public class MercurialCommandLine extends GeneralCommandLine { + + private final Set<String> myPrivateData; + + public MercurialCommandLine(@NotNull Set<String> privateData) { + myPrivateData = privateData; + } + + @Override + public String getCommandLineString() { + String original = super.getCommandLineString(); + return CommandUtil.removePrivateData(original, myPrivateData); + } + + @Override + public void addParameter(@NotNull String parameter) { + String escaped = escape(parameter); + super.addParameter(escaped); + } + + private String escape(String s) { + return StringUtil.escapeQuotesIfWindows(s); + } +}