[Test]//regression
        public void RepoProjectName_SourceHasDotInName_IsNotLost()
        {
			using (var f = new TemporaryFolder("SourceHasDotInName_IsNotLost.x.y"))
            {
                Synchronizer m = new Synchronizer(f.Path, new ProjectFolderConfiguration("blah"), new ConsoleProgress());

                Assert.AreEqual("SourceHasDotInName_IsNotLost.x.y", m.RepoProjectName);
            }
        }
Esempio n. 2
0
        public void GetAllRevisionss_AfterSyncingTwoTimes_CorrectHistory()
        {
            Synchronizer setup = new Synchronizer(_project.FolderPath, _project, _progress);
            SyncOptions options = new SyncOptions();
            options.DoPullFromOthers = false;
            options.DoMergeWithOthers = false;
            options.CheckinDescription = "first one";
            options.DoSendToOthers = false;

            setup.SyncNow(options);
            File.WriteAllText(_pathToText, "version two of my pretend txt");
            options.CheckinDescription = "second one";
            setup.SyncNow(options);

            List<Revision> items = _repository.GetAllRevisions();
            Assert.AreEqual(2, items.Count);
            Assert.AreEqual("bob", items[0].UserId);
            Assert.AreEqual("second one", items[0].Summary);

            Assert.AreEqual("bob", items[1].UserId);
            Assert.AreEqual("first one", items[1].Summary);
        }
Esempio n. 3
0
        public SyncControlModel(ProjectFolderConfiguration projectFolderConfiguration, 
            SyncUIFeatures uiFeatureFlags,
            IChorusUser user)
        {
            _user = user;
            _progress = new MultiProgress();
            StatusProgress = new SimpleStatusProgress();
            _progress.Add(StatusProgress);
            Features = uiFeatureFlags;
            _synchronizer = Synchronizer.FromProjectConfiguration(projectFolderConfiguration, _progress);
            _backgroundWorker = new BackgroundWorker();
            _backgroundWorker.WorkerSupportsCancellation = true;
            _backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_backgroundWorker_RunWorkerCompleted);
            _backgroundWorker.DoWork += worker_DoWork;

            //clients will normally change these
            SyncOptions = new SyncOptions();
            SyncOptions.CheckinDescription = "[" + Application.ProductName + ": " + Application.ProductVersion + "] sync";
            SyncOptions.DoPullFromOthers = true;
            SyncOptions.DoMergeWithOthers = true;
            SyncOptions.RepositorySourcesToTry.AddRange(GetRepositoriesToList().Where(r => r.Enabled));
        }
        public void Setup()
        {
            _progress = new ConsoleProgress();
            _pathToTestRoot = Path.Combine(Path.GetTempPath(), "ChorusTest");
            if (Directory.Exists(_pathToTestRoot))
                Directory.Delete(_pathToTestRoot, true);
            Directory.CreateDirectory(_pathToTestRoot);

            //nb: the ".2" here is significant; there was an issue where anything after a "." got stripped
            _pathToProjectRoot = Path.Combine(_pathToTestRoot, "foo project.2");
            Directory.CreateDirectory(_pathToProjectRoot);

            string pathToText = WriteTestFile("version one");

            RepositorySetup.MakeRepositoryForTest(_pathToProjectRoot, "bob",_progress);
            _project = new ProjectFolderConfiguration(_pathToProjectRoot);
            _project.IncludePatterns.Add(pathToText);
            _project.FolderPath = _pathToProjectRoot;

            _synchronizer = Synchronizer.FromProjectConfiguration(_project, _progress);
            _pathToBackupFolder = Path.Combine(_pathToTestRoot, "backup");
            Directory.CreateDirectory(_pathToBackupFolder);
            _directorySource = new DirectoryRepositorySource("SD Backup Card", Path.Combine(_pathToBackupFolder,RepositoryAddress.ProjectNameVariable), false);
        }
Esempio n. 5
0
 public SyncResults SyncWithOptions(SyncOptions options, Synchronizer synchronizer)
 {
     return synchronizer.SyncNow(options);
 }
Esempio n. 6
0
 public SyncResults SyncWithOptions(SyncOptions options)
 {
     if (Synchronizer == null)
         Synchronizer = CreateSynchronizer();
     return SyncWithOptions(options, Synchronizer);
 }
Esempio n. 7
0
        /// <summary>
        /// not called "CreateReject*Branch* because we're not naming it (but it is, technically, a branch)
        /// </summary>
        public void CreateRejectForkAndComeBack()
        {
            var originalTip = Repository.GetTip();
            ChangeFile("test.txt", "bad");
            var options = new SyncOptions {DoMergeWithOthers = true, DoPullFromOthers = true, DoSendToOthers = true};
            Synchronizer = CreateSynchronizer();
            Synchronizer.SyncNow(options);
            var badRev = Repository.GetTip();

            //notice that we're putting changeset which does the tagging over on the original branch
            Repository.RollbackWorkingDirectoryToRevision(originalTip.Number.Hash);
            Repository.TagRevision(badRev.Number.Hash, Synchronizer.RejectTagSubstring);// this adds a new changeset
            Synchronizer.SyncNow(options);

            Revision revision = Repository.GetRevisionWorkingSetIsBasedOn();
            revision.EnsureParentRevisionInfo();
            Assert.AreEqual(originalTip.Number.LocalRevisionNumber, revision.Parents[0].LocalRevisionNumber, "Should have moved back to original tip.");
        }
Esempio n. 8
0
 public static void SetAdjunctModelVersion(Synchronizer synchronizer, string branchName)
 {
     synchronizer.SynchronizerAdjunct = new ProgrammableSynchronizerAdjunct(branchName);
 }
Esempio n. 9
0
 public void ChangeTextFile(Synchronizer sync)
 {
     SyncOptions options = new SyncOptions();
     options.CheckinDescription = "a change to foo.abc";
     string bobsFooTextPath = Path.Combine(_lexiconProjectPath, "foo.abc");
     File.WriteAllText(bobsFooTextPath, "version two of my pretend txt");
     sync.SyncNow(options);
 }
Esempio n. 10
0
        public void Setup()
        {
            _progress = new StringBuilderProgress();
            _pathToTestRoot = Path.Combine(Path.GetTempPath(), "ChorusTest");
            Directory.CreateDirectory(_pathToTestRoot);

            string pathToText = Path.Combine(_pathToTestRoot, "foo.txt");
            File.WriteAllText(pathToText, "version one of my pretend txt");

            RepositorySetup.MakeRepositoryForTest(_pathToTestRoot, "bob",_progress);

            _project = new ProjectFolderConfiguration(_pathToTestRoot);
            _project.FolderPath = _pathToTestRoot;
            _project.IncludePatterns.Add(pathToText);
            _project.FolderPath = _pathToTestRoot;

            _synchronizer = Synchronizer.FromProjectConfiguration(_project, new NullProgress());
            _model = new SyncControlModel(_project, SyncUIFeatures.Advanced,null);
            _model.AddMessagesDisplay(_progress);
        }