How to get list of uncommitted files from SharpSVN

拟墨画扇 提交于 2020-01-06 04:24:07

问题


Using SharpSvn, how can I get a list of files that need to be committed (the list that you would see if you right click on a folder with tortoisesvn and hit commit)

I tried this:

        SharpSvn.SvnClient client = new SharpSvn.SvnClient();
        Collection<SvnListChangeListEventArgs> list;
        bool result = client.GetChangeList(@"C:\MyProjectPath", out list);

But it seems to be returning a list of every file in the project instead of just the modified ones.


回答1:


The function you're using is for the changelist feature. To see what files are changed use the GetStatus or Status calls. In this case you want to check the LocalContentStatus and LocalPropertyStatus




回答2:


Sander is correct, here is a more complete example of listing modified files:

var statusArgs = new SvnStatusArgs();
statusArgs.Depth = SvnDepth.Infinity;
statusArgs.RetrieveAllEntries = true;
Collection<SvnStatusEventArgs> statuses;
svnClient.GetStatus(@"C:\SVN\stuff\", statusArgs, out statuses);
foreach (SvnStatusEventArgs statusEventArgs in statuses)
{
   if (statusEventArgs.LocalContentStatus == SvnStatus.Modified)
      Console.WriteLine("Modified file: " + statusEventArgs.Path);
}


来源:https://stackoverflow.com/questions/4502211/how-to-get-list-of-uncommitted-files-from-sharpsvn

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!