public void SyncNow_BackupAlreadySetUp_GetsSync() { SyncOptions options = new SyncOptions(); _synchronizer.SyncNow(options); string projectDirOnBackup = Path.Combine(_pathToBackupFolder, "foo project.2"); //_synchronizer.MakeClone(projectDirOnBackup, true); HgHighLevel.MakeCloneFromLocalToLocal(_synchronizer.Repository.PathToRepo, projectDirOnBackup, true, _progress); string contents = File.ReadAllText(Path.Combine(projectDirOnBackup, "foo.txt")); Assert.AreEqual("version one", contents); WriteTestFile("version two"); }
private RepositoryWithFilesSetup(string userName, RepositoryWithFilesSetup cloneFromUser) { Progress = new MultiProgress(new IProgress[] { new ConsoleProgress(), _stringProgress }); RootFolder = new TemporaryFolder("ChorusTest-" + userName + "-" + Guid.NewGuid()); Console.WriteLine("TestRepository Cloned: {0}", RootFolder.Path); string pathToProject = RootFolder.Combine(Path.GetFileName(cloneFromUser.ProjectFolder.Path)); //cloneFromUser.Synchronizer.MakeClone(pathToProject, true); HgHighLevel.MakeCloneFromLocalToLocal(cloneFromUser.Repository.PathToRepo, pathToProject, true, Progress); ProjectFolder = TemporaryFolder.TrackExisting(RootFolder.Combine("foo project")); string pathToOurLiftFile = ProjectFolder.Combine(Path.GetFileName(cloneFromUser.UserFile.Path)); UserFile = TempFile.TrackExisting(pathToOurLiftFile); Init(userName); }
/// <summary> /// used for local sources (usb, sd media, etc) /// </summary> /// <returns>the uri of a successful clone</returns> private string TryToMakeCloneForSource(RepositoryAddress repoDescriptor) { List <string> possibleRepoCloneUris = repoDescriptor.GetPossibleCloneUris(Repository.Identifier, RepoProjectName, _progress); if (possibleRepoCloneUris == null) { _progress.WriteMessage("No Uris available for cloning to {0}", repoDescriptor.Name); return(null); } else { foreach (string uri in possibleRepoCloneUris) { // target may be uri, or some other folder. var target = HgRepository.GetUniqueFolderPath( _progress, //"Folder at {0} already exists, so it can't be used. Creating clone in {1}, instead.", RepositoryAddress.DuplicateWarningMessage.Replace(RepositoryAddress.MediumVariable, "USB flash drive"), uri); try { _progress.WriteMessage("Copying repository to {0}...", repoDescriptor.GetFullName(target)); _progress.WriteVerbose("({0})", target); return(HgHighLevel.MakeCloneFromLocalToLocal(_localRepositoryPath, target, false, // No update on USB or shared network clones as of 16 Jan 2012. _progress)); } catch (Exception error) { _progress.WriteError("Could not create repository on {0}. Error follow:", target); _progress.WriteException(error); // keep looping } } } return(null); }
private void MakeClone(string pathToNewRepo) { HgHighLevel.MakeCloneFromLocalToLocal(ProjectFolder.Path, pathToNewRepo, true, Progress); }