예제 #1
0
        public void MakeClone(IProgress progress)
        {
            var chorusHubServerInfo = ChorusHubServerInfo.FindServerInformation();

            if (chorusHubServerInfo == null)
            {
                progress.WriteError(LocalizationManager.GetString("Messages.ChorusServerNA", "The Chorus Server is not available."));
                CloneSucceeded = false;
                return;
            }
            if (!chorusHubServerInfo.ServerIsCompatibleWithThisClient)
            {
                progress.WriteError(LocalizationManager.GetString("Messages.ChorusServerIncompatible", "The Chorus Server is not compatible with ths client."));
                CloneSucceeded = false;
                return;
            }

            var targetFolder = Path.Combine(_baseFolder, RepositoryName);

            try
            {
                var client = new ChorusHubClient(chorusHubServerInfo);
                NewlyClonedFolder = HgRepository.Clone(new ChorusHubRepositorySource(RepositoryName, client.GetUrl(RepositoryName), false, HubRepositoryInformation), targetFolder, progress);
                CloneSucceeded    = true;
            }
            catch (Exception)
            {
                NewlyClonedFolder = null;
                CloneSucceeded    = false;
                throw;
            }
        }
예제 #2
0
        public virtual void DoClone()
        {
            //review: do we need to get these out of the DoWorkEventArgs instead?
            var actualCloneLocation = HgRepository.Clone(CreateRepositoryAddress(URL), TargetDestination, _progress);

            LocalFolderName = Path.GetFileName(actualCloneLocation.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar));
        }
예제 #3
0
 public void Clone_Test()
 {
     // RobustNetworkOperation.ClearCredentialSettings();
     using (var f = new TemporaryFolder("clonetest"))
     {
         HgRepository.Clone(new HttpRepositoryPath("cloneableTestProjectUrl", _cloneableTestProjectUrl, false), f.Path, _progress);
         Assert.IsTrue(Directory.Exists(f.Combine(f.Path, ".hg")));
     }
 }
예제 #4
0
        public void DoClone()
        {
            try
            {
                //review: do we need to get these out of the DoWorkEventArgs instead?
                var actualCloneLocation = HgRepository.Clone(new HttpRepositoryPath(URL, URL, false), TargetDestination, _progress);
                LocalFolderName = Path.GetFileName(actualCloneLocation.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar));
                using (SoundPlayer player = new SoundPlayer(Properties.Resources.finishedSound))
                {
                    player.PlaySync();
                }
            }

            catch (Exception error)
            {
                using (SoundPlayer player = new SoundPlayer(Properties.Resources.errorSound))
                {
                    player.PlaySync();
                }
                if (error is RepositoryAuthorizationException)
                {
                    _progress.WriteError(LocalizationManager.GetString("Messages.ServerRejectedLogon", "The server {0} did not accept the reqest of {1} to clone from {2} using password {3}."), SelectedServerPath, AccountName, ProjectId, Password);
                    ErrorReport.NotifyUserOfProblem(LocalizationManager.GetString("Messages.RejectedLogonDetails", "The server ({0}) rejected the project name ({1}), user name ({2}), or password ({3}) (sorry, it didn't tell us which one). Make sure that each of these is correct, and that '{2}' is a member of the '{1}' project, with permission to read data."),
                                                    SelectedServerPath, ProjectId, AccountName, Password);
                }

                else if (error is HgCommonException)
                {
                    _progress.WriteError(error.Message);
                    ErrorReport.NotifyUserOfProblem(error.Message);
                }
                else if (error is UserCancelledException)
                {
                    _progress.WriteMessage(error.Message);
                }
                else
                {
                    _progress.WriteError(error.Message);
                }
            }
        }
예제 #5
0
        public void Utf8ExtensionPresent_CloneDoesNotHaveBogusFiles()
        {
            using (var setup = new RepositorySetup("Dan"))
            {
                const string utf8FilePath = "açesbsun.wav";
                setup.ChangeFile(utf8FilePath, "hello1");
                setup.ProjectFolderConfig.IncludePatterns.Add("*.wav");
                setup.AddAndCheckIn();

                using (var other = new RepositorySetup("Bob", false))
                {
                    //var uri = new Uri(String.Format("file:///{0}", setup.ProjectFolder.Path));
                    HgRepository.Clone(new DirectoryRepositorySource("utf test repo", setup.ProjectFolder.Path, false), other.ProjectFolder.Path, other.Progress);
                    other.Repository.Update();

                    other.AssertFileExists(utf8FilePath);
                    string[] fileNames = Directory.GetFiles(other.ProjectFolder.Path, "*.wav");
                    Assert.AreEqual(1, fileNames.Length);
                }
            }
        }
예제 #6
0
        public void HgExecutableClonesRepository()
        {
            const string expectedId = "e2ff43634d31a70383142a4b3940baff8b6386ee";
            const string source     = "https://[email protected]/kudutest/hellomercurial";

            // Arrange
            using (TestRepository testRepository = GetRepository(source))
            {
                string helloTextPath = Path.Combine(testRepository.PhysicalPath, "Hello.txt");
                string hgFolderPath  = Path.Combine(testRepository.PhysicalPath, ".hg");
                var    hgRepo        = new HgRepository(testRepository.PhysicalPath, "", new MockDeploymentSettingsManager(), NullTracerFactory.Instance);

                // Act
                hgRepo.Clone(source);
                string actualId = hgRepo.CurrentId;

                // Assert
                Assert.True(File.Exists(helloTextPath));
                Assert.True(Directory.Exists(hgFolderPath));
                Assert.Equal(expectedId, actualId);
            }
        }