Changeset 40

Show
Ignore:
Timestamp:
06/30/04 21:40:26
Author:
DenisG
Message:

[SubversionSharp] Add all remainings SvnClient? functions and their

related types

- Add SvnString? and SvnStringBuf? with minimal support
- Add SvnStream? with minimal and custom support
- Add SvnDirEnt?, SvnClientPropListItem? that were "hidden" behind AprHash?.
- Add all remaining function from svn_client.h

Files:

Legend:

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

    r33 r40  
    2020    <File name="./SvnWcStatus.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 
    2121    <File name="./SvnWcEntry.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 
     22    <File name="./SvnString.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 
     23    <File name="./SvnStream.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 
     24    <File name="./SvnDirEnt.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 
     25    <File name="./SvnStringBuf.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 
     26    <File name="./SvnClientPropListItem.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> 
    2227  </Contents> 
    2328  <References> 
  • trunk/SubversionSharp/dev/src/Svn.cs

    r38 r40  
    7979        internal void svn_error_clear(IntPtr error);    
    8080        #endregion 
     81         
     82        #region SvnString 
     83        [DllImport("svn_client-1")] static extern 
     84        internal IntPtr svn_string_create(IntPtr cstring, IntPtr pool); 
     85        [DllImport("svn_client-1", CharSet=CharSet.Ansi)] static extern 
     86        internal IntPtr svn_string_create(string cstring, IntPtr pool); 
     87 
     88        [DllImport("svn_client-1")] static extern 
     89        internal IntPtr svn_string_ncreate(IntPtr cstring, uint size, IntPtr pool); 
     90        [DllImport("svn_client-1", CharSet=CharSet.Ansi)] static extern 
     91        internal IntPtr svn_string_ncreate(string cstring, uint size, IntPtr pool); 
     92 
     93        [DllImport("svn_client-1")] static extern 
     94        internal IntPtr svn_string_create_from_buf(IntPtr strbuf, IntPtr pool); 
     95         
     96        [DllImport("svn_client-1")] static extern 
     97        internal IntPtr svn_string_dup(IntPtr original_string, IntPtr pool); 
     98        #endregion 
     99         
     100        #region SvnStringBuf 
     101        [DllImport("svn_client-1")] static extern 
     102        internal IntPtr svn_stringbuf_create(IntPtr cstring, IntPtr pool); 
     103        [DllImport("svn_client-1", CharSet=CharSet.Ansi)] static extern 
     104        internal IntPtr svn_stringbuf_create(string cstring, IntPtr pool); 
     105 
     106        [DllImport("svn_client-1")] static extern 
     107        internal IntPtr svn_stringbuf_ncreate(IntPtr cstring, uint size, IntPtr pool); 
     108        [DllImport("svn_client-1", CharSet=CharSet.Ansi)] static extern 
     109        internal IntPtr svn_stringbuf_ncreate(string cstring, uint size, IntPtr pool); 
     110         
     111        [DllImport("svn_client-1", CharSet=CharSet.Ansi)] static extern 
     112        internal IntPtr svn_stringbuf_create_from_string(IntPtr str, IntPtr pool); 
     113         
     114        [DllImport("svn_client-1")] static extern 
     115        internal IntPtr svn_stringbuf_dup(IntPtr original_string, IntPtr pool); 
     116        #endregion 
     117 
     118        #region SvnStream 
     119        internal delegate IntPtr svn_read_fn_t(IntPtr baton, IntPtr buffer, ref uint len); 
     120        internal delegate IntPtr svn_write_fn_t(IntPtr baton, IntPtr data, ref uint len); 
     121        internal delegate IntPtr svn_close_fn_t(IntPtr baton); 
     122         
     123        [DllImport("svn_client-1")] static extern 
     124        internal IntPtr svn_stream_create(IntPtr baton, IntPtr pool); 
     125 
     126        [DllImport("svn_client-1")] static extern 
     127        internal void   svn_stream_set_baton(IntPtr stream, IntPtr baton); 
     128 
     129        [DllImport("svn_client-1")] static extern 
     130        internal void   svn_stream_set_read(IntPtr stream, svn_read_fn_t read_fn); 
     131 
     132        [DllImport("svn_client-1")] static extern 
     133        internal void   svn_stream_set_write(IntPtr stream, svn_write_fn_t write_fn); 
     134 
     135        [DllImport("svn_client-1")] static extern 
     136        internal void   svn_stream_set_close(IntPtr stream, svn_close_fn_t close_fn); 
     137 
     138        [DllImport("svn_client-1")] static extern 
     139        internal IntPtr svn_stream_empty (IntPtr pool); 
     140 
     141        [DllImport("svn_client-1")] static extern 
     142        internal IntPtr svn_stream_from_aprfile(IntPtr file, IntPtr pool); 
     143 
     144        [DllImport("svn_client-1")] static extern 
     145        internal IntPtr svn_stream_for_stdout(out IntPtr stream, IntPtr pool); 
     146 
     147        [DllImport("svn_client-1")] static extern 
     148        internal IntPtr svn_stream_compressed (IntPtr stream, IntPtr pool); 
     149        #endregion 
    81150 
    82151        #region SvnClientContext 
     
    335404 
    336405        [DllImport("svn_client-1", CharSet=CharSet.Ansi)] static extern 
    337         internal IntPtr svn_client_url_from_path(string url, string path_or_url, IntPtr pool); 
    338  
    339         [DllImport("svn_client-1", CharSet=CharSet.Ansi)] static extern 
    340         internal IntPtr svn_client_uuid_from_url(string uuid, string url, IntPtr ctx, IntPtr pool); 
    341  
    342         [DllImport("svn_client-1", CharSet=CharSet.Ansi)] static extern 
    343         internal IntPtr svn_client_uuid_from_path (string uuid, string path,  
    344                                                    IntPtr adm_access, 
    345                                                    IntPtr ctx, IntPtr pool); 
     406        internal IntPtr svn_client_url_from_path(out IntPtr url, string path_or_url, IntPtr pool); 
     407 
     408        [DllImport("svn_client-1", CharSet=CharSet.Ansi)] static extern 
     409        internal IntPtr svn_client_uuid_from_url(out IntPtr uuid, string url, IntPtr ctx, IntPtr pool); 
    346410        #endregion                 
    347411    } 
  • trunk/SubversionSharp/dev/src/SvnAuthBaton.cs

    r31 r40  
    136136             
    137137            if( mParamName[(int)param] == IntPtr.Zero ) 
    138                 mParamName[(int)param] = new AprString(mPool, ParamName[(int)param]); 
     138                mParamName[(int)param] = new AprString(ParamName[(int)param],mPool); 
    139139                     
    140140            Debug.WriteLine(String.Format("svn_auth_set_parameter({0},{1:X},{2:X})",this,mParamName[(int)param].ToInt32(),value.ToInt32())); 
     
    153153             
    154154            if( mParamName[(int)param] == IntPtr.Zero ) 
    155                 mParamName[(int)param] = new AprString(mPool, ParamName[(int)param]); 
     155                mParamName[(int)param] = new AprString(ParamName[(int)param],mPool); 
    156156 
    157157            IntPtr ptr;                  
  • trunk/SubversionSharp/dev/src/SvnClient.cs

    r38 r40  
    104104            IntPtr commitInfo; 
    105105            Debug.Write(String.Format("svn_client_delete({0},{1},{2},{3})...",paths,force,ctx,pool)); 
    106             SvnError err = Svn.svn_client_delete(out commitInfo, paths, (force) ? 1 : 0, ctx, pool); 
     106            SvnError err = Svn.svn_client_delete(out commitInfo, paths, (force ? 1 : 0), ctx, pool); 
    107107            if( !err.IsNoError ) 
    108108                throw new SvnException(err); 
     
    116116            IntPtr commitInfo; 
    117117            Debug.Write(String.Format("svn_client_import({0},{1},{2},{3},{4})...",path,url,nonrecursive,ctx,pool)); 
    118             SvnError err = Svn.svn_client_import(out commitInfo, path, url, (nonrecursive) ? 1 : 0,  
     118            SvnError err = Svn.svn_client_import(out commitInfo, path, url, (nonrecursive ? 1 : 0),  
    119119                                                 ctx, pool); 
    120120            if( !err.IsNoError ) 
     
    129129            IntPtr commitInfo; 
    130130            Debug.Write(String.Format("svn_client_commit({0},{1},{2},{3})...",targets,nonrecursive,ctx,pool)); 
    131             SvnError err = Svn.svn_client_commit(out commitInfo, targets, (nonrecursive) ? 1 : 0
     131            SvnError err = Svn.svn_client_commit(out commitInfo, targets, (nonrecursive ? 1 : 0)
    132132                                                 ctx, pool); 
    133133            if( !err.IsNoError ) 
     
    145145            int rev; 
    146146            SvnDelegate statusDelegate = new SvnDelegate(statusFunc); 
    147             Debug.Write(String.Format("svn_client_status({0},{1},{2},{3},{4:X},{5},{6},{7},{8},{9})...",path,revision,statusFunc.Method.Name,statusBaton.ToInt32(),(descend) ? 1 : 0,(getAll) ? 1 : 0,(update) ? 1 : 0,(noIgnore) ? 1 : 0,ctx,pool)); 
     147            Debug.Write(String.Format("svn_client_status({0},{1},{2},{3},{4:X},{5},{6},{7},{8},{9})...",path,revision,statusFunc.Method.Name,statusBaton.ToInt32(),descend,getAll,update,noIgnore,ctx,pool)); 
    148148            SvnError err = Svn.svn_client_status(out rev, path, revision, 
    149149                                                 (Svn.svn_wc_status_func_t) statusDelegate.Wrapper, 
    150150                                                 statusBaton, 
    151                                                  (descend) ? 1 : 0, (getAll) ? 1 : 0
    152                                                  (update) ? 1 : 0, (noIgnore) ? 1 : 0
     151                                                 (descend ? 1 : 0), (getAll ? 1 : 0)
     152                                                 (update ? 1 : 0), (noIgnore ? 1 : 0)
    153153                                                 ctx, pool); 
    154154            if( !err.IsNoError ) 
     
    168168        { 
    169169            SvnDelegate receiverDelegate = new SvnDelegate(receiver); 
    170             Debug.WriteLine(String.Format("svn_client_log({0},{1},{2},{3},{4},{5},{6},{7},{8})",targets,start,end,(discoverChangedPaths ? 1 :0),(strictNodeHistory ? 1 :0),receiver.Method.Name,baton,ctx,pool)); 
     170            Debug.WriteLine(String.Format("svn_client_log({0},{1},{2},{3},{4},{5},{6:X},{7},{8})",targets,start,end,discoverChangedPaths,strictNodeHistory,receiver.Method.Name,baton.ToInt32(),ctx,pool)); 
    171171            SvnError err = Svn.svn_client_log(targets, start, end, 
    172172                                              (discoverChangedPaths ? 1 :0), 
     
    185185        { 
    186186            SvnDelegate receiverDelegate = new SvnDelegate(receiver); 
    187             Debug.WriteLine(String.Format("svn_client_blame({0},{1},{2},{3},{4},{5},{6})",path_or_url,start,end,receiver.Method.Name,baton,ctx,pool)); 
     187            Debug.WriteLine(String.Format("svn_client_blame({0},{1},{2},{3},{4:X},{5},{6})",path_or_url,start,end,receiver.Method.Name,baton.ToInt32(),ctx,pool)); 
    188188            SvnError err = Svn.svn_client_blame(path_or_url, start, end, 
    189189                                                (Svn.svn_client_blame_receiver_t)receiverDelegate.Wrapper, 
     
    193193                throw new SvnException(err); 
    194194        } 
     195         
     196        public static void Diff(AprArray diffOptions, 
     197                                string path1, SvnOptRevision revision1, 
     198                                string path2, SvnOptRevision revision2, 
     199                                bool recurse, bool ignoreAncestry, bool noDiffDeleted, 
     200                                AprFile outFile, AprFile errFile,   
     201                                SvnClientContext ctx, AprPool pool) 
     202        { 
     203            Debug.WriteLine(String.Format("svn_client_diff({0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11})",diffOptions,path1,revision1,path2,revision2,recurse,ignoreAncestry,noDiffDeleted,outFile,errFile,ctx,pool)); 
     204            SvnError err = Svn.svn_client_diff(diffOptions, path1, revision1, path2, revision2, 
     205                                               (recurse ? 1 : 0), (ignoreAncestry ? 1 : 0), 
     206                                               (noDiffDeleted ? 1 : 0), outFile, errFile, 
     207                                               ctx, pool); 
     208            if( !err.IsNoError ) 
     209                throw new SvnException(err); 
     210        } 
     211         
     212        public static void Merge(string source1, SvnOptRevision revision1, 
     213                                 string source2, SvnOptRevision revision2, 
     214                                 string targetWCPath, bool recurse, 
     215                                 bool ignoreAncestry, bool force, bool dryRun, 
     216                                 SvnClientContext ctx, AprPool pool) 
     217        { 
     218            Debug.WriteLine(String.Format("svn_client_merge({0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10})",source1,revision1,source2,revision2,targetWCPath,recurse,ignoreAncestry,force,dryRun,ctx,pool)); 
     219            SvnError err = Svn.svn_client_merge(source1, revision1, source2, revision2, 
     220                                                targetWCPath, (recurse ? 1 : 0), 
     221                                                (ignoreAncestry ? 1 : 0), (force ? 1 : 0), 
     222                                                (dryRun ? 1 : 0), 
     223                                                ctx, pool); 
     224            if( !err.IsNoError ) 
     225                throw new SvnException(err); 
     226        } 
     227         
     228        public static void CleanUp(string dir, 
     229                                   SvnClientContext ctx, AprPool pool) 
     230        { 
     231            Debug.WriteLine(String.Format("svn_client_cleanup({0},{1},{2})",dir,ctx,pool)); 
     232            SvnError err = Svn.svn_client_cleanup(dir, ctx, pool); 
     233            if( !err.IsNoError ) 
     234                throw new SvnException(err); 
     235        } 
     236         
     237        public static void Relocate(string dir, string from, string to, 
     238                                    bool recurse, 
     239                                    SvnClientContext ctx, AprPool pool) 
     240        { 
     241            Debug.WriteLine(String.Format("svn_client_relocate({0},{1},{2},{3},{4},{5})",dir,from,to,recurse,ctx,pool)); 
     242            SvnError err = Svn.svn_client_relocate(dir, from, to, (recurse ? 1 : 0), ctx, pool); 
     243            if( !err.IsNoError ) 
     244                throw new SvnException(err); 
     245        } 
     246         
     247        public static void Revert(AprArray paths, bool recurse,                                    
     248                                  SvnClientContext ctx, AprPool pool) 
     249        { 
     250            Debug.WriteLine(String.Format("svn_client_revert({0},{1},{2},{3})",paths,recurse,ctx,pool)); 
     251            SvnError err = Svn.svn_client_revert(paths, (recurse ? 1 : 0), ctx, pool); 
     252            if( !err.IsNoError ) 
     253                throw new SvnException(err); 
     254        } 
     255         
     256        public static void Resolved(string path, bool recurse,                                 
     257                                    SvnClientContext ctx, AprPool pool) 
     258        { 
     259            Debug.WriteLine(String.Format("svn_client_resolved({0},{1},{2},{3})",path,recurse,ctx,pool)); 
     260            SvnError err = Svn.svn_client_resolved(path, (recurse ? 1 : 0), ctx, pool); 
     261            if( !err.IsNoError ) 
     262                throw new SvnException(err); 
     263        } 
     264         
     265        public static SvnClientCommitInfo Copy(string srcPath, SvnOptRevision srcRevision, 
     266                                               string dstPath, 
     267                                               SvnClientContext ctx, AprPool pool) 
     268        { 
     269            IntPtr commitInfo; 
     270            Debug.Write(String.Format("svn_client_copy({0},{1},{2},{3},{4})...",srcPath,srcRevision,dstPath,ctx,pool)); 
     271            SvnError err = Svn.svn_client_copy(out commitInfo, srcPath, srcRevision, 
     272                                               dstPath, 
     273                                               ctx, pool); 
     274            if( !err.IsNoError ) 
     275                throw new SvnException(err); 
     276            Debug.WriteLine(String.Format("Done({0})",commitInfo)); 
     277            return(commitInfo); 
     278        } 
     279                                     
     280        public static SvnClientCommitInfo Move(string srcPath, SvnOptRevision srcRevision, 
     281                                               string dstPath, bool force, 
     282                                               SvnClientContext ctx, AprPool pool) 
     283        { 
     284            IntPtr commitInfo; 
     285            Debug.Write(String.Format("svn_client_move({0},{1},{2},{3},{4},{5})...",srcPath,srcRevision,dstPath,force,ctx,pool)); 
     286            SvnError err = Svn.svn_client_move(out commitInfo, srcPath, srcRevision, 
     287                                               dstPath, (force ? 1 : 0), 
     288                                               ctx, pool); 
     289            if( !err.IsNoError ) 
     290                throw new SvnException(err); 
     291            Debug.WriteLine(String.Format("Done({0})",commitInfo)); 
     292            return(commitInfo); 
     293        } 
     294         
     295        public static void PropSet(string propName, SvnString propVal, string target,  
     296                                   bool recurse, AprPool pool)       
     297        { 
     298            Debug.WriteLine(String.Format("svn_client_propset({0},{1},{2},{3},{4})",propName,propVal,target,recurse,pool)); 
     299            SvnError err = Svn.svn_client_propset(propName, propVal, target, 
     300                                                  (recurse ? 1 : 0), pool); 
     301            if( !err.IsNoError ) 
     302                throw new SvnException(err); 
     303        } 
     304         
     305        public static int RevPropSet(string propName, SvnString propVal, 
     306                                     string url, SvnOptRevision revision, bool force, 
     307                                     SvnClientContext ctx, AprPool pool)         
     308        { 
     309            int rev; 
     310            Debug.Write(String.Format("svn_client_revprop_set({0},{1},{2},{3},{4},{5},{6})...",propName,propVal,url,revision,force,ctx,pool)); 
     311            SvnError err = Svn.svn_client_revprop_set(propName, propVal, url, revision, 
     312                                                      out rev, (force ? 1 : 0), 
     313                                                      ctx, pool); 
     314            if( !err.IsNoError ) 
     315                throw new SvnException(err); 
     316            Debug.WriteLine(String.Format("Done({0})",rev)); 
     317            return(rev); 
     318        } 
     319         
     320        public static AprHash PropGet(string propName, string target, 
     321                                      SvnOptRevision revision, bool recurse,  
     322                                      SvnClientContext ctx, AprPool pool)        
     323        { 
     324            IntPtr h; 
     325            Debug.Write(String.Format("svn_client_propget({0},{1},{2},{3},{4},{5})...",propName,target,revision,recurse,ctx,pool)); 
     326            SvnError err = Svn.svn_client_propget(out h, propName, target, revision, 
     327                                                  (recurse ? 1 : 0), 
     328                                                  ctx, pool); 
     329            if( !err.IsNoError ) 
     330                throw new SvnException(err); 
     331            Debug.WriteLine(String.Format("Done({0})",h)); 
     332            return(h); 
     333        } 
     334         
     335        public static SvnString RevPropGet(string propName, string url, 
     336                                           SvnOptRevision revision, out int setRev,  
     337                                           SvnClientContext ctx, AprPool pool)       
     338        { 
     339            IntPtr s; 
     340            Debug.Write(String.Format("svn_client_revprop_get({0},{1},{2},{3},{4})...",propName,url,revision,ctx,pool)); 
     341            SvnError err = Svn.svn_client_revprop_get(propName, out s, url, revision, out setRev, 
     342                                                      ctx, pool); 
     343            if( !err.IsNoError ) 
     344                throw new SvnException(err); 
     345            Debug.WriteLine(String.Format("Done({0},{1})",s,setRev)); 
     346            return(s); 
     347        } 
     348         
     349        public static AprHash PropList(string target, 
     350                                       SvnOptRevision revision, bool recurse,  
     351                                       SvnClientContext ctx, AprPool pool)       
     352        { 
     353            IntPtr h; 
     354            Debug.Write(String.Format("svn_client_proplist({0},{1},{2},{3},{4})...",target,revision,recurse,ctx,pool)); 
     355            SvnError err = Svn.svn_client_proplist(out h, target, revision, 
     356                                                   (recurse ? 1 : 0), 
     357                                                   ctx, pool); 
     358            if( !err.IsNoError ) 
     359                throw new SvnException(err); 
     360            Debug.WriteLine(String.Format("Done({0})",h)); 
     361            return(h); 
     362        } 
     363         
     364        public static AprHash RevPropList(string url, 
     365                                          SvnOptRevision revision, out int setRev,  
     366                                          SvnClientContext ctx, AprPool pool)        
     367        { 
     368            IntPtr h; 
     369            Debug.Write(String.Format("svn_client_revprop_list({0},{1},{2},{3})...",url,revision,ctx,pool)); 
     370            SvnError err = Svn.svn_client_revprop_list(out h, url, revision, out setRev, 
     371                                                       ctx, pool); 
     372            if( !err.IsNoError ) 
     373                throw new SvnException(err); 
     374            Debug.WriteLine(String.Format("Done({0},{1})",h,setRev)); 
     375            return(h); 
     376        } 
     377 
     378        public static int Export(string from, string to,  
     379                                   SvnOptRevision revision,  
     380                                   bool force, SvnClientContext ctx, AprPool pool) 
     381        { 
     382            int rev; 
     383            Debug.Write(String.Format("svn_client_export({0},{1},{2},{3},{4},{5})...",from,to,revision,force,ctx,pool)); 
     384            SvnError err = Svn.svn_client_export(out rev, from, to,  
     385                                                 revision,  
     386                                                 (force ? 1 :0), ctx, pool); 
     387            if( !err.IsNoError ) 
     388                throw new SvnException(err); 
     389            Debug.WriteLine(String.Format("Done({0})",rev)); 
     390            return(rev); 
     391        } 
     392         
     393        public static AprHash List(string pathOrUrl, 
     394                                   SvnOptRevision revision, bool recurse,  
     395                                   SvnClientContext ctx, AprPool pool)       
     396        { 
     397            IntPtr h; 
     398            Debug.Write(String.Format("svn_client_list({0},{1},{2},{3},{4})...",pathOrUrl,revision,recurse,ctx,pool)); 
     399            SvnError err = Svn.svn_client_ls(out h, pathOrUrl, revision, (recurse ? 1 : 0), 
     400                                             ctx, pool); 
     401            if( !err.IsNoError ) 
     402                throw new SvnException(err); 
     403            Debug.WriteLine(String.Format("Done({0})",h)); 
     404            return(h); 
     405        } 
     406         
     407        public static void Cat(SvnStream stream, string pathOrUrl, 
     408                               SvnOptRevision revision,  
     409                               SvnClientContext ctx, AprPool pool)       
     410        {        
     411            Debug.WriteLine(String.Format("svn_client_cat({0},{1},{2},{3},{4})",stream,pathOrUrl,revision,ctx,pool)); 
     412            SvnError err = Svn.svn_client_cat(stream, pathOrUrl, revision, ctx, pool); 
     413            if( !err.IsNoError ) 
     414                throw new SvnException(err); 
     415        } 
     416         
     417        public static AprString UrlFromPath(string pathOrUrl, AprPool pool) 
     418        { 
     419            IntPtr s; 
     420            Debug.Write(String.Format("svn_client_url_from_path({0},{1})...",pathOrUrl,pool)); 
     421            SvnError err = Svn.svn_client_url_from_path(out s, pathOrUrl, pool); 
     422            if( !err.IsNoError ) 
     423                throw new SvnException(err); 
     424            Debug.WriteLine(String.Format("Done({0})",s)); 
     425            return(s); 
     426        } 
     427         
     428        public static AprString UuidFromUrl(string url, SvnClientContext ctx, AprPool pool) 
     429        { 
     430            IntPtr s; 
     431            Debug.Write(String.Format("svn_client_uuid_from_url({0},{1})...",url,ctx,pool)); 
     432            SvnError err = Svn.svn_client_uuid_from_url(out s, url, ctx, pool); 
     433            if( !err.IsNoError ) 
     434                throw new SvnException(err); 
     435            Debug.WriteLine(String.Format("Done({0})",s)); 
     436            return(s); 
     437        } 
    195438    } 
    196439} 
  • trunk/SubversionSharp/dev/src/SvnDelegate.cs

    r38 r40  
    7575            SvnWcNotify.Func func = mFunc as SvnWcNotify.Func; 
    7676            try { 
    77                 Debug.WriteLine(String.Format("[Callback:{0}]SvnWcNotifyFunc({1:X},{2},{3},{4},{5},{6},{7},{8})",func.Method.Name,baton,new AprString(path),(SvnWcNotify.Action) action,(Svn.NodeKind) kind,new AprString(mime_type),(SvnWcNotify.State) content_state,(SvnWcNotify.State) prop_state,revision)); 
     77                Debug.WriteLine(String.Format("[Callback:{0}]SvnWcNotifyFunc({1:X},{2},{3},{4},{5},{6},{7},{8})",func.Method.Name,baton.ToInt32(),new AprString(path),(SvnWcNotify.Action) action,(Svn.NodeKind) kind,new AprString(mime_type),(SvnWcNotify.State) content_state,(SvnWcNotify.State) prop_state,revision)); 
    7878                func(baton, new AprString(path), 
    7979                     (SvnWcNotify.Action) action, (Svn.NodeKind) kind,  
     
    105105                AprString logMessage; 
    106106                AprString tmpFile; 
    107                 Debug.Write(String.Format("[Callback:{0}]SvnClientGetCommitLog({1},{2:X},{3})...",func.Method.Name,new AprArray(commit_items),baton,new AprPool(pool))); 
     107                Debug.Write(String.Format("[Callback:{0}]SvnClientGetCommitLog({1},{2:X},{3})...",func.Method.Name,new AprArray(commit_items),baton.ToInt32(),new AprPool(pool))); 
    108108                err = func(out logMessage, out tmpFile, 
    109109                           new AprArray(commit_items,typeof(SvnClientCommitItem)), baton, 
     
    135135            Svn.CancelFunc func = mFunc as Svn.CancelFunc; 
    136136            try { 
    137                 Debug.Write(String.Format("[Callback:{0}]SvnCancelFunc({1:X})...",func.Method.Name,baton)); 
     137                Debug.Write(String.Format("[Callback:{0}]SvnCancelFunc({1:X})...",func.Method.Name,baton.ToInt32())); 
    138138                err = func(baton); 
    139139                Debug.WriteLine((err.IsNoError) ? "Return(NoError)" : String.Format("Return({0})",err.Message)); 
     
    160160            SvnWcStatus.Func func = mFunc as SvnWcStatus.Func; 
    161161            try { 
    162                 Debug.WriteLine(String.Format("[Callback:{0}]SvnWcStatusFunc({1:X},{2},{3})",func.Method.Name,baton,new AprString(path),new SvnWcStatus(status))); 
     162                Debug.WriteLine(String.Format("[Callback:{0}]SvnWcStatusFunc({1:X},{2},{3})",func.Method.Name,baton.ToInt32(),new AprString(path),new SvnWcStatus(status))); 
    163163                func(baton, new AprString(path), (SvnWcStatus) status); 
    164164            } 
     
    185185            SvnClient.LogMessageReceiver func = mFunc as SvnClient.LogMessageReceiver; 
    186186            try { 
    187                 Debug.Write(String.Format("[Callback:{0}]SvnLogMessageReceiver({1:X},{2},{3},{4},{5},{6},{7})...",func.Method.Name,baton,new AprHash(changed_paths),revision,new AprString(author),new AprString(date),new AprString(message),new AprPool(pool))); 
     187                Debug.Write(String.Format("[Callback:{0}]SvnLogMessageReceiver({1:X},{2},{3},{4},{5},{6},{7})...",func.Method.Name,baton.ToInt32(),new AprHash(changed_paths),revision,new AprString(author),new AprString(date),new AprString(message),new AprPool(pool))); 
    188188                err = func(baton, new AprHash(changed_paths), 
    189189                           revision, new AprString(author), 
     
    216216            SvnClient.BlameReceiver func = mFunc as SvnClient.BlameReceiver; 
    217217            try { 
    218                 Debug.Write(String.Format("[Callback:{0}]SvnClientBlameReceiver({1:X},{2},{3},{4},{5},{6},{7})...",func.Method.Name,baton,lineNo,revision,new AprString(author),new AprString(date),new AprString(line),new AprPool(pool))); 
     218                Debug.Write(String.Format("[Callback:{0}]SvnClientBlameReceiver({1:X},{2},{3},{4},{5},{6},{7})...",func.Method.Name,baton.ToInt32(),lineNo,revision,new AprString(author),new AprString(date),new AprString(line),new AprPool(pool))); 
    219219                err = func(baton, lineNo, revision, 
    220220                           new AprString(author), new AprString(date), new AprString(line), 
     
    230230            return(err);         
    231231        }                                               
     232  
    232233                                                 
     234        // svn_read_fn_t Wrapper     
     235        public SvnDelegate(SvnStream.ReadFunc func) 
     236        { 
     237            mFunc = func; 
     238            mWrapperFunc = new Svn.svn_read_fn_t(SvnStreamReadWrapper); 
     239        } 
     240         
     241        private IntPtr SvnStreamReadWrapper(IntPtr baton, IntPtr buffer, ref uint len) 
     242        { 
     243            SvnError err = SvnError.NoError; 
     244            SvnStream.ReadFunc func = mFunc as SvnStream.ReadFunc; 
     245            try { 
     246                Debug.Write(String.Format("[Callback:{0}]SvnStreamReadFunc({1:X},{2:X},{3})...",func.Method.Name,baton.ToInt32(),buffer.ToInt32(),len)); 
     247                int slen = unchecked((int)len); 
     248                err = func(baton, buffer, ref slen); 
     249                len = unchecked((uint)slen); 
     250                Debug.WriteLine(String.Format("Done({0})",len)); 
     251            } 
     252            catch( SvnException e ) { 
     253                err = SvnError.Create(e.AprErr, SvnError.NoError, e.Message); 
     254            } 
     255            catch( Exception e ) { 
     256                err = SvnError.Create(215000, SvnError.NoError, e.Message); 
     257            } 
     258            return(err); 
     259        }                                               
     260         
     261 
     262        // svn_write_fn_t Wrapper        
     263        public SvnDelegate(SvnStream.WriteFunc func) 
     264        { 
     265            mFunc = func; 
     266            mWrapperFunc = new Svn.svn_write_fn_t(SvnStreamWriteWrapper); 
     267        } 
     268         
     269        private IntPtr SvnStreamWriteWrapper(IntPtr baton, IntPtr data, ref uint len) 
     270        { 
     271            SvnError err = SvnError.NoError; 
     272            SvnStream.WriteFunc func = mFunc as SvnStream.WriteFunc; 
     273            try { 
     274                Debug.Write(String.Format("[Callback:{0}]SvnStreamWriteFunc({1:X},{2:X},{3})...",func.Method.Name,baton.ToInt32(),data.ToInt32(),len)); 
     275                int slen = unchecked((int)len); 
     276                err = func(baton, data, ref slen); 
     277                len = unchecked((uint)slen); 
     278                Debug.WriteLine(String.Format("Done({0})",len)); 
     279            } 
     280            catch( SvnException e ) { 
     281                err = SvnError.Create(e.AprErr, SvnError.NoError, e.Message); 
     282            } 
     283            catch( Exception e ) { 
     284                err = SvnError.Create(215000, SvnError.NoError, e.Message); 
     285            } 
     286            return(err); 
     287        }                                               
    233288                                 
     289                                                                                                 
     290        // svn_close_fn_t Wrapper        
     291        public SvnDelegate(SvnStream.CloseFunc func) 
     292        { 
     293            mFunc = func; 
     294            mWrapperFunc = new Svn.svn_close_fn_t(SvnStreamCloseWrapper); 
     295        } 
     296         
     297        private IntPtr SvnStreamCloseWrapper(IntPtr baton) 
     298        { 
     299            SvnError err = SvnError.NoError; 
     300            SvnStream.CloseFunc func = mFunc as SvnStream.CloseFunc; 
     301            try { 
     302                Debug.Write(String.Format("[Callback:{0}]SvnStreamCloseFunc({1:X})...",func.Method.Name,baton.ToInt32())); 
     303                err = func(baton); 
     304                Debug.WriteLine((err.IsNoError) ? "Return(NoError)" : String.Format("Return({0})",err.Message)); 
     305            } 
     306            catch( SvnException e ) { 
     307                err = SvnError.Create(e.AprErr, SvnError.NoError, e.Message); 
     308            } 
     309            catch( Exception e ) { 
     310                err = SvnError.Create(215000, SvnError.NoError, e.Message); 
     311            } 
     312            return(err); 
     313        }                                               
     314                                 
     315                                                                                                 
    234316        // svn_auth_simple_prompt_func_t Wrapper 
    235317        public SvnDelegate(SvnAuthProviderObject.SimplePrompt func)