public void Synchronizer_HandlesBothDefaultBranchOptions() { // Revisions can come in with both default or empty string on the default branch depending on OS string savedSettings = ""; var rev1 = new Revision(null, "default", "Fred", "1234", "hash1234", "change something"); // The first revision we see on another branch doesn't produce a warning...it might be something old everyone has upgraded from. var revs = new[] { rev1 }; Assert.That(LiftSynchronizerAdjunct.GetRepositoryBranchCheckData(revs, "", ref savedSettings), Is.Null); var rev2 = new Revision(null, "", "Joe", "1235", "hash1235", "change something else"); // To get the right result this time, the list of revisions must include both branches we are pretending are in the repo. revs = new[] { rev1, rev2 }; Assert.That(LiftSynchronizerAdjunct.GetRepositoryBranchCheckData(revs, "default", ref savedSettings), Is.Null); // first change we've seen on this branch var rev3 = new Revision(null, "default", "Fred", "1236", "hash1236", "Fred's second change"); revs = new[] { rev2, rev3 }; Assert.That(LiftSynchronizerAdjunct.GetRepositoryBranchCheckData(revs, "default", ref savedSettings), Is.Null); var rev4 = new Revision(null, "", "Joe", "1236", "hash1237", "Joe's second change"); revs = new[] { rev3, rev4 }; Assert.That(LiftSynchronizerAdjunct.GetRepositoryBranchCheckData(revs, "", ref savedSettings), Is.Null); }
/// <summary> /// Maybe let the user know about the need to update, or that other team members are still using an older version. /// </summary> public void CheckRepositoryBranches(IEnumerable <Revision> branches, IProgress progress) { var savedSettings = Settings.Default.OtherBranchRevisions; var conflictingUser = LiftSynchronizerAdjunct.GetRepositoryBranchCheckData(branches, BranchName, ref savedSettings); Settings.Default.OtherBranchRevisions = savedSettings; Settings.Default.Save(); if (!string.IsNullOrEmpty(conflictingUser)) { progress.WriteWarning(string.Format(Resources.ksOtherRevisionWarning, conflictingUser)); } }
public void Synchronizer_DoesNotReportOldChangeOnOtherBranch() { string savedSettings = ""; var rev1 = new Revision(null, "default", "Fred", "1234", "hash1234", "change something"); // The first revision we see on another branch doesn't produce a warning...it might be something old everyone has upgraded from. var revs = new[] { rev1 }; Assert.That(LiftSynchronizerAdjunct.GetRepositoryBranchCheckData(revs, "7.2.1", ref savedSettings), Is.Null); //Assert.That(savedSettings, Is.EqualTo("default:1234")); // Don't really care what is here as long as it works var rev2 = new Revision(null, "default", "Fred", "1234", "hash1234", "change something else"); revs = new[] { rev2 }; Assert.That(LiftSynchronizerAdjunct.GetRepositoryBranchCheckData(revs, "7.2.1", ref savedSettings), Is.Null); }
public void SynchronizerWithOnlyCurrentBranchRevision_ReportsNothing() { var rev1 = new Revision(null, "default", "Fred", "1234", "hash1234", "change something"); var revs = new[] { rev1 }; string savedSettings = ""; Assert.That(LiftSynchronizerAdjunct.GetRepositoryBranchCheckData(revs, "default", ref savedSettings), Is.Null); Assert.That(savedSettings, Is.EqualTo("")); // Even if we have remembered a previous revision on our own branch, we don't report problems on the current branch. var rev2 = new Revision(null, "default", "Fred", "1235", "hash1234", "change something else"); revs = new[] { rev2 }; savedSettings = "default"; Assert.That(LiftSynchronizerAdjunct.GetRepositoryBranchCheckData(revs, "default", ref savedSettings), Is.Null); Assert.That(savedSettings, Is.EqualTo("")); // still no revs on other branches to save. }