/// <summary> /// Tries the clone repository. /// </summary> /// <param name="repoUrl">The repo URL.</param> /// <param name="outDir">The out dir.</param> /// <param name="handler">The handler.</param> /// <param name="clonedRepoPath">The cloned repo path.</param> /// <returns></returns> public bool TryCloneRepository(string repoUrl, string outDir, CloneProgressHandler handler, out string clonedRepoPath) { _onProgress = handler; _logger.LogInfo("Cloning repository is in progress. It may take awhile..."); clonedRepoPath = null; CloneOptions options = new CloneOptions(); options.OnTransferProgress += OnTransferProgress; try { clonedRepoPath = Repository.Clone(repoUrl, outDir, options); } catch (Exception ex) { _logger.LogError(); _logger.LogError($"Error cloning repository: {ex.Message}"); return(false); } _logger.LogInfo(); _logger.LogInfo("Cloning repository is completed."); return(true); }
/// <summary> /// Clones the repository from specified URL to specified destination folder. /// </summary> /// <param name="url">The URL.</param> /// <param name="dest">The dest.</param> /// <param name="handler">The handler.</param> /// <returns></returns> public string Clone(string url, string dest, CloneProgressHandler handler) { _onProgress = handler; CloneOptions options = new CloneOptions(); options.OnTransferProgress += OnTransferProgress; return(Repository.Clone(url, dest, options)); }