コード例 #1
0
 public SvnClient(SvnClientContext ctx, AprPool pool)
 {
     mGlobalPool = pool;
     mPool       = Svn.PoolCreate(mGlobalPool);
     mContext    = ctx;
     mAuthObjs   = null;
 }
コード例 #2
0
        public static int Status(SvnPath path,
                                 SvnOptRevision revision,
                                 SvnWcStatus.Func statusFunc, IntPtr statusBaton,
                                 bool descend, bool getAll, bool update, bool noIgnore,
                                 SvnClientContext ctx, AprPool pool)
        {
            int         rev;
            SvnDelegate statusDelegate = new SvnDelegate(statusFunc);

            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));
            SvnError err = Svn.svn_client_status(out rev, path, revision,
                                                 (Svn.svn_wc_status_func_t)statusDelegate.Wrapper,
                                                 statusBaton,
                                                 (descend ? 1 : 0), (getAll ? 1 : 0),
                                                 (update ? 1 : 0), (noIgnore ? 1 : 0),
                                                 ctx, pool);

            if (!err.IsNoError)
            {
                throw new SvnException(err);
            }
            Debug.WriteLine(String.Format("Done({0})", rev));
            if (update)
            {
                return(rev);
            }
            else
            {
                return(-1);
            }
        }
コード例 #3
0
 public SvnStream(IntPtr baton, AprPool pool)
 {
     mStream        = Svn.svn_stream_create(baton, pool);
     mReadDelegate  = null;
     mWriteDelegate = null;
     mCloseDelegate = null;
 }
コード例 #4
0
 public SvnClient(AprPool pool)
 {
     mGlobalPool     = pool;
     mPool           = Svn.PoolCreate(mGlobalPool);
     mContext        = SvnClientContext.Create(mGlobalPool);
     mContext.Config = SvnConfig.GetConfig(mGlobalPool);
     mAuthObjs       = null;
 }
コード例 #5
0
        public static SvnAuthProviderObject GetUsernameProvider(AprPool pool)
        {
            IntPtr authObj;

            Debug.Write(String.Format("svn_client_get_username_provider({0:X})", pool));
            Svn.svn_client_get_username_provider(out authObj, pool);
            Debug.WriteLine(String.Format("Done({0:X})", authObj.ToInt32()));
            return(new SvnAuthProviderObject(authObj));
        }
コード例 #6
0
        public static SvnAuthProviderObject GetSslClientCertPwFileProvider(AprPool pool)
        {
            IntPtr authObj;

            Debug.Write(String.Format("svn_client_get_ssl_client_cert_pw_file_provider({0:X})", pool));
            Svn.svn_client_get_ssl_client_cert_pw_file_provider(out authObj, pool);
            Debug.WriteLine(String.Format("Done({0:X})", authObj.ToInt32()));
            return(new SvnAuthProviderObject(authObj));
        }
コード例 #7
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);
            }
        }
コード例 #8
0
        public static void Ensure(SvnPath configDir, AprPool pool)
        {
            Debug.WriteLine(String.Format("svn_config_ensure({0},{1})", configDir, pool));
            SvnError err = Svn.svn_config_ensure(configDir, pool);

            if (!err.IsNoError)
            {
                throw new SvnException(err);
            }
        }
コード例 #9
0
        public static void Ensure(AprPool pool)
        {
            Debug.WriteLine(String.Format("svn_config_ensure(NULL,{0})", pool));
            SvnError err = Svn.svn_config_ensure(IntPtr.Zero, pool);

            if (!err.IsNoError)
            {
                throw new SvnException(err);
            }
        }
コード例 #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;
        }
コード例 #11
0
        public static void Resolved(SvnPath path, bool recurse,
                                    SvnClientContext ctx, AprPool pool)
        {
            Debug.WriteLine(String.Format("svn_client_resolved({0},{1},{2},{3})", path, recurse, ctx, pool));
            SvnError err = Svn.svn_client_resolved(path, (recurse ? 1 : 0), ctx, pool);

            if (!err.IsNoError)
            {
                throw new SvnException(err);
            }
        }
