How to get list of uncommitted files from SharpSVN

2019-08-06 03:02发布

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.

标签: c# sharpsvn
2条回答
兄弟一词,经得起流年.
2楼-- · 2019-08-06 03:34

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

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-08-06 03:46

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);
}
查看更多
登录 后发表回答