Pergunta

I have this code which gets a uri's content into a MemorySream:

MemoryStream ms = new MemoryStream();
SvnTarget target = new SvnUriTarget(new Uri(webConfigUri));
client.Write(target, ms);
string webConfigText = Encoding.ASCII.GetString(bms.ToArray());
webConfigText = webConfigText.Replace(oldLine, newLine);

This works.

Question: How do I now save the changes (in webConfigText) I've made?

Thanks, I'm currently tearing my hair out. D

Foi útil?

Solução

Re-reading this question, it seems like you want to commit the changes back to the repository. You can't do this without a working copy. If you really want to only do this, create a working copy in the temp dir, and delete it afterwards.

var client = new SvnClient();   
string workingCopy = Path.Combine(Path.GetTempDir(), "workingcopy";
client.CheckOut(new Uri(reposUri), workingCopy);

// modify the file(s)
client.Commit(workingCopy, new SvnCommitArgs { LogMessage = "Automatic commit" });
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top