예제 #1
0
        public SvnRepository(ILogService logService, string repositoryPath, string workingPath)
        {
            this.repositoryPath  = repositoryPath;
            this.transactionPath = Path.Combine(workingPath, "transaction");
            this.logService      = logService;

            var items = this.Run("stat", this.repositoryPath.WrapQuot(), "-q").Trim();

            if (items != string.Empty)
            {
                var sb = new StringBuilder();
                sb.AppendLine($"Repository is dirty. Please fix the problem before running the service.");
                sb.AppendLine();
                sb.AppendLine(items);
                throw new Exception($"{sb}");
            }

            this.Run("log", this.repositoryPath.WrapQuot(), "-l 1");

            var info = SvnInfoEventArgs.Run(this.repositoryPath);

            this.repositoryRoot = info.RepositoryRoot;
            var repositoryInfo = SvnInfoEventArgs.Run($"{info.Uri}");

            this.revision = repositoryInfo.Revision;
        }
예제 #2
0
        public long GetRevision(string path)
        {
            var info           = SvnInfoEventArgs.Run(path);
            var repositoryInfo = SvnInfoEventArgs.Run($"{info.Uri}");

            return(repositoryInfo.LastChangeRevision);
        }
예제 #3
0
        public Uri GetUri(string path, long revision)
        {
            var revisionValue = revision == -1 ? this.revision : revision;
            var info          = SvnInfoEventArgs.Run(path, revisionValue);

            return(new Uri($"{info.Uri}@{revisionValue}"));
        }
예제 #4
0
        public void GetBranchInfo(string path, out long revision, out string source, out long sourceRevision)
        {
            var info = SvnInfoEventArgs.Run(path);

            this.GetBranchRevision(info.RepositoryRoot, info.Uri, out revision, out source, out sourceRevision);
        }