当前位置: 首页>>代码示例>>C#>>正文


C# SvnClient类代码示例

本文整理汇总了C#中SvnClient的典型用法代码示例。如果您正苦于以下问题:C# SvnClient类的具体用法?C# SvnClient怎么用?C# SvnClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SvnClient类属于命名空间,在下文中一共展示了SvnClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SyncLocalFolderWithO2XRulesDatabase

        public static void SyncLocalFolderWithO2XRulesDatabase()
        {
            try
            {
                "in SyncLocalFolderWithO2XRulesDatabase".debug();
                //var targetLocalDir = XRules_Config.PathTo_XRulesDatabase_fromO2;
                var targetLocalDir = PublicDI.config.LocalScriptsFolder;
                var o2XRulesSvn = PublicDI.config.SvnO2DatabaseRulesFolder;

                "starting Sync with XRules Database to {0}".info(targetLocalDir);
                using (SvnClient client = new SvnClient())
                {
                    if (targetLocalDir.dirExists().isFalse() || targetLocalDir.pathCombine(".svn").dirExists().isFalse())
                    {
                        "First Sync, so doing an SVN Checkout to: {0}".info(targetLocalDir);
                        Files.deleteFolder(targetLocalDir, true);
                        client.CheckOut(new Uri(o2XRulesSvn), targetLocalDir);
                    }
                    else
                    {
                        "Local XRules folder exists, so doing an SVN Update".info();
                        client.Update(targetLocalDir);
                    }
                    "SVN Sync completed".debug();
                }
            }
            catch (Exception ex)
            {
                ex.log("in SvnApi.SyncLocalFolderWithO2XRulesDatabase");
            }
        }
开发者ID:pusp,项目名称:o2platform,代码行数:31,代码来源:SvnApi.cs

示例2: Search

        public string Search(string path, bool recurseUp, string propName)
        {
            if (!String.IsNullOrEmpty(_base))
                path = Path.Combine(_base, path);

            if (!Directory.Exists(path))
            {
                if (!File.Exists(path))
                    throw new FileNotFoundException(path);
                path = Path.GetDirectoryName(path);
            }

            using (var client = new SvnClient())
            {
                string result;
                Guid guid;
                do
                {
                    client.TryGetProperty(SvnTarget.FromString(path), propName, out result);
                    Debug.Assert(path != null, "path != null");
                    path = Directory.GetParent(path).FullName;
                } while (result == null && recurseUp && client.TryGetRepositoryId(path, out guid));
                return result ?? string.Empty;
            }
        }
开发者ID:brunzefb,项目名称:JiraSVN,代码行数:25,代码来源:SvnProperties.cs

示例3: CheckOut

 /// <summary>
 /// 执行检出操作
 /// </summary>
 /// <param name="repositoryPath">svn服务器路径</param>
 /// <param name="workDirectory">工程本地工作路径</param>
 /// <param name="svnPath">本地svn路径</param>
 /// <param name="checkResult">检出操作的结果</param>
 /// <returns>返回检出操作的日志</returns>
 public string CheckOut(string repositoryPath,string workDirectory,out string checkResult,string xmlConfigPath)
 {
     string err;
     string time;
     XmlDao xmlDao = new XmlDao();
     XmlNodeList xmlNodeList=xmlDao.XmlQuery("config/preferences/SvnPath", xmlConfigPath);
     string svnPath=xmlNodeList[0].InnerText;
     using (SvnClient client = new SvnClient())
     {
         Tools tools = new Tools();
         string checkOutLog = "";
         try
         {
             client.CheckOut(new Uri(repositoryPath), workDirectory);
             string args = "checkout " + repositoryPath + " " + workDirectory;
             checkOutLog = tools.BuildProject(svnPath, args, null, out err, out time);
             checkResult = "successful";
             return checkOutLog;
         }
         catch (Exception ex)
         {
             checkResult = " failed";
             checkOutLog = ex.Message;
             return checkOutLog;
         }
     }
 }
