Changeset 42

Show
Ignore:
Timestamp:
07/01/04 02:43:45
Author:
DenisG
Message:

[SubversionSharp] Move SvnClient? static methods to SvnClientBase? and

introduce simplified method using an instanciation
of SvnClient? to encapsulate a pool and a context.
Also simplify SvnOptRevision? by providing 3 overloads.
Actually, only Checkout, Update, Switch, Add and MkDir?
are supported, more soon...

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/SubversionSharp/dev/src/SubversionSharp.prjx

    r40 r42  
    1414    <File name="./SvnWcNotify.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 
    1515    <File name="./SvnDelegate.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 
    16     <File name="./SvnClient.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 
    1716    <File name="./SvnOptRevision.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 
    1817    <File name="./SvnClientCommitInfo.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 
     
    2524    <File name="./SvnStringBuf.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 
    2625    <File name="./SvnClientPropListItem.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 
     26    <File name="./SvnClientBase.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 
     27    <File name="./SvnClient.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 
    2728  </Contents> 
    2829  <References> 
  • trunk/SubversionSharp/test/src/Main.cs

    r33 r42  
    1212    { 
    1313        Debug.Listeners.Add(new TextWriterTraceListener(Console.Out)); 
    14         SvnConfig.Ensure(); 
    15          
    16         AprPool pool =  Svn.PoolCreate(); 
    17         SvnClientContext ctx = SvnClientContext.Create(pool); 
    18         ctx.Config = SvnConfig.GetConfig(pool); 
    19          
    20         ArrayList authObjs = new ArrayList(); 
    21         authObjs.Add(SvnAuthProviderObject.GetSimpleProvider(pool)); 
    22         authObjs.Add(SvnAuthProviderObject.GetUsernameProvider(pool)); 
    23         authObjs.Add(SvnAuthProviderObject.GetSslServerTrustFileProvider(pool)); 
    24         authObjs.Add(SvnAuthProviderObject.GetSslClientCertFileProvider(pool)); 
    25         authObjs.Add(SvnAuthProviderObject.GetSslClientCertPwFileProvider(pool)); 
    26         authObjs.Add(SvnAuthProviderObject.GetPromptProvider( 
     14         
     15        SvnClient client = new SvnClient(); 
     16         
     17        client.AddSimpleProvider(); 
     18        client.AddUsernameProvider(); 
     19        client.AddSslServerTrustFileProvider(); 
     20        client.AddSslClientCertFileProvider(); 
     21        client.AddSslClientCertPwFileProvider(); 
     22        client.AddPromptProvider( 
    2723                        new SvnAuthProviderObject.SimplePrompt(SimpleAuth), 
    28                         IntPtr.Zero, 2, pool)); 
    29         authObjs.Add(SvnAuthProviderObject.GetPromptProvider( 
     24                        IntPtr.Zero, 2); 
     25        client.AddPromptProvider( 
    3026                        new SvnAuthProviderObject.UsernamePrompt(UsernameAuth), 
    31                         IntPtr.Zero, 2, pool)); 
    32         authObjs.Add(SvnAuthProviderObject.GetPromptProvider( 
     27                        IntPtr.Zero, 2); 
     28        client.AddPromptProvider( 
    3329                        new SvnAuthProviderObject.SslServerTrustPrompt(SslServerTrustAuth), 
    34                         IntPtr.Zero, pool)); 
    35         ctx.AuthBaton = SvnAuthBaton.Open(authObjs,pool); 
    36         ctx.NotifyFunc = new SvnDelegate(new SvnWcNotify.Func(NotifyCallback)); 
    37         ctx.LogMsgFunc = new SvnDelegate(new SvnClient.GetCommitLog(GetCommitLogCallback)); 
    38         ctx.CancelFunc = new SvnDelegate(new Svn.CancelFunc(CancelCallback)); 
    39          
    40         GCHandle h; 
    41         SvnOptRevision revision = SvnOptRevision.Alloc(out h); 
    42         try 
    43         { 
    44             revision.Number = 100; 
    45             SvnClient.SvnClientCheckout("https://www.softec.st/svn/test",  
    46                                         "/home/denisg/dev/lib/SubversionSharp/test/bin/Debug/test", 
    47                                         revision, true, ctx, pool); 
    48                                          
    49             revision.Kind = SvnOptRevision.RevisionKind.Head; 
    50             SvnClient.SvnClientUpdate("/home/denisg/dev/lib/SubversionSharp/test/bin/Debug/test", 
    51                                       revision, true,   ctx, pool); 
    52         } 
    53         finally 
    54         { 
    55             h.Free(); 
    56         }         
    57         pool.Destroy(); 
     30                        IntPtr.Zero); 
     31        client.OpenAuth(); 
     32         
     33        client.Context.NotifyFunc = new SvnDelegate(new SvnWcNotify.Func(NotifyCallback)); 
     34        client.Context.LogMsgFunc = new SvnDelegate(new SvnClient.GetCommitLog(GetCommitLogCallback)); 
     35        client.Context.CancelFunc = new SvnDelegate(new Svn.CancelFunc(CancelCallback)); 
     36         
     37        client.Checkout("https://www.softec.st/svn/test",  
     38                        "/home/denisg/dev/lib/SubversionSharp/test/bin/Debug/test", 
     39                        100, true); 
     40        client.Update("/home/denisg/dev/lib/SubversionSharp/test/bin/Debug/test", 
     41                      SvnOptRevision.RevisionKind.Head, true); 
     42 
     43        client.Pool.Destroy();         
    5844    } 
    5945     
     
    8369         
    8470        Console.Write("Enter log message: "); 
    85         logMessage = new AprString(pool, Console.ReadLine()); 
     71        logMessage = new AprString(Console.ReadLine(), pool); 
    8672        tmpFile = new AprString(); 
    8773         
     
    128114         
    129115        cred = SvnAuthCredSimple.Alloc(pool); 
    130         cred.Username = new AprString(pool, line); 
     116        cred.Username = new AprString(line, pool); 
    131117        Console.Write("Enter Password: "); 
    132         cred.Password = new AprString(pool, Console.ReadLine()); 
     118        cred.Password = new AprString(Console.ReadLine(), pool); 
    133119        cred.MaySave = maySave; 
    134120        return(SvnError.NoError); 
     
    159145         
    160146        cred = SvnAuthCredUsername.Alloc(pool); 
    161         cred.Username = new AprString(pool, line); 
     147        cred.Username = new AprString(line, pool); 
    162148        cred.MaySave = maySave; 
    163149        return(SvnError.NoError);