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);
            }
        }
        private IntPtr SvnAuthSslClientCertPwPromptWrapper(out IntPtr cred,
                                                           IntPtr baton,
                                                           IntPtr realm, int may_save,
                                                           IntPtr pool)
        {
            cred = IntPtr.Zero;
            SvnError err = SvnError.NoError;

            SvnAuthProviderObject.SslClientCertPwPrompt func =
                mFunc as SvnAuthProviderObject.SslClientCertPwPrompt;
            try {
                SvnAuthCredSslClientCertPw credSslClientCertPw;
                Debug.Write(String.Format("[Callback:{0}]SslClientCertPwPromptProvider({1:X},{2},{3},{4})...", func.Method.Name, baton.ToInt32(), new AprString(realm), (may_save != 0), new AprPool(pool)));
                err = func(out credSslClientCertPw, baton,
                           new AprString(realm),
                           (may_save != 0), new AprPool(pool));
                Debug.WriteLine(String.Format("Done({0})", credSslClientCertPw));
                cred = credSslClientCertPw;
            }
            catch (SvnException e) {
                err = SvnError.Create(e.AprErr, SvnError.NoError, e.Message);
            }
            catch (Exception e) {
                err = SvnError.Create(215000, SvnError.NoError, e.Message);
            }
            return(err);
        }
        //[CLSCompliant(false)]
        private IntPtr SvnAuthSslServerTrustPromptWrapper(out IntPtr cred, IntPtr baton,
                                                          IntPtr realm, uint failures,
                                                          IntPtr cert_info,
                                                          int may_save, IntPtr pool)
        {
            cred = IntPtr.Zero;
            SvnError err = SvnError.NoError;

            SvnAuthProviderObject.SslServerTrustPrompt func =
                mFunc as SvnAuthProviderObject.SslServerTrustPrompt;
            try {
                SvnAuthCredSslServerTrust credSslServerTrust;
                Debug.Write(String.Format("[Callback:{0}]SslServerTrustPromptProvider({1:X},{2},{3},{4},{5},{6})...", baton.ToInt32(), new AprString(realm), unchecked ((int)failures), new SvnAuthSslServerCertInfo(cert_info), (may_save != 0), new AprPool(pool)));
                err = func(out credSslServerTrust, baton,
                           new AprString(realm), (SvnAuthCredSslServerTrust.CertFailures)failures,
                           new SvnAuthSslServerCertInfo(cert_info),
                           (may_save != 0), new AprPool(pool));
                Debug.WriteLine(String.Format("Done({0})", credSslServerTrust));
                cred = credSslServerTrust;
            }
            catch (SvnException e) {
                err = SvnError.Create(e.AprErr, SvnError.NoError, e.Message);
            }
            catch (Exception e) {
                err = SvnError.Create(215000, SvnError.NoError, e.Message);
            }
            return(err);
        }
        private IntPtr SvnClientGetCommitLogWrapper(out IntPtr log_message, out IntPtr tmp_file,
                                                    IntPtr commit_items, IntPtr baton,
                                                    IntPtr pool)
        {
            log_message = IntPtr.Zero;
            tmp_file    = IntPtr.Zero;
            SvnError err = SvnError.NoError;

            SvnClient.GetCommitLog func = mFunc as SvnClient.GetCommitLog;
            try {
                AprString logMessage;
                SvnPath   tmpFile;
                Debug.Write(String.Format("[Callback:{0}]SvnClientGetCommitLog({1},{2:X},{3})...", func.Method.Name, new AprArray(commit_items), baton.ToInt32(), new AprPool(pool)));
                err = func(out logMessage, out tmpFile,
                           new AprArray(commit_items, typeof(SvnClientCommitItem)), baton,
                           new AprPool(pool));
                Debug.WriteLine(String.Format("Done({0},{1})", logMessage, tmpFile));
                log_message = logMessage;
                tmp_file    = tmpFile;
            }
            catch (SvnException e) {
                err = SvnError.Create(e.AprErr, SvnError.NoError, e.Message);
            }
            catch (Exception e) {
                err = SvnError.Create(215000, SvnError.NoError, e.Message);
            }
            return(err);
        }
Beispiel #5
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);
            }
        }
Beispiel #6
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);
            }
        }
Beispiel #7
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);
            }
        }
Beispiel #8
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;
        }
        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);
            }
        }
        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);
            }
        }
Beispiel #11
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;
        }
Beispiel #12
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);
        }
        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);
            }
        }
        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 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);
            }
        }
Beispiel #16
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);
        }
Beispiel #17
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);
        }
        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);
        }
        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);
        }
Beispiel #20
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);
        }
        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);
        }
        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);
        }
        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);
        }
        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);
        }
        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);
        }
        public static SvnString RevPropGet(string propName, SvnUrl url,
                                           SvnOptRevision revision, out int setRev,
                                           SvnClientContext ctx, AprPool pool)
        {
            IntPtr s;

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

            if (!err.IsNoError)
            {
                throw new SvnException(err);
            }
            Debug.WriteLine(String.Format("Done({0},{1})", s, setRev));
            return(s);
        }
        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);
        }
        protected static AprHash InternalPropGet(string propName, IAprUnmanaged target,
                                                 SvnOptRevision revision, bool recurse,
                                                 SvnClientContext ctx, AprPool pool)
        {
            IntPtr h;

            Debug.Write(String.Format("svn_client_propget({0},{1},{2},{3},{4},{5})...", propName, target, revision, recurse, ctx, pool));
            SvnError err = Svn.svn_client_propget(out h, propName, 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 static int RevPropSet(string propName, SvnString propVal,
                                     SvnUrl url, SvnOptRevision revision, bool force,
                                     SvnClientContext ctx, AprPool pool)
        {
            int rev;

            Debug.Write(String.Format("svn_client_revprop_set({0},{1},{2},{3},{4},{5},{6})...", propName, propVal, url, revision, force, ctx, pool));
            SvnError err = Svn.svn_client_revprop_set(propName, propVal, url, revision,
                                                      out rev, (force ? 1 : 0),
                                                      ctx, pool);

            if (!err.IsNoError)
            {
                throw new SvnException(err);
            }
            Debug.WriteLine(String.Format("Done({0})", rev));
            return(rev);
        }
        public static int Switch(SvnPath path, SvnUrl url,
                                 SvnOptRevision revision,
                                 bool recurse, SvnClientContext ctx, AprPool pool)
        {
            int rev;

            Debug.Write(String.Format("svn_client_switch({0},{1},{2},{3},{4},{5})...", path, url, revision, recurse, ctx, pool));
            SvnError err = Svn.svn_client_switch(out rev, path, url,
                                                 revision,
                                                 (recurse ? 1 :0), ctx, pool);

            if (!err.IsNoError)
            {
                throw new SvnException(err);
            }
            Debug.WriteLine(String.Format("Done({0})", rev));
            return(rev);
        }
 public SvnNullReferenceException(SvnError error)
     : base(error)
 {
     error.Clear();
 }
 public SvnNullReferenceException(SvnError error, Exception innerException)
     : base(error, innerException)
 {
     error.Clear();
 }
Beispiel #33
0
 public SvnException(SvnError error, Exception innerException)
     : base(error.Message.ToString(), innerException)
 {
     HResult = unchecked (Result + error.AprErr);
     error.Clear();
 }
Beispiel #34
0
 public static SvnError Create(int aprErr, SvnError err, string str)
 {
     return(new SvnError(Svn.svn_error_create(aprErr, new IntPtr(err.mError), str)));
 }