Commits

Michael Heemskerk committed db757ed

CRUC-4781: Implement hg username/password http authentication.

Unfortunately, hg grabs tty input and not standard input when it asks for a password, so we're out of luck on providing the password on stdin. Instead, I've now added the username/password to the URL directly.

As a result the username/password will also be added to the .hgrc file. There are ways to avoid this though:

* Use --config auth.x.prefix=* --config auth.x.username=user --config auth.x.password=password instead of embedding it in the url
* Use hg init and hg fetch instead of hg clone

  • Participants
  • Parent commits 70c177b

Comments (0)

Files changed (1)

processutils/src/main/java/com/atlassian/utils/process/LoggingProcessMonitor.java

         this.obfuscator = obfuscator;
     }
     
+    protected String obfuscate(String value) {
+        if (obfuscator != null) {
+            return obfuscator.obfuscate(value);
+        } else {
+            return value;
+        }
+    }
+    
     /**
-     * Override this method to obfuscate parts of the command line, e.g. passwords etc. This implementation
-     * returns the unaltered command line. 
      * @param process the external process.
      * @return the command line. 
      */
     protected String getCommandLine(ExternalProcess process) {
-        if (obfuscator != null) {
-            return obfuscator.obfuscate(process.getCommandLine()); 
-        } else {
-            return process.getCommandLine();
-        }
+        return obfuscate(process.getCommandLine());
     }
 
     /**
         if (reason != null && reason.trim().length() > 0) {
             message.append("Error executing command \"").append(commandLine).append("\": ").append(reason);
         }
-        return message.toString();
+        return obfuscate(message.toString());
     }
 }