コード例 #1
0
ファイル: Synchronizer.cs プロジェクト: JessieGriffin/chorus
 /// <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;
 }
コード例 #2
0
ファイル: Synchronizer.cs プロジェクト: sillsdev/chack
 /// <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.",
                 "Warning: there is a project on the USB flash drive which has the right name ({0}), but it is actually unrelated to the one doing the Send/Receive. This usually indicates that the two repositories were created separately, which doesn't work. These repositories have to be descendants of each other, or else they can't be synchronized. This situation occurs when you create the repositories separately by accident. Instead, create one then use 'Get from USB' or 'Get from Internet' from other programs and computers. You may want to get some expert help."
             + " In the meantime, the program will create a repository at {1} so you can maybe keep collaborating while you wait for help.",
                 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);
                 continue;
             }
         }
     }
     return null;
 }