예제 #1
0
        public void EndTransaction()
        {
            var transactionMessage = string.Join(Environment.NewLine, this.transactionMessageList);
            var messagePath        = FileUtility.WriteAllText(transactionMessage, Encoding.UTF8, PathUtility.GetTempFileName());

            try
            {
                var items = this.statCommand.ReadLines(true);
                if (items.Length != 0)
                {
                    var propText      = SvnRepositoryProvider.GeneratePropertiesArgument(this.transactionPropertyList.ToArray());
                    var updateCommand = new SvnCommand("update")
                    {
                        (SvnPath)this.BasePath
                    };
                    var commitCommand = new SvnCommand("commit")
                    {
                        (SvnPath)this.BasePath,
                        SvnCommandItem.FromFile(messagePath),
                        propText,
                        SvnCommandItem.FromEncoding(Encoding.UTF8),
                        SvnCommandItem.FromUsername(this.transactionAuthor),
                    };
                    updateCommand.Run(this.logService);
                    commitCommand.Run(this.logService);
                    FileUtility.Delete(this.transactionPatchPath);
                    this.transactionAuthor       = null;
                    this.transactionName         = null;
                    this.transactionMessageList  = null;
                    this.transactionPropertyList = null;
                    this.transactionPatchPath    = null;
                }
                else
                {
                    this.logService?.Debug("repository has no changes.");
                }
            }
            finally
            {
                FileUtility.Delete(messagePath);
            }
        }