コード例 #1
0
ファイル: Merge.cs プロジェクト: kwmcrell/SourceManager
        public bool Execute(string workingCopyBase,
                            Entities.Branch source,
                            Entities.Branch target,
                            List<Entities.RevisionRange> ranges)
        {
            Dictionary<string, string> settings = settingsBLL.Get();

            string userName = SettingsHelper.ValidateUsername(settings);
            string password = SettingsHelper.ValidatePassword(settings);

            string workingCopyPath = target.Path(workingCopyBase);

            using (SharpSvn.SvnClient client = BusinessLogic.VersionControl.Svn.ClientHelper.Default())
            {
                client.Authentication.DefaultCredentials = new System.Net.NetworkCredential(userName, password);

                SharpSvn.SvnUriTarget svnSource = new SharpSvn.SvnUriTarget(source.Url);
                checkoutBLL.Execute(target, workingCopyBase);
                revertBLL.Execute(target, workingCopyBase);
                updateBLL.Execute(target, workingCopyBase);

                client.Conflict += (object sender, SharpSvn.SvnConflictEventArgs e) =>
                {
                    this.successful = false;
                };

                List<Entities.RevisionRange> conflictedRanges = new List<RevisionRange>();

                SharpSvn.SvnMergeArgs args = new SharpSvn.SvnMergeArgs();

                foreach (var item in ranges.OrderBy(x => x.StartRevision))
                {
                    bool success = client.Merge(workingCopyPath, svnSource, new SharpSvn.SvnRevisionRange(Convert.ToInt64(item.StartRevision), Convert.ToInt64(item.EndRevision)), args);

                    if (!this.successful)
                    {
                        revertBLL.Execute(target, workingCopyBase);
                        break;
                    }
                }
            }

            return successful;
        }
コード例 #2
0
ファイル: Commit.cs プロジェクト: kwmcrell/SourceManager
        public void Execute(string workingCopyBase, Entities.Branch branch, string logMessage)
        {
            Dictionary<string, string> settings = settingsBLL.Get();

            string userName = SettingsHelper.ValidateUsername(settings);
            string password = SettingsHelper.ValidatePassword(settings);

            string workingCopyPath = branch.Path(workingCopyBase);

            using (SharpSvn.SvnClient client = BusinessLogic.VersionControl.Svn.ClientHelper.Default())
            {
                client.Authentication.DefaultCredentials = new System.Net.NetworkCredential(userName, password);

                SharpSvn.SvnCommitArgs args = new SharpSvn.SvnCommitArgs();
                args.LogMessage = logMessage;

                client.Commit(workingCopyPath, args);
            }
        }
コード例 #3
0
ファイル: Checkout.cs プロジェクト: kwmcrell/SourceManager
        public void Execute(Entities.Branch branch, string workingCopyBase)
        {
            Dictionary<string, string> settings = settingsBLL.Get();

            string userName = SettingsHelper.ValidateUsername(settings);
            string password = SettingsHelper.ValidatePassword(settings);

            string workingCopyPath = branch.Path(workingCopyBase);

            if (!System.IO.Directory.Exists(workingCopyPath))
            {
                using (SharpSvn.SvnClient client = BusinessLogic.VersionControl.Svn.ClientHelper.Default())
                {
                    client.Authentication.DefaultCredentials = new System.Net.NetworkCredential(userName, password);

                    SharpSvn.SvnUriTarget repo = new SharpSvn.SvnUriTarget(branch.Url);

                    client.CheckOut(repo, workingCopyPath);
                }
            }
        }
コード例 #4
0
ファイル: Revert.cs プロジェクト: kwmcrell/SourceManager
        public void Execute(Entities.Branch branch, string workingCopyBase)
        {
            Dictionary<string, string> settings = settingsBLL.Get();

            string userName = SettingsHelper.ValidateUsername(settings);
            string password = SettingsHelper.ValidatePassword(settings);

            string workingCopyPath = branch.Path(workingCopyBase);

            if (System.IO.Directory.Exists(workingCopyPath))
            {
                using (SharpSvn.SvnClient client = BusinessLogic.VersionControl.Svn.ClientHelper.Default())
                {
                    client.Authentication.DefaultCredentials = new System.Net.NetworkCredential(userName, password);

                    SharpSvn.SvnRevertArgs args = new SharpSvn.SvnRevertArgs();
                    args.Depth = SharpSvn.SvnDepth.Infinity;

                    client.Revert(workingCopyPath, args);
                }
            }
        }
コード例 #5
0
ファイル: Update.cs プロジェクト: kwmcrell/SourceManager
        public bool Execute(Entities.Branch branch, string workingCopyBase)
        {
            bool updated = false;

            Dictionary<string, string> settings = settingsBLL.Get();

            string userName = SettingsHelper.ValidateUsername(settings);
            string password = SettingsHelper.ValidatePassword(settings);

            string workingCopyPath = branch.Path(workingCopyBase);

            if (System.IO.Directory.Exists(workingCopyPath))
            {
                using (SharpSvn.SvnClient client = BusinessLogic.VersionControl.Svn.ClientHelper.Default())
                {
                    client.Authentication.DefaultCredentials = new System.Net.NetworkCredential(userName, password);

                    updated = client.Update(workingCopyPath);
                }
            }

            return updated;
        }