tags:

views:

378

answers:

5

I'd like to call svn up from an asp.net page so people can hit the page to update a repository. (BTW: I'm using Beanstalk.com svn hosting which doesn't allow post-commit hooks, which is why I am doing it this way).

See what I've got below. The process starts (it shows up in Processes in Task Manager) and exits after several seconds with no output message (at least none is outputted to the page). The repository does not get updated. But it does do something with the repository because the next time I try to manually update it from the command line it says the repo is locked. I have to run svn cleanup to get it to update.

Ideas?

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
    startInfo = New System.Diagnostics.ProcessStartInfo("svn")
    startInfo.RedirectStandardOutput = True     
    startInfo.UseShellExecute = False
    startInfo.Arguments = "up " & Request.QueryString("path")

    pStart.StartInfo = startInfo
    pStart.Start()
    pStart.WaitForExit()

    Response.Write(pStart.StandardOutput.ReadToEnd())
End Sub
A: 

Does it write to stderr?

Chris Farmer
A: 

Chris -- Thanks for the reply. I added

Response.Write(pStart.StandardError.ReadToEnd())

And nothing writes to screen. Is that what you were asking?

+1  A: 

You might be able to do this more effectively by using a .net SVN wrapper or library like this one. I'm sure there are others out there that would support the limitations of beanstalk as well.

JTew
A: 

Using SharpSvn:

using(SvnClient client = new SvnClient())
{
   client.Update(Request["path"]);
}

But I would recommend not to use a user passed variable directly for security reasons.

Bert Huijben
+1  A: 

You can also use the Subversion library that comes with Ankh SVN. I used it in a project to manage files in a Subversion repository and it worked well.

If you insist on using the command line client make sure you check the StandardError output for any error messages. Also make sure the user you run the process as has the appropriate rights.

Rune Grimstad