1

Below is some code to exclude a folder from a working copy (an ancestor folder). "r" is showing an System.InvalidOperationException when I break on that line. Does Exclude work? What is my alternative to this option when using the SharpSVN .NET library. I haven't had any issues with Exclude for any of the other Depth types.

            SvnUpdateArgs updateArgs2 = new SvnUpdateArgs();
            updateArgs2.Depth = SvnDepth.Exclude;
            SvnUpdateResult r = null;
            client.Update(path, updateArgs2, out r);
            string x = r.ToString();

r.GetType().GenericParemeterAttributes = " 'r.GetType().GenericParameterAttributes' threw an exception of type 'System.InvalidOperationException' "

r.GetType().GenericParemeterAttributes.base = "Method may only be called on a Type for which Type.IsGenericParameter is true".

I'm not sure which Type it's referring to.

===========

Edit:

This worked!

SvnUpdateArgs updateArgs2 = new SvnUpdateArgs();
                updateArgs2.Depth = SvnDepth.Exclude;
                updateArgs2.KeepDepth = true;
                SvnUpdateResult r = null;
                client.Update(path, updateArgs2, out r);
Tunaki
  • 132,869
  • 46
  • 340
  • 423
JustBeingHelpful
  • 18,332
  • 38
  • 160
  • 245

1 Answers1

1

To look at your specific exception I would really need a stack trace, not just some out of context error.

To exclude a path, you should set .KeepDepth on the SvnUpdateArgs to true.

Without .KeepDepth your code is equivalent to

$ svn up --depth exclude PATH

which would yield an error.

With with .KeepDepth it would be the

$ svn up --set-depth exclude PATH

that you try to apply.

In SharpSvn it is easier to use the slightly more low level

SvnClient.CropWorkingCopy(PATH, SvnDepth.Excluded)

as that makes it clearer what you try to do.

Bert Huijben
  • 19,525
  • 4
  • 57
  • 73
  • when I use this code, I get this error: "You can only crop a node to a depth between empty and files. Parameter name: toDepth ... Actual value was Exclude." – JustBeingHelpful May 07 '14 at 04:23
  • adding "KeepDepth = true" worked for the original code! Thank you very much!! – JustBeingHelpful May 07 '14 at 04:30
  • do you know where I can download the actual source code for SharpSVN? What site is the source of that library? – JustBeingHelpful May 07 '14 at 04:48
  • 1
    You can checkout the source from svn at https://ctf.open.collab.net/svn/repos/sharpsvn. Or you can use the PDB file to just step through the compiled source if you enable sourceserver support in your Visual Studio. – Bert Huijben May 07 '14 at 09:23