Pergunta

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);
Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top