0

i intend to use SharpSvn methods such as 'add' and 'lock' for file or folder under SVN repository. if the file is not mapped i receive an error indication - 'the node ... is not found'. prior to SvnClient.Info() or SvnClient.Status(), how can i know the status of the file - is it or is it not added to SVN repository?

shamir chaikin
  • 681
  • 1
  • 6
  • 9

1 Answers1

0

You can use the 'GetStatus' method:

    static bool IsInRepository(string filename)
    {
        bool isVersioned = false;
        using (SvnClient client = new SvnClient())
        {
            SvnStatusArgs sa = new SvnStatusArgs();
            sa.Depth = SvnDepth.Empty;
            sa.RetrieveAllEntries = true;

            Collection<SvnStatusEventArgs> statuses;
            client.GetStatus(filename, sa, out statuses);
            isVersioned = !statuses[0].LocalContentStatus.Equals(SvnStatus.NotVersioned);
        }
        return isVersioned;
    }
sartoris
  • 816
  • 1
  • 7
  • 21