开发者ID:donaldyu,项目名称:luckyci,代码行数:35,代码来源:SvnController.cs

示例4: CheckOut

        public override string CheckOut(IPackageTree packageTree, FileSystemInfo destination)
        {
            SvnUpdateResult result = null;

            using (var client = new SvnClient())
            {
                try
                {
                    var svnOptions = new SvnCheckOutArgs();
                    if (UseRevision.HasValue)
                        svnOptions.Revision = new SvnRevision(UseRevision.Value);
                    client.CheckOut(new SvnUriTarget(new Uri(Url)), destination.FullName, svnOptions, out result);
                }
                catch (SvnRepositoryIOException sre)
                {
                    HandleExceptions(sre);
                }
                catch (SvnObstructedUpdateException sue)
                {
                    HandleExceptions(sue);
                }
            }

            return result.Revision.ToString();
        }
开发者ID:emmekappa,项目名称:horn_src,代码行数:25,代码来源:SvnSourceControl.cs

示例5: ExecuteCommand

        /// <summary>
        /// Actual method to be executed for the implementing task
        /// </summary>
        /// <param name="client">The instance of the SVN client</param>
        /// <returns></returns>
        public override bool ExecuteCommand(SvnClient client)
        {
            SvnRevertArgs args = new SvnRevertArgs();
            args.Depth = Recursive ? SvnDepth.Infinity : SvnDepth.Children;

            return client.Revert(RepositoryPath, args);
        }
开发者ID:trentcioran,项目名称:SvnMSBuildTasks,代码行数:12,代码来源:SvnRevert.cs

示例6: GetSvnLogEntries

        /// <summary>
        /// Gets the svn log entries from the repository.
        /// </summary>
        /// <returns>An IEnumerable of the QvxDataRows.</returns>
        private IEnumerable<QvxDataRow> GetSvnLogEntries()
        {
            QvxLog.Log(QvxLogFacility.Application, QvxLogSeverity.Notice, "GetSvnLogEntries()");

            string username, password, server;
            this.MParameters.TryGetValue("UserId", out username);
            this.MParameters.TryGetValue("Password", out password);
            this.MParameters.TryGetValue("Server", out server);
            System.Net.NetworkCredential creds = new System.Net.NetworkCredential(username, password);

            SvnClient client = new SvnClient();
            client.Authentication.DefaultCredentials = creds;

            SvnUriTarget target = new SvnUriTarget(server);

            Collection<SvnLogEventArgs> logEntries = new Collection<SvnLogEventArgs>();
            bool result = client.GetLog(target.Uri, out logEntries);

            if(!result)
            {
                throw new SvnClientException("Retrieving Subversion log failed");
            }

            foreach(SvnLogEventArgs entry in logEntries)
            {
                yield return MakeEntry(entry, FindTable("SvnLogEntries", MTables));
            }
        }
开发者ID:mlaitinen,项目名称:qvsvnlogconnector,代码行数:32,代码来源:QvSvnLogConnection.cs

示例7: ExecuteSVNTask

        protected override void ExecuteSVNTask(SvnClient client)
        {
            if (Dir == null)
            {
                Dir = new DirectoryInfo(Project.BaseDirectory);
            }

            if (!Dir.Exists)
            {
                throw new BuildException(string.Format(Resources.MissingDirectory, Dir.FullName), Location);
            }

            SVNFunctions svnFunctions = new SVNFunctions(Project, Properties);
            string sourceUri = svnFunctions.GetUriFromPath(Dir.FullName);
            Log(Level.Info, Resources.SVNCopyCopying, sourceUri, SvnUri);

            SvnCopyArgs args = new SvnCopyArgs();
            args.ThrowOnError = true;
            args.LogMessage = Message;

            SvnCommitResult result;
            client.RemoteCopy(SvnTarget.FromString(sourceUri), SvnUri, args, out result);

            if (result != null)
            {
                Log(Level.Info, Resources.SVNCopyResult, Dir.FullName, SvnUri, result.Revision, result.Author);
            }
        }
