public List<Entities.RevisionRange> Execute(Entities.Branch source, Entities.Branch target) { Dictionary<string, string> settings = settingsBLL.Get(); string userName = SettingsHelper.ValidateUsername(settings); string password = SettingsHelper.ValidatePassword(settings); List<Entities.RevisionRange> ranges = new List<RevisionRange>(); using (SharpSvn.SvnClient client = BusinessLogic.VersionControl.Svn.ClientHelper.Default()) { client.Authentication.DefaultCredentials = new System.Net.NetworkCredential(userName, password); SharpSvn.SvnUriTarget svnTarget = new SharpSvn.SvnUriTarget(target.Url); SharpSvn.SvnUriTarget svnSource = new SharpSvn.SvnUriTarget(source.Url); Collection<SharpSvn.SvnMergesEligibleEventArgs> eligible; client.GetMergesEligible(svnTarget, svnSource, out eligible); foreach (var item in eligible.Where(x => !x.NotInheritable)) { var range = item.AsRange(); ranges.Add(new RevisionRange { StartRevision = range.StartRevision.Revision.ToString(), EndRevision = range.EndRevision.Revision.ToString() }); } } return ranges; }
public SvnClient(string repository, string path, string user, string password, string email) { Url = new SharpSvn.SvnUriTarget(repository); ParentDir = path; User = user; Password = password; Email = email; Client = new SharpSvn.SvnClient(); Client.Authentication.DefaultCredentials = new NetworkCredential(User, Password); }
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; }
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); } } }
private void GetLinkedFiles(string pathToAppDir) { SharpSvn.SvnClient client = new SharpSvn.SvnClient(); client.Authentication.Clear(); for (int i = 0; i < dgvFilesToImport.Rows.Count; i++) { //Relative || Link// string fileRelativePath = dgvFilesToImport.Rows[i].Cells["relativePath"].Value.ToString(); string fileLink = dgvFilesToImport.Rows[i].Cells["fileLink"].Value.ToString(); SharpSvn.SvnUriTarget target = new SharpSvn.SvnUriTarget(dgvFilesToImport.Rows[i].Cells["fileLink"].Value.ToString()); Directory.CreateDirectory(pathToAppDir + @"\" + dgvFilesToImport.Rows[i].Cells["relativePath"].Value.ToString()); try { SharpSvn.SvnExportArgs svnExportArgs = new SharpSvn.SvnExportArgs(); svnExportArgs.Overwrite = true; client.Export(target, pathToAppDir + @"\" + dgvFilesToImport.Rows[i].Cells["relativePath"].Value.ToString() + @"\" + Path.GetFileName(dgvFilesToImport.Rows[i].Cells["fileLink"].Value.ToString()), svnExportArgs); } catch (Exception ex) { FrontendUtils.LogError(ex.Message, ex); } } }