Example #1
0
 public SvnClient(SvnClientContext ctx, AprPool pool)
 {
     mGlobalPool = pool;
     mPool = Svn.PoolCreate(mGlobalPool);
     mContext = ctx;
     mAuthObjs = null;
 }
Example #2
0
        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));
        }
Example #3
0
        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);
        }
Example #4
0
 public AprHashEntry(AprPool pool)
 {
     mPool    = pool;
     mKey     = IntPtr.Zero;
     mKeySize = 0;
     mValue   = IntPtr.Zero;
 }
Example #5
0
 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);
 }
Example #6
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);
        }
Example #7
0
 public SvnStream(IntPtr baton, AprPool pool)
 {
     mStream = Svn.svn_stream_create(baton, pool);
     mReadDelegate = null;
     mWriteDelegate = null;
     mCloseDelegate = null;
 }
Example #8
0
 public SvnClient(AprPool pool)
 {
     mGlobalPool = pool;
     mPool = Svn.PoolCreate(mGlobalPool);
     mContext = SvnClientContext.Create(mGlobalPool);
     mContext.Config = SvnConfig.GetConfig(mGlobalPool);
     mAuthObjs = null;
 }
Example #9
0
 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;
 }
Example #10
0
 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;
 }
Example #11
0
        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);
        }
Example #12
0
        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);
        }
Example #13
0
        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);
        }
Example #14
0
 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);
 }
Example #15
0
 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));
 }
Example #16
0
 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));
     }
 }
Example #17
0
 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));
 }
Example #18
0
        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);
        }
Example #19
0
 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;
 }
Example #20
0
        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);
        }
Example #21
0
        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);
        }
Example #22
0
        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);
        }
Example #23
0
        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));
        }
Example #24
0
        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);
        }
Example #25
0
        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");
        }
Example #26
0
        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);
        }
Example #27
0
        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);
            }
        }
Example #28
0
        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);
        }
Example #29
0
        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);
            }
        }
Example #30
0
        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");
        }
Example #31
0
        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);
        }
Example #32
0
        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);
        }
Example #33
0
 public static AprThreadMutex Create(AprPool pool)
 {
     return(Create(AprThreadMutexFlags.Default, pool));
 }
Example #34
0
 public static SvnData Duplicate(AprPool pool, SvnStringBuf str)
 {
     return(new SvnData(str, pool));
 }
Example #35
0
 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);
 }
Example #36
0
 public AprHashEnumerator(AprHash h, AprPool pool)
 {
     mHash = h;
     mPool = pool;
     reset = true;
 }
Example #37
0
        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);
        }
Example #38
0
 public static AprString Duplicate(AprPool pool, AprString str, uint size)
 {
     return(new AprString(str, size, pool));
 }
Example #39
0
 public static AprString Duplicate(AprPool pool, AprString str)
 {
     return(new AprString(str, pool));
 }
Example #40
0
        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);
        }
Example #41
0
 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);
 }
Example #42
0
        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);
        }
Example #43
0
 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));
 }
Example #44
0
 public static AprPool Create(AprPool pool)
 {
     return(Create(pool, IntPtr.Zero));
 }
Example #45
0
 public AprHashIndex First(AprPool pool)
 {
     return(AprHashIndex.First(pool, this));
 }
Example #46
0
        public static void Cat(SvnStream stream, SvnUrl pathOrUrl,
							   SvnOptRevision revision, 
							   SvnClientContext ctx, AprPool pool)
        {
            InternalCat(stream, pathOrUrl, revision, ctx, pool);
        }
Example #47
0
 public IEnumerator GetEnumerator(AprPool pool)
 {
     return((IEnumerator) new AprHashEnumerator(this, pool));
 }
Example #48
0
        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);
        }
Example #49
0
 public AprHashEnumerator(AprHash h)
 {
     mHash = h;
     mPool = h.Pool;
     reset = true;
 }
Example #50
0
        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);
        }
Example #51
0
 public string StrCat(AprPool pool, char sep)
 {
     return(pStrCat(pool, sep).ToString());
 }
Example #52
0
 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));
 }
Example #53
0
 public static AprThreadMutex Create(AprPool pool)
 {
     return(Create(AprThreadMutexFlags.Default, pool));
 }
Example #54
0
 public static AprPool Create(AprPool pool)
 {
     return(Create(pool, IntPtr.Zero));
 }
Example #55
0
 public AprString(AprString str, int size, AprPool pool)
 {
     mString = Apr.apr_pstrndup(pool, str, unchecked ((uint)size));
 }
Example #56
0
 public static AprTimeExp Alloc(AprPool pool)
 {
     return(new AprTimeExp((apr_time_exp_t *)pool.CAlloc(sizeof(apr_time_exp_t))));
 }
Example #57
0
 public AprString(AprString str, uint size, AprPool pool)
 {
     mString = Apr.apr_pstrndup(pool, str, size);
 }
Example #58
0
 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);
        }
Example #60
0
        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);
        }