Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Plain Text by blum ( 13 years ago )
///////////////////////////////////////////////////////////////////////
public static string run_svn(string args_without_password, string svn_username, string svn_password)
{
// run "svn.exe" and capture its output
System.Diagnostics.Process p = new System.Diagnostics.Process();
string svn_path = Util.get_setting("SubversionPathToSvn", "svn");
p.StartInfo.FileName = svn_path;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
args_without_password += " --non-interactive";
Util.write_to_log ("Subversion command:" + svn_path + " " + args_without_password);
string args_with_password = args_without_password;
if (svn_username != "")
{
args_with_password += " --username ";
args_with_password += svn_username;
args_with_password += " --password ";
args_with_password += svn_password;
}
p.StartInfo.Arguments = args_with_password;
p.Start();
string stdout = p.StandardOutput.ReadToEnd();
p.WaitForExit();
stdout += p.StandardOutput.ReadToEnd();
string error = p.StandardError.ReadToEnd();
if (error != "")
{
Util.write_to_log(error);
Util.write_to_log(stdout);
}
if (error != "")
{
string msg = "ERROR:";
msg += "<div font-weight: bold; font-size: 10pt;'>";
msg += "<br>Error executing svn.exe command from web server.";
msg += "<br>" + error;
msg += "<br>Arguments passed to svn.exe (except user/password):" + args_without_password;
if (error.Contains("File not found"))
{
msg += "<br><br>***** Has this file been deleted or renamed? See the following links:";
msg += "<br><a >http://svn.collab.net/repos/svn/trunk/doc/user/svn-best-practices.html</a>";
msg += "<br><a >http://subversion.open.collab.net/articles/best-practices.html</a>";
msg += "</div>";
}
return msg;
}
else
{
return stdout;
}
}
Revise this Paste