public SvnClient(SvnClientContext ctx, AprPool pool) { mGlobalPool = pool; mPool = Svn.PoolCreate(mGlobalPool); mContext = ctx; mAuthObjs = null; }
public AprArray Append(AprPool pool, AprArray array) { IntPtr ptr; Type arrType; CheckPtr(); if (mEltsType != null && array.mEltsType != null && mEltsType != array.mEltsType) { throw new AprInvalidOperationException("Array type mismatch."); } if (mEltsType == null && array.mEltsType != null) { arrType = array.mEltsType; } arrType = mEltsType; Debug.Write(String.Format("apr_array_append({0},{1},{2})...", pool, array, this)); ptr = Apr.apr_array_append(pool, (IntPtr)mArray, array); if (ptr == IntPtr.Zero) { throw new AprException("apr_array_append: Can't append an apr_array_header_t"); } Debug.WriteLine(String.Format("Done({0:X})", ((Int32)ptr))); return(new AprArray(ptr, arrType)); }
public static void Blame(SvnUrl pathOrUrl, SvnOptRevision start, SvnOptRevision end, BlameReceiver receiver, IntPtr baton, SvnClientContext ctx, AprPool pool) { InternalBlame(pathOrUrl, start, end, receiver, baton, ctx, pool); }
public AprHashEntry(AprPool pool) { mPool = pool; mKey = IntPtr.Zero; mKeySize = 0; mValue = IntPtr.Zero; }
public SvnData(string str, AprPool pool) { byte[] utf8str = Encoder.GetBytes(str); mString = pool.Alloc(utf8str.Length+1); Marshal.Copy(utf8str,0,mString,utf8str.Length); Marshal.WriteByte(mString,utf8str.Length,0); }
public static AprFile Open(Std stream, AprPool pool) { IntPtr ptr = IntPtr.Zero; int res = 0; switch (stream) { case Std.In: Debug.Write(String.Format("apr_file_open_stdin({0})...", pool)); res = Apr.apr_file_open_stdin(out ptr, pool); break; case Std.Out: Debug.Write(String.Format("apr_file_open_stdout({0})...", pool)); res = Apr.apr_file_open_stdout(out ptr, pool); break; case Std.Err: Debug.Write(String.Format("apr_file_open_stderr({0})...", pool)); res = Apr.apr_file_open_stderr(out ptr, pool); break; } if (res != 0) { throw new AprException(res); } Debug.WriteLine(String.Format("Done({0:X})", ((Int32)ptr))); return(ptr); }
public SvnStream(IntPtr baton, AprPool pool) { mStream = Svn.svn_stream_create(baton, pool); mReadDelegate = null; mWriteDelegate = null; mCloseDelegate = null; }
public SvnClient(AprPool pool) { mGlobalPool = pool; mPool = Svn.PoolCreate(mGlobalPool); mContext = SvnClientContext.Create(mGlobalPool); mContext.Config = SvnConfig.GetConfig(mGlobalPool); mAuthObjs = null; }
public SvnPath(SvnString str, AprPool pool) { IntPtr svnStr; SvnError err = Svn.svn_utf_string_to_utf8(out svnStr, str, pool); if(!err.IsNoError) throw new SvnException(err); mPath = ((SvnString)svnStr).Data; }
public SvnData(SvnStringBuf str, AprPool pool) { IntPtr svnStrBuf; SvnError err = Svn.svn_utf_stringbuf_to_utf8(out svnStrBuf, str, pool); if(!err.IsNoError) throw new SvnException(err); mString = ((SvnStringBuf)svnStrBuf).Data; }
public static void Add(SvnPath path, bool recurse, SvnClientContext ctx, AprPool pool) { Debug.WriteLine(String.Format("svn_client_add({0},{1},{2},{3})",path,recurse,ctx,pool)); SvnError err = Svn.svn_client_add(path, (recurse ? 1 :0), ctx, pool); if( !err.IsNoError ) throw new SvnException(err); }
public static AprHashIndex First(AprPool pool, AprHash h) { IntPtr ptr; Debug.Write(String.Format("apr_hash_first({0},{1})...", pool, h)); ptr = Apr.apr_hash_first(pool, h); Debug.WriteLine(String.Format("Done({0:X})", ((Int32)ptr))); return(ptr); }
public static AprHashIndex First(AprPool pool, AprHash h) { IntPtr ptr; Debug.Write(String.Format("apr_hash_first({0},{1})...",pool,h)); ptr = Apr.apr_hash_first(pool,h); Debug.WriteLine(String.Format("Done({0:X})",((Int32)ptr))); return(ptr); }
public SvnUrl(string str, AprPool pool) { Uri uri; try { uri = new Uri(str); } catch(System.UriFormatException e) { throw new SvnException("Invalid URL",e); } mUrl = new AprString(uri.AbsoluteUri, pool); }
public static AprArray LazyMake(AprPool pool, ICollection list) { if (list is AprArray) { if (((AprArray)list).Pool.ReferenceEquals(pool)) { return((AprArray)list); } } return(Make(pool, list)); }
public static AprArray Make(AprPool pool, int nElts, Type eltsType) { if (eltsType.IsPrimitive) { return(new AprArray(Make(pool, nElts, Marshal.SizeOf(eltsType)), eltsType)); } else { return(new AprArray(Make(pool, nElts, Marshal.SizeOf(typeof(IntPtr))), eltsType)); } }
public static AprArray LazyMake(AprPool pool, ICollection list, Type type) { if (list is AprArray) { if (((AprArray)list).Pool.ReferenceEquals(pool) && ((AprArray)list).ElementType == type) { return((AprArray)list); } } return(Make(pool, list, type)); }
public static AprHash Make(AprPool pool) { IntPtr ptr; Debug.Write(String.Format("apr_hash_make({0})...", pool)); ptr = Apr.apr_hash_make(pool); if (ptr == IntPtr.Zero) { throw new AprException("apr_hash_make: Can't create an apr_hash_t"); } Debug.WriteLine(String.Format("Done({0:X})", ((Int32)ptr))); return(ptr); }
private SvnAuthBaton(ArrayList authProviders, AprPool pool) { AprArray authArray = AprArray.Make(pool,authProviders.Count,Marshal.SizeOf(typeof(IntPtr))); mAuthProviders = new ArrayList(); foreach(SvnAuthProviderObject authObj in authProviders) { Marshal.WriteIntPtr(authArray.Push(),authObj); mAuthProviders.Add(authObj.mAuthProvider); } Debug.Write(String.Format("svn_auth_open({0},{1})...",authArray,pool)); Svn.svn_auth_open(out mAuthBaton, authArray, pool); Debug.WriteLine(String.Format("Done({0:X})",mAuthBaton.ToInt32())); mParamName = null; mPool = pool; }
public static AprArray Make(AprPool pool, int nElts, int eltSize) { IntPtr ptr; Debug.Write(String.Format("apr_array_make({0},{1},{2})...", pool, nElts, eltSize)); ptr = Apr.apr_array_make(pool, nElts, eltSize); if (ptr == IntPtr.Zero) { throw new AprException("apr_array_make: Can't create an apr_array_header_t"); } Debug.WriteLine(String.Format("Done({0:X})", ((Int32)ptr))); return(ptr); }
public static AprFile Open(string fname, Flags flag, Perms perm, AprPool pool) { IntPtr ptr; Debug.Write(String.Format("apr_file_open({0},{1},{2},{3})...", fname, flag, perm, pool)); int res = Apr.apr_file_open(out ptr, fname, (int)flag, (int)perm, pool); if (res != 0) { throw new AprException(res); } Debug.WriteLine(String.Format("Done({0:X})", ((Int32)ptr))); return(ptr); }
public AprHash Overlay(AprPool pool, AprHash h) { IntPtr ptr; CheckPtr(); Debug.Write(String.Format("apr_hash_overlay({0},{1},{2})...", pool, h, this)); ptr = Apr.apr_hash_overlay(pool, h, mHash); if (ptr == IntPtr.Zero) { throw new AprException("apr_hash_overlay: Can't overlay an apr_hash_t"); } Debug.WriteLine(String.Format("Done({0:X})", ((Int32)ptr))); return(ptr); }
public AprArray CopyHdr(AprPool pool) { IntPtr ptr; CheckPtr(); Debug.Write(String.Format("apr_array_copy_hdr({0},{1})...", pool, this)); ptr = Apr.apr_array_copy_hdr(pool, new IntPtr(mArray)); if (ptr == IntPtr.Zero) { throw new AprException("apr_array_copy_hdr: Can't copy an apr_array_header_t"); } Debug.WriteLine(String.Format("Done({0:X})", ((Int32)ptr))); return(new AprArray(ptr, mEltsType)); }
public static AprPool Create(AprPool pool, AprAllocator allocator) { IntPtr ptr; Debug.Write(String.Format("apr_pool_create_ex({0},{1})...", pool, allocator)); int res = Apr.apr_pool_create_ex(out ptr, pool, IntPtr.Zero, allocator); if (res != 0) { throw new AprException(res); } Debug.WriteLine(String.Format("Done({0:X})", ((Int32)ptr))); return(ptr); }
public void AllocLoop() { AprPool p = new AprPool(); Assert.IsTrue(p.IsNull,"#G000001"); p = AprPool.Create(); Assert.IsFalse(p.IsNull,"#G000002"); for(int i=24;i<4096;i+=24) { Assert.IsTrue(p.Alloc(i).ToInt32() != 0,String.Format("#G{0,6}",i)); } p.Destroy(); Assert.IsTrue(p.IsNull,"#G000004"); }
public static AprThreadMutex Create(AprThreadMutexFlags flags, AprPool pool) { IntPtr ptr; Debug.Write(String.Format("apr_thread_mutex_create({0},{1})...", flags, pool)); int res = Apr.apr_thread_mutex_create(out ptr, (uint)flags, pool); if (res != 0) { throw new AprException(res); } Debug.WriteLine(String.Format("Done({0:X})", ((Int32)ptr))); return((AprThreadMutex)ptr); }
public static AprArray Make(AprPool pool, ICollection list, Type type) { if (list is AprArray && ((AprArray)list).ElementType == type) { return(((AprArray)list).Copy(pool)); } else { AprArray a = Make(pool, list.Count, type); IEnumerator it = list.GetEnumerator(); while (it.MoveNext()) { a.Push(it.Current); } return(a); } }
public AprString pStrCat(AprPool pool, char sep) { IntPtr ptr; CheckPtr(); if (mEltsType != null && mEltsType != typeof(AprString)) { throw new AprInvalidOperationException("Not an AprString array."); } Debug.Write(String.Format("apr_array_pstrcat({0},{1},{2})...", pool, this, sep)); ptr = Apr.apr_array_pstrcat(pool, new IntPtr(mArray), sep); if (ptr == IntPtr.Zero) { throw new AprException("apr_array_pstrcat: Can't convert an apr_array_header_t to AprString"); } Debug.WriteLine(String.Format("Done({0:X})", ((Int32)ptr))); return(ptr); }
public static AprArray Make(AprPool pool, ICollection list) { if (list is AprArray) { return(((AprArray)list).Copy(pool)); } else { IEnumerator it = list.GetEnumerator(); it.MoveNext(); AprArray a = Make(pool, list.Count, it.Current.GetType()); it.Reset(); while (it.MoveNext()) { a.Push(it.Current); } return(a); } }
public void Alloc() { AprPool p = new AprPool(); Assert.IsTrue(p.IsNull,"#E01"); p = AprPool.Create(); Assert.IsFalse(p.IsNull,"#E02"); Assert.IsTrue(p.Alloc(128).ToInt32() != 0,"#E03"); Assert.IsTrue(p.Alloc(256).ToInt32() != 0,"#E04"); Assert.IsTrue(p.Alloc(512).ToInt32() != 0,"#E05"); Assert.IsTrue(p.Alloc(1024).ToInt32() != 0,"#E06"); Assert.IsTrue(p.Alloc(2048).ToInt32() != 0,"#E07"); Assert.IsTrue(p.Alloc(4096).ToInt32() != 0,"#E08"); Assert.IsTrue(p.Alloc(6148).ToInt32() != 0,"#E09"); Assert.IsTrue(p.Alloc(9216).ToInt32() != 0,"#E10"); Assert.IsTrue(p.Alloc(12265).ToInt32() != 0,"#E11"); Assert.IsTrue(p.Alloc(16384).ToInt32() != 0,"#E12"); p.Destroy(); Assert.IsTrue(p.IsNull,"#E13"); }
public SvnError GetCommitLogCallback(out AprString logMessage, out SvnPath tmpFile, AprArray commitItems, IntPtr baton, AprPool pool) { if (!commitItems.IsNull) { foreach (SvnClientCommitItem item in commitItems) { Console.WriteLine("C1: {1} ({2}) r{3}", item.Path, item.Kind, item.Revision); Console.WriteLine("C2: {1} -> {2}", item.Url, item.CopyFromUrl); } Console.WriteLine(); } Console.Write("Enter log message: "); logMessage = new AprString(Console.ReadLine(), pool); tmpFile = new SvnPath(pool); return(SvnError.NoError); }
protected static int InternalExport(IAprUnmanaged from, SvnPath to, SvnOptRevision revision, bool force, SvnClientContext ctx, AprPool pool) { int rev; Debug.Write(String.Format("svn_client_export({0},{1},{2},{3},{4},{5})...",from,to,revision,force,ctx,pool)); SvnError err = Svn.svn_client_export(out rev, from.ToIntPtr(), to, revision, (force ? 1 :0), ctx, pool); if( !err.IsNoError ) throw new SvnException(err); Debug.WriteLine(String.Format("Done({0})",rev)); return(rev); }
public static AprThreadMutex Create(AprPool pool) { return(Create(AprThreadMutexFlags.Default, pool)); }
public static SvnData Duplicate(AprPool pool, SvnStringBuf str) { return(new SvnData(str, pool)); }
public SvnData(AprString str, AprPool pool) { SvnError err = Svn.svn_utf_cstring_to_utf8(out mString, str, pool); if(!err.IsNoError) throw new SvnException(err); }
public AprHashEnumerator(AprHash h, AprPool pool) { mHash = h; mPool = pool; reset = true; }
public static AprThreadMutex Create( AprThreadMutexFlags flags, AprPool pool) { IntPtr ptr; Debug.Write(String.Format("apr_thread_mutex_create({0},{1})...",flags,pool)); int res = Apr.apr_thread_mutex_create(out ptr, (uint)flags, pool); if(res != 0 ) throw new AprException(res); Debug.WriteLine(String.Format("Done({0:X})",((Int32)ptr))); return((AprThreadMutex) ptr); }
public static AprString Duplicate(AprPool pool, AprString str, uint size) { return(new AprString(str, size, pool)); }
public static AprString Duplicate(AprPool pool, AprString str) { return(new AprString(str, pool)); }
protected static void InternalPropSet(string propName, SvnString propVal, IAprUnmanaged target, bool recurse, AprPool pool) { Debug.WriteLine(String.Format("svn_client_propset({0},{1},{2},{3},{4})",propName,propVal,target,recurse,pool)); SvnError err = Svn.svn_client_propset(propName, propVal, target.ToIntPtr(), (recurse ? 1 : 0), pool); if( !err.IsNoError ) throw new SvnException(err); }
protected static SvnUrl InternalUrlFromPath(IAprUnmanaged pathOrUrl, AprPool pool) { IntPtr s; Debug.Write(String.Format("svn_client_url_from_path({0},{1})...",pathOrUrl,pool)); SvnError err = Svn.svn_client_url_from_path(out s, pathOrUrl.ToIntPtr(), pool); if( !err.IsNoError ) throw new SvnException(err); Debug.WriteLine(String.Format("Done({0})",s)); return(s); }
protected static AprHash InternalPropList(IAprUnmanaged target, SvnOptRevision revision, bool recurse, SvnClientContext ctx, AprPool pool) { IntPtr h; Debug.Write(String.Format("svn_client_proplist({0},{1},{2},{3},{4})...",target,revision,recurse,ctx,pool)); SvnError err = Svn.svn_client_proplist(out h, target.ToIntPtr(), revision, (recurse ? 1 : 0), ctx, pool); if( !err.IsNoError ) throw new SvnException(err); Debug.WriteLine(String.Format("Done({0})",h)); return(h); }
public bool IsAncestor(AprPool pool) { CheckPtr(); Debug.WriteLine(String.Format("apr_pool_is_ancestor({0:X},{1:X})", this, pool)); return(!(Apr.apr_pool_is_ancestor(mPool, pool) == 0)); }
public static AprPool Create(AprPool pool) { return(Create(pool, IntPtr.Zero)); }
public AprHashIndex First(AprPool pool) { return(AprHashIndex.First(pool, this)); }
public static void Cat(SvnStream stream, SvnUrl pathOrUrl, SvnOptRevision revision, SvnClientContext ctx, AprPool pool) { InternalCat(stream, pathOrUrl, revision, ctx, pool); }
public IEnumerator GetEnumerator(AprPool pool) { return((IEnumerator) new AprHashEnumerator(this, pool)); }
public static int Checkout(SvnUrl url, SvnPath path, SvnOptRevision revision, bool recurse, SvnClientContext ctx, AprPool pool) { int rev; Debug.Write(String.Format("svn_client_checkout({0},{1},{2},{3},{4},{5})...",url,path,revision,recurse,ctx,pool)); SvnError err = Svn.svn_client_checkout(out rev, url, path, revision, (recurse ? 1 :0), ctx, pool); if( !err.IsNoError ) throw new SvnException(err); Debug.WriteLine(String.Format("Done({0})",rev)); return(rev); }
public AprHashEnumerator(AprHash h) { mHash = h; mPool = h.Pool; reset = true; }
public static AprPool Create(AprPool pool, AprAllocator allocator) { IntPtr ptr; Debug.Write(String.Format("apr_pool_create_ex({0},{1})...",pool,allocator)); int res = Apr.apr_pool_create_ex(out ptr, pool, IntPtr.Zero, allocator); if(res != 0 ) throw new AprException(res); Debug.WriteLine(String.Format("Done({0:X})",((Int32)ptr))); return(ptr); }
public string StrCat(AprPool pool, char sep) { return(pStrCat(pool, sep).ToString()); }
public bool IsAncestor(AprPool pool) { CheckPtr(); Debug.WriteLine(String.Format("apr_pool_is_ancestor({0:X},{1:X})",this,pool)); return(!(Apr.apr_pool_is_ancestor(mPool,pool) == 0)); }
public AprString(AprString str, int size, AprPool pool) { mString = Apr.apr_pstrndup(pool, str, unchecked ((uint)size)); }
public static AprTimeExp Alloc(AprPool pool) { return(new AprTimeExp((apr_time_exp_t *)pool.CAlloc(sizeof(apr_time_exp_t)))); }
public AprString(AprString str, uint size, AprPool pool) { mString = Apr.apr_pstrndup(pool, str, size); }
public AprString(AprString str, AprPool pool) { mString = Apr.apr_pstrdup(pool, str); }
public static SvnClientContext Create(AprPool pool) { IntPtr ptr; Debug.Write(String.Format("svn_client_create_context({0})...",pool)); SvnError err = Svn.svn_client_create_context(out ptr, pool); if(!err.IsNoError) throw new SvnException(err); Debug.WriteLine(String.Format("Done({0:X})",((Int32)ptr))); return(ptr); }
protected static void InternalMerge(IAprUnmanaged source1, SvnOptRevision revision1, IAprUnmanaged source2, SvnOptRevision revision2, SvnPath targetWCPath, bool recurse, bool ignoreAncestry, bool force, bool dryRun, SvnClientContext ctx, AprPool pool) { 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)); SvnError err = Svn.svn_client_merge(source1.ToIntPtr(), revision1, source2.ToIntPtr(), revision2, targetWCPath, (recurse ? 1 : 0), (ignoreAncestry ? 1 : 0), (force ? 1 : 0), (dryRun ? 1 : 0), ctx, pool); if( !err.IsNoError ) throw new SvnException(err); }