2011-01-07 65 views
1

我有这样的代码,获取一个URI的内容为MemorySream:SharpSvn - 如何保存从MemoryStream的更改,但不工作副本

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); 

这工作。

问题:我现在如何保存我所做的更改(在webConfigText中)?

谢谢,我正在撕掉我的头发。 D

+0

保存到磁盘?还是承诺SVN? – 2011-01-07 22:01:29

回答

1

重新阅读这个问题,好像你想要将更改提交回存储库。没有工作副本就无法做到这一点。如果您真的只想这样做,请在临时目录中创建一个工作副本,然后将其删除。

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" }); 
相关问题