Pergunta

I tried the below code to set a custom property called "myprop" to a revision during commit:

using (SvnClient client = new SvnClient())
{
    SvnCommitArgs ca = new SvnCommitArgs();
    ca.LogProperties.Add("myprop", "myval");
    client.Commit(workingdirectorypath, ca);
}

And I tried the below code to get the custom property value after commit:

using (SharpSvn.SvnClient svnclient = new SharpSvn.SvnClient())
{
    System.Collections.ObjectModel.Collection<SharpSvn.SvnLogEventArgs> logitems;
    SharpSvn.SvnLogArgs logargs = new SharpSvn.SvnLogArgs();
    svnclient.GetLog(svnclient.GetRepositoryRoot(localworkingcopypath), logargs, out logitems);
    foreach (SharpSvn.SvnPropertyValue prop in logitems[0].RevisionProperties)
    {
        if (prop.Key == "myprop")
            string propvalue = prop.StringValue;
    }
}

But my custom property doesn't exist in the RevisionProperties collection.

Do I have to explicitly create the property somewhere before setting it during commit?

Thanks in advance!

Foi útil?

Solução

May be:

logargs.RetrieveAllProperties = true;

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