开发者ID:julienblin,项目名称:NAntConsole,代码行数:28,代码来源:SVNCopyTask.cs

示例8: ExecuteTask

 protected override void ExecuteTask()
 {
     using(SvnClient svnClient = new SvnClient())
     {
         ExecuteSVNTask(svnClient);
     }
 }
开发者ID:julienblin,项目名称:NAntConsole,代码行数:7,代码来源:BaseSVNTask.cs

示例9: ResolveFiles

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public override bool ResolveFiles()
        {
            SvnClient client = new SvnClient();
            SvnInfoArgs infoArgs = new SvnInfoArgs();

            infoArgs.ThrowOnError = false;
            infoArgs.Depth = SvnDepth.Files;

            foreach (SourceFile file in State.SourceFiles.Values)
            {
                if (file.IsResolved)
                    continue;

                string dirName = SvnTools.GetTruePath(SvnTools.GetNormalizedDirectoryName(file.FullName), true);

                client.Info(dirName, infoArgs,
                    delegate(object sender, SvnInfoEventArgs e)
                    {
                        SourceFile infoFile;

                        string path = e.FullPath;

                        if (State.SourceFiles.TryGetValue(path, out infoFile)
                            && !infoFile.IsResolved)
                        {
                            infoFile.SourceReference = new SubversionSourceReference(this, infoFile, e.RepositoryRoot,
                                                                                      e.RepositoryRoot.MakeRelativeUri(e.Uri), e.LastChangeRevision, e.Revision);
                        }
                    });
            }

            return true;
        }
开发者ID:riiiqpl,项目名称:sharpsvn,代码行数:37,代码来源:SubversionResolver.cs

示例10: GetAvailableRevisions

        public override string[] GetAvailableRevisions()
        {
            string url = Url.TrimEnd('/');

              using (SvnClient client = new SvnClient())
              {
              client.LoadConfiguration("path");
              client.Authentication.DefaultCredentials = new NetworkCredential(Login, Password);
              SvnTarget folderTarget = SvnTarget.FromString(url);

              List<String> filesFound = new List<String>();
              Collection<SvnListEventArgs> listResults;

              if (client.GetList(folderTarget, out listResults))
              {
              foreach (SvnListEventArgs item in listResults)
                  if (item.Entry.NodeKind == SvnNodeKind.Directory && !string.IsNullOrEmpty(item.Name))
                      filesFound.Add(item.Name);

              return filesFound.ToArray();
              }
              }

             return new string[0];
        }
开发者ID:jayvin,项目名称:Courier,代码行数:25,代码来源:SubversionRepository.cs

示例11: GetChangeSetFromSvn

        public static FileChanged[] GetChangeSetFromSvn(DateTime startDateTime, DateTime endDateTime, SvnConfig server)
        {
            SvnRevisionRange range = new SvnRevisionRange(new SvnRevision(startDateTime), new SvnRevision(endDateTime));
            Collection<SvnLogEventArgs> logitems;

            var uri = new Uri(server.Url);
            FileChanged[] changed;
            using (SvnClient client = new SvnClient())
            {
                client.Authentication.Clear(); // Disable all use of the authentication area
                client.Authentication.UserNamePasswordHandlers +=
                    delegate(object sender, SvnUserNamePasswordEventArgs e)
                        {
                            e.UserName = server.UserName;
                            e.Password = server.Password;
                            e.Save = true;
                        };
                client.Authentication.SslServerTrustHandlers += delegate(object sender, SvnSslServerTrustEventArgs e)
                    {
                        e.AcceptedFailures = e.Failures;
                        e.Save = true; // Save acceptance to authentication store
                    };
                client.GetLog(uri, new SvnLogArgs(range), out logitems);
                foreach (var svnLogEventArgse in logitems)
                {
                    Console.WriteLine((string) WriteString(svnLogEventArgse));
                }
                changed = logitems.SelectMany<SvnLogEventArgs, FileChanged>(l => GetChangedFiles(l)).ToArray();
            }
            return changed;
        }