コード例 #12
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;
        }
コード例 #13
0
        public static SvnStream Stdout(AprPool pool)
        {
            IntPtr   ptr;
            SvnError err = Svn.svn_stream_for_stdout(out ptr, pool);

            if (!err.IsNoError)
            {
                throw new SvnException(err);
            }
            return(ptr);
        }
コード例 #14
0
        public static void CleanUp(SvnPath dir,
                                   SvnClientContext ctx, AprPool pool)
        {
            Debug.WriteLine(String.Format("svn_client_cleanup({0},{1},{2})", dir, ctx, pool));
            SvnError err = Svn.svn_client_cleanup(dir, ctx, pool);

            if (!err.IsNoError)
            {
                throw new SvnException(err);
            }
        }
コード例 #15
0
        protected static void InternalCat(SvnStream stream, IAprUnmanaged pathOrUrl,
                                          SvnOptRevision revision,
                                          SvnClientContext ctx, AprPool pool)
        {
            Debug.WriteLine(String.Format("svn_client_cat({0},{1},{2},{3},{4})", stream, pathOrUrl, revision, ctx, pool));
            SvnError err = Svn.svn_client_cat(stream, pathOrUrl.ToIntPtr(), revision, ctx, pool);

            if (!err.IsNoError)
            {
                throw new SvnException(err);
            }
        }
コード例 #16
0
        public static void Relocate(SvnPath dir, SvnUrl from, SvnUrl to,
                                    bool recurse,
                                    SvnClientContext ctx, AprPool pool)
        {
            Debug.WriteLine(String.Format("svn_client_relocate({0},{1},{2},{3},{4},{5})", dir, from, to, recurse, ctx, pool));
            SvnError err = Svn.svn_client_relocate(dir, from, to, (recurse ? 1 : 0), ctx, pool);

            if (!err.IsNoError)
            {
                throw new SvnException(err);
            }
        }
コード例 #17
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);
            }
        }
コード例 #18
0
        public static AprHash GetConfig(SvnPath configDir, AprPool pool)
        {
            IntPtr h;

            Debug.WriteLine(String.Format("svn_config_get_config({0},{1})", configDir, pool));
            SvnError err = Svn.svn_config_get_config(out h, configDir, pool);

            if (!err.IsNoError)
            {
                throw new SvnException(err);
            }
            return(h);
        }
コード例 #19
0
        public static void Ensure()
        {
            AprPool pool = Svn.PoolCreate();

            try
            {
                Ensure(pool);
            }
            finally
            {
                pool.Destroy();
            }
        }
コード例 #20
0
        public static AprHash GetConfig(AprPool pool)
        {
            IntPtr h;

            Debug.WriteLine(String.Format("svn_config_get_config(NULL,{0})", pool));
            SvnError err = Svn.svn_config_get_config(out h, IntPtr.Zero, pool);

            if (!err.IsNoError)
            {
                throw new SvnException(err);
            }
            return(h);
        }
コード例 #21
0
        public static AprString UuidFromUrl(SvnUrl url, SvnClientContext ctx, AprPool pool)
        {
            IntPtr s;

            Debug.Write(String.Format("svn_client_uuid_from_url({0},{1})...", url, ctx, pool));
            SvnError err = Svn.svn_client_uuid_from_url(out s, url, ctx, pool);

            if (!err.IsNoError)
            {
                throw new SvnException(err);
            }
            Debug.WriteLine(String.Format("Done({0})", s));
            return(s);
        }
