开发者

SharpSvn - how to save changes from MemoryStream without working copy

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

MemoryStream ms = new MemoryStream();
SvnTarget ta开发者_如何转开发rget = 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


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" });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