コード例 #1
0
 public void HasNoExtantRepositories()
 {
     using (var hasProject = new TemporaryFolder("hasRepo"))
     {
         var newFile = Path.Combine(hasProject.Path, "test.txt");
         File.WriteAllText(newFile, "some stuff");
         Assert.AreEqual(0, GetSharedProjectModel.ExtantRepoIdentifiers(hasProject.Path, null).Count);
     }
 }
コード例 #2
0
        public void HasExtantRepositories()
        {
            using (var parentFolder = new TemporaryFolder("parentFolder"))
                using (var childFolder = new TemporaryFolder(parentFolder, "childFolder"))
                {
                    var newFile = Path.Combine(childFolder.Path, "test.txt");
                    File.WriteAllText(newFile, "some stuff");
                    var repo = new HgRepository(childFolder.Path, new NullProgress());
                    repo.Init();
                    repo.AddAndCheckinFile(newFile);

                    var extantRepoIdentifiers = GetSharedProjectModel.ExtantRepoIdentifiers(parentFolder.Path, null);
                    Assert.AreEqual(1, extantRepoIdentifiers.Count);
                    Assert.IsTrue(extantRepoIdentifiers.ContainsKey(repo.Identifier));
                    Assert.That(extantRepoIdentifiers[repo.Identifier], Is.EqualTo("childFolder"));
                }
        }
コード例 #3
0
        public void ExtantRepositories_FindsRepoInOtherRepoLocation()
        {
            using (var parentFolder = new TemporaryFolder("parentFolder"))
                using (var childFolder = new TemporaryFolder(parentFolder, "childFolder"))
                    using (var otherFolder = new TemporaryFolder(childFolder, "otherRepositories"))
                        using (var repoFolder = new TemporaryFolder(otherFolder, "LIFT"))
                        {
                            var newFile = Path.Combine(repoFolder.Path, "test.txt");
                            File.WriteAllText(newFile, "some stuff");
                            var repo = new HgRepository(childFolder.Path, new NullProgress());
                            repo.Init();
                            repo.AddAndCheckinFile(newFile);

                            var extantRepoIdentifiers = GetSharedProjectModel.ExtantRepoIdentifiers(parentFolder.Path, "otherRepositories");
                            Assert.AreEqual(1, extantRepoIdentifiers.Count);
                            Assert.That(extantRepoIdentifiers, Does.ContainKey(repo.Identifier));
                            Assert.That(extantRepoIdentifiers[repo.Identifier], Is.EqualTo("childFolder"));
                        }
        }
コード例 #4
0
        private void OnGetFromChorusHub(object sender, EventArgs e)
        {
            if (!Directory.Exists(Project.WeSayWordsProject.NewProjectDirectory))
            {
                //e.g. mydocuments/wesay
                Directory.CreateDirectory(Project.WeSayWordsProject.NewProjectDirectory);
            }
            var existingProjectNames = new HashSet <string>(from dir in Directory.GetDirectories(Project.WeSayWordsProject.NewProjectDirectory) select Path.GetFileName(dir));
            Dictionary <string, string> existingRepositories;

            try
            {
                existingRepositories = GetSharedProjectModel.ExtantRepoIdentifiers(Project.WeSayWordsProject.NewProjectDirectory, "");
            }
            catch
            {
                existingRepositories = new Dictionary <string, string>();
            }
            var getCloneFromChorusHubModel = new GetCloneFromChorusHubModel(Project.WeSayWordsProject.NewProjectDirectory)
            {
                ProjectFilter    = "*.lift",
                ExistingProjects = existingProjectNames,
                ExistingRepositoryIdentifiers = existingRepositories
            };

            using (var dlg = new Chorus.UI.Clone.GetCloneFromChorusHubDialog(getCloneFromChorusHubModel))
            {
                if (DialogResult.Cancel == dlg.ShowDialog())
                {
                    return;
                }
                OpenSpecifiedProject(dlg.PathToNewlyClonedFolder, true);
                if (Project.WeSayWordsProject.ProjectExists)
                {
                    Project.WeSayWordsProject.Project.SetupUserForChorus();
                }
            }
        }