开发者ID:TheCodeReport,项目名称:DashBoard,代码行数:31,代码来源:SvnUtils.cs

示例12: Resolve_RepeatedEventHookUp_SOC_411

        public void Resolve_RepeatedEventHookUp_SOC_411()
        {
            SvnSandBox sbox = new SvnSandBox(this);
            Uri projectRoot = new Uri("https://ctf.open.collab.net/svn/repos/sharpsvn/trunk/scripts");

            using (var svnClient = new SvnClient())
            {
                for (int i = 0; i < 3; i++)
                {
                    string workingcopy = sbox.GetTempDir();
                    Directory.CreateDirectory(workingcopy);

                    svnClient.Authentication.UserNamePasswordHandlers += DoNowt;
                    try
                    {
                        SvnUpdateResult svnUpdateResult;
                        SvnCheckOutArgs ca = new SvnCheckOutArgs() { Depth = SvnDepth.Files };
                        Assert.IsTrue(svnClient.CheckOut(projectRoot, workingcopy, ca, out svnUpdateResult));
                        Assert.IsNotNull(svnUpdateResult);
                        Assert.IsTrue(svnUpdateResult.HasRevision);
                    }
                    finally
                    {
                        svnClient.Authentication.UserNamePasswordHandlers -= DoNowt;
                    }
                }
            }
        }
开发者ID:riiiqpl,项目名称:sharpsvn,代码行数:28,代码来源:ResolveTests.cs

示例13: Capabilities_Local

        public void Capabilities_Local()
        {
            SvnSandBox sbox = new SvnSandBox(this);
            Uri emptyUri = sbox.CreateRepository(SandBoxRepository.Empty);
            Uri emptyNoMergeUri = sbox.CreateRepository(SandBoxRepository.EmptyNoMerge);

            using (SvnClient client = new SvnClient())
            {
                Collection<SvnCapability> caps;
                SvnGetCapabilitiesArgs aa = new SvnGetCapabilitiesArgs();
                aa.RetrieveAllCapabilities = true;

                IEnumerable<SvnCapability> rCaps = new SvnCapability[] { SvnCapability.MergeInfo };
                Assert.That(client.GetCapabilities(emptyUri, rCaps, out caps));

                Assert.That(caps.Contains(SvnCapability.MergeInfo));

                Assert.That(client.GetCapabilities(emptyNoMergeUri, rCaps, out caps));

                Assert.That(!caps.Contains(SvnCapability.MergeInfo));
                Assert.That(caps.Count, Is.EqualTo(0));

                Assert.That(client.GetCapabilities(emptyNoMergeUri, aa, out caps));
                Assert.That(caps.Count, Is.GreaterThanOrEqualTo(5));

                Assert.That(client.GetCapabilities(emptyUri, aa, out caps));
                Assert.That(caps.Count, Is.GreaterThanOrEqualTo(6));
            }
        }
开发者ID:riiiqpl,项目名称:sharpsvn,代码行数:29,代码来源:CapabilitiesTests.cs

示例14: RenameProjectFolder

 public void RenameProjectFolder(RenameContext context)
 {
     using(SvnClient svnClient = new SvnClient())
     {
         svnClient.Move(context.OldProject.ProjectDirectory, context.NewProject.ProjectDirectory);
     }
 }
开发者ID:manuelnelson,项目名称:VisualStudioProjectRenamer,代码行数:7,代码来源:SVNRenamer.cs

示例15: IsWorkingCopy

 /// <summary>
 /// Check if the given path is a working copy or not
 /// </summary>
 /// <param name="path">local path to the respository</param>
 /// <returns></returns>
 public static bool IsWorkingCopy(string path)
 {
     using (var client = new SvnClient())
     {
         var uri = client.GetUriFromWorkingCopy(path);
         return uri != null;
     }
 }
开发者ID:sharat,项目名称:SvnChangeSetMaker,代码行数:13,代码来源:SvnChangeSet.cs


注:本文中的SvnClient类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。