public NGitPullResultAdapter(PullCommand pullCommand) { var stringWriter = new StringWriter(); var textMonitor = new TextProgressMonitor(stringWriter); pullCommand.SetProgressMonitor(textMonitor); var pullResponse = pullCommand.Call(); Success = pullResponse.IsSuccessful(); var parsed = pullResponse.ToString() .Replace("with base", Environment.NewLine + "with base") .Replace("using", Environment.NewLine + "using"); Msg = stringWriter.ToString() + newLine + " ......... " + newLine + parsed; // string fetchedFrom = pullResponse.GetFetchedFrom(); // Msg += newLine + "fetchedFrom: " + fetchedFrom; FetchResult fetchResult = pullResponse.GetFetchResult(); // // var trackingRefUpdates = fetchResult.GetTrackingRefUpdates (); // foreach (var trackingRefUpdate in trackingRefUpdates) { // var oldObjectId = trackingRefUpdate.GetOldObjectId ().Name; // var newObjectId = trackingRefUpdate.GetNewObjectId ().Name; // Msg += newLine + "Old object id: " + oldObjectId; // Msg += newLine + "New object id: " + newObjectId; // // var refResult = trackingRefUpdate.GetResult (); // Msg += newLine + "refResult: " + refResult; // } var msg = fetchResult.GetMessages(); if (!string.IsNullOrEmpty(msg)) { Msg += newLine + "Result: " + newLine + msg; } }
public NGitPullResultAdapter (PullCommand pullCommand) { var stringWriter = new StringWriter(); var textMonitor = new TextProgressMonitor(stringWriter); pullCommand.SetProgressMonitor(textMonitor); var pullResponse = pullCommand.Call(); Success = pullResponse.IsSuccessful(); var parsed = pullResponse.ToString() .Replace("with base", Environment.NewLine + "with base") .Replace("using", Environment.NewLine + "using"); Msg = stringWriter.ToString() + newLine + " ......... "+ newLine + parsed; // string fetchedFrom = pullResponse.GetFetchedFrom(); // Msg += newLine + "fetchedFrom: " + fetchedFrom; FetchResult fetchResult = pullResponse.GetFetchResult(); // // var trackingRefUpdates = fetchResult.GetTrackingRefUpdates (); // foreach (var trackingRefUpdate in trackingRefUpdates) { // var oldObjectId = trackingRefUpdate.GetOldObjectId ().Name; // var newObjectId = trackingRefUpdate.GetNewObjectId ().Name; // Msg += newLine + "Old object id: " + oldObjectId; // Msg += newLine + "New object id: " + newObjectId; // // var refResult = trackingRefUpdate.GetResult (); // Msg += newLine + "refResult: " + refResult; // } var msg = fetchResult.GetMessages(); if (!string.IsNullOrEmpty(msg)) { Msg += newLine + "Result: " + newLine + msg; } }
/// <summary> /// /// </summary> /// <param name="component"></param> /// <returns></returns> public static string CloneOrCheckOutRepo(AsposeComponent component) { string repUrl = component.get_remoteExamplesRepository(); string localFolder = getLocalRepositoryPath(component); string error = string.Empty; checkAndCreateFolder(getLocalRepositoryPath(component)); try { CloneCommand clone = Git.CloneRepository(); clone.SetURI(repUrl); clone.SetDirectory(localFolder); Git repo = clone.Call(); //writer.Close(); repo.GetRepository().Close(); } catch (Exception ex) { try { var git = Git.Open(localFolder); var repository = git.GetRepository(); PullCommand pullCommand = git.Pull(); pullCommand.Call(); repository.Close(); } catch (Exception ex2) { error = ex2.Message; } error = ex.Message; } return(error); }