コード例 #22
0
        public static SvnAuthProviderObject GetPromptProvider(
            SslClientCertPwPrompt promptFunc,
            IntPtr promptBaton, int retryLimit, AprPool pool)
        {
            IntPtr      authObj;
            SvnDelegate auth = new SvnDelegate(promptFunc);

            Debug.Write(String.Format("svn_client_get_ssl_client_cert_pw_prompt_provider([callback:{0}],{1:X},{2},{3})...", promptFunc.Method.Name, promptBaton.ToInt32(), retryLimit, pool));
            Svn.svn_client_get_ssl_client_cert_pw_prompt_provider(out authObj,
                                                                  (Svn.svn_auth_ssl_client_cert_pw_prompt_func_t)auth.Wrapper,
                                                                  promptBaton, retryLimit, pool);
            Debug.WriteLine(String.Format("Done({0:X})", authObj.ToInt32()));
            return(new SvnAuthProviderObject(authObj, auth));
        }
コード例 #23
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);
        }
コード例 #24
0
        public static SvnClientCommitInfo Delete(AprArray paths, bool force,
                                                 SvnClientContext ctx, AprPool pool)
        {
            IntPtr commitInfo;

            Debug.Write(String.Format("svn_client_delete({0},{1},{2},{3})...", paths, force, ctx, pool));
            SvnError err = Svn.svn_client_delete(out commitInfo, paths, (force ? 1 : 0), ctx, pool);

            if (!err.IsNoError)
            {
                throw new SvnException(err);
            }
            Debug.WriteLine(String.Format("Done({0})", commitInfo));
            return(commitInfo);
        }
コード例 #25
0
        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);
        }
コード例 #26
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;
        }
コード例 #27
0
        public static SvnClientCommitInfo Import(SvnPath path, SvnUrl url, bool nonrecursive,
                                                 SvnClientContext ctx, AprPool pool)
        {
            IntPtr commitInfo;

            Debug.Write(String.Format("svn_client_import({0},{1},{2},{3},{4})...", path, url, nonrecursive, ctx, pool));
            SvnError err = Svn.svn_client_import(out commitInfo, path, url, (nonrecursive ? 1 : 0),
                                                 ctx, pool);

            if (!err.IsNoError)
            {
                throw new SvnException(err);
            }
            Debug.WriteLine(String.Format("Done({0})", commitInfo));
            return(commitInfo);
        }
コード例 #28
0
        public static SvnClientCommitInfo Commit(AprArray targets, bool nonrecursive,
                                                 SvnClientContext ctx, AprPool pool)
        {
            IntPtr commitInfo;

            Debug.Write(String.Format("svn_client_commit({0},{1},{2},{3})...", targets, nonrecursive, ctx, pool));
            SvnError err = Svn.svn_client_commit(out commitInfo, targets, (nonrecursive ? 1 : 0),
                                                 ctx, pool);

            if (!err.IsNoError)
            {
                throw new SvnException(err);
            }
            Debug.WriteLine(String.Format("Done({0})", commitInfo));
            return(commitInfo);
        }
コード例 #29
0
        protected static AprHash InternalList(IAprUnmanaged pathOrUrl,
                                              SvnOptRevision revision, bool recurse,
                                              SvnClientContext ctx, AprPool pool)
        {
            IntPtr h;

            Debug.Write(String.Format("svn_client_list({0},{1},{2},{3},{4})...", pathOrUrl, revision, recurse, ctx, pool));
            SvnError err = Svn.svn_client_ls(out h, pathOrUrl.ToIntPtr(), revision, (recurse ? 1 : 0),
                                             ctx, pool);

            if (!err.IsNoError)
            {
                throw new SvnException(err);
            }
            Debug.WriteLine(String.Format("Done({0})", h));
            return(h);
        }
コード例 #30
0
        public static AprHash RevPropList(SvnUrl url,
                                          SvnOptRevision revision, out int setRev,
                                          SvnClientContext ctx, AprPool pool)
        {
            IntPtr h;

            Debug.Write(String.Format("svn_client_revprop_list({0},{1},{2},{3})...", url, revision, ctx, pool));
            SvnError err = Svn.svn_client_revprop_list(out h, url, revision, out setRev,
                                                       ctx, pool);

            if (!err.IsNoError)
            {
                throw new SvnException(err);
            }
            Debug.WriteLine(String.Format("Done({0},{1})", h, setRev));
            return(h);
        }
コード例 #31
0
 public SvnRevision(Svn.Revision kind)
 {
     mKind = kind;
     mNumber = 0;
     mDate = 0;
 }
コード例 #32
0
 public SvnOptRevision(Svn.Revision revKind, out GCHandle handle)
 {
     handle = GCHandle.Alloc(new svn_opt_revision_t(),GCHandleType.Pinned);
     mOptRevision = (svn_opt_revision_t *)handle.AddrOfPinnedObject().ToPointer();
     Kind = revKind;
 }
コード例 #33
0
ファイル: SvnDelegate.cs プロジェクト: softec/SubversionSharp
 // svn_cancel_func_t Wrapper
 public SvnDelegate(Svn.CancelFunc func)
 {
     mFunc = func;
     mWrapperFunc = new Svn.svn_cancel_func_t(SvnCancelFuncWrapper);
 }
コード例 #34
0
ファイル: CmdBase.cs プロジェクト: softec/SubversionSharp
        public void NotifyCallback(IntPtr baton, SvnPath Path,  
	        	 	 	           SvnWcNotify.Action action, Svn.NodeKind kind,
	        			 		   AprString mimeType, SvnWcNotify.State contentState,
	        			 		   SvnWcNotify.State propState, int revNum)
        {
            switch(action)
            {
                case SvnWcNotify.Action.Add:
                    if (!mimeType.IsNull && !mimeType.ToString().StartsWith("text/"))
                        Console.WriteLine("A  (bin)  {0}", Path);
                    else
                        Console.WriteLine("A         {0}", Path);
                    mChanged = true;
                    break;

                case SvnWcNotify.Action.BlameRevision:
                    break;

                case SvnWcNotify.Action.CommitAdded:
                    if (!mimeType.IsNull && !mimeType.ToString().StartsWith("text/"))
                        Console.WriteLine("Adding  (bin)  {0}", Path);
                    else
                        Console.WriteLine("Adding         {0}", Path);
                    break;

                case SvnWcNotify.Action.CommitDeleted:
                        Console.WriteLine("Deleting       {0}", Path);
                    break;

                case SvnWcNotify.Action.CommitModified:
                    Console.WriteLine("Sending        {0}", Path);
                    break;

                case SvnWcNotify.Action.CommitReplaced:
                        Console.WriteLine("Replacing      {0}", Path);
                    break;

                case SvnWcNotify.Action.Copy:
                    break;

                case SvnWcNotify.Action.Delete:
                    Console.WriteLine("D         {0}", Path);
                    mChanged = true;
                    break;

                case SvnWcNotify.Action.FailedRevert:
                    Console.WriteLine("Failed to revert '{0}' -- try updating instead.", Path);
                    break;

                case SvnWcNotify.Action.PostfixTxdelta:
                    if( !mTxDelta )
                    {
                        Console.Write("Transmitting file data ");
                        mTxDelta = true;
                    }
                    Console.Write(".");
                    break;

                case SvnWcNotify.Action.Resolved:
                    Console.WriteLine("Resolved conflicted state of '{0}'", Path);
                    break;

                case SvnWcNotify.Action.Restore:
                    Console.WriteLine("Restored '{0}'", Path);
                    break;

                case SvnWcNotify.Action.Revert:
                    Console.WriteLine("Reverted '{0}'", Path);
                    break;

                case SvnWcNotify.Action.Skip:
                    if (contentState == SvnWcNotify.State.Missing)
                        Console.WriteLine("Skipped missing target: '{0}'", Path);
              				else
                        Console.WriteLine("Skipped '{0}'", Path);
                    break;

                case SvnWcNotify.Action.StatusCompleted:
                    if( revNum >= 0 )
                        Console.WriteLine("Status against revision: {0}", revNum);
                    break;

                case SvnWcNotify.Action.StatusExternal:
                    Console.WriteLine("\nPerforming status on external item at '{0}'", Path);
                    break;

                case SvnWcNotify.Action.UpdateAdd:
                    Console.WriteLine("A {0}", Path);
                    mChanged = true;
                    break;

                case SvnWcNotify.Action.UpdateCompleted:
                    if( revNum >= 0 )
              		{
                        if( mSubCmd.LongName == "export" )
                            Console.WriteLine("Exported {0}revision {1}.",
                                                (mInExternal) ? "external at " : "",
                                                revNum);
                        else if( mSubCmd.LongName == "checkout" )
                            Console.WriteLine("Checked out {0}revision {1}.",
                                                (mInExternal) ? "external at " : "",
                                                revNum);
                        else
                        {
                            if( mChanged )
                      			Console.WriteLine("Updated {0}to revision {1}.",
                                                    (mInExternal) ? "external at " : "",
                                                    revNum);
                            else
                      			Console.WriteLine("{0}t revision {1}.",
                                                    (mInExternal) ? "External a" : "A",
                                                    revNum);
                        }
                    }
                    else  /* no revision */
                    {
                        if( mSubCmd.LongName == "export" )
                  			Console.WriteLine("{0}xport complete.",
                                                (mInExternal) ? "External e" : "E");
                        else if( mSubCmd.LongName == "checkout" )
                  			Console.WriteLine("{0}heckout complete.\n",
                                                (mInExternal) ? "External c" : "C");
                        else
                  			Console.WriteLine("{0}pdate complete.\n",
                                                (mInExternal) ? "External u" : "U");
                    }
                    if( mInExternal )
                        Console.WriteLine();
                    mInExternal = false;
                    mChanged = false;
                    break;

                case SvnWcNotify.Action.UpdateDelete:
                    Console.WriteLine("D {0}", Path);
                    mChanged = true;
                    break;

                case SvnWcNotify.Action.UpdateExternal:
                    Console.WriteLine("\nFetching external item into '{0}'", Path);
                    mInExternal = true;
                    break;

                case SvnWcNotify.Action.UpdateUpdate:
                    string s1 = " ";
                    string s2 = " ";
                    if (! ((kind == Svn.NodeKind.Dir)
               				&& ((propState == SvnWcNotify.State.Inapplicable)
                   			 || (propState == SvnWcNotify.State.Unknown)
                             || (propState == SvnWcNotify.State.Unchanged))))
                    {
                        mChanged = true;
                        if (kind == Svn.NodeKind.File)
                        {
                            if (contentState == SvnWcNotify.State.Conflicted)
                                s1 = "C";
                            else if (contentState == SvnWcNotify.State.Merged)
                                s1 = "G";
                            else if (contentState == SvnWcNotify.State.Changed)
                                s1 = "U";
              			}

                        if (propState == SvnWcNotify.State.Conflicted)
                            s2 = "C";
                        else if (propState == SvnWcNotify.State.Merged)
                            s2 = "G";
                        else if (propState == SvnWcNotify.State.Changed)
                            s2 = "U";

                        if (! ((contentState == SvnWcNotify.State.Unchanged
                                || contentState == SvnWcNotify.State.Unknown)
                            && (propState == SvnWcNotify.State.Unchanged
                                || propState == SvnWcNotify.State.Unknown)))
                            Console.WriteLine("{0}{1} {2}", s1, s2, Path);
                    }
              			break;
            }
        }
コード例 #35
0
 public SvnOptRevision(Svn.Revision revKind, AprPool pool)
 {
     mOptRevision = (svn_opt_revision_t *) pool.CAlloc(sizeof(svn_opt_revision_t));
     Kind = revKind;
 }