Exemplo n.º 1
0
		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;
			}
		}
Exemplo n.º 2
0
		/// http://o2platform.wordpress.com/category/github/
		public string GitOutput(Entry entry)
		{
			var git = new Git(new FileRepository(ToGitDirString(entry.Local)));
			//var git = Git.Open(testRepository);
//			var repository = git.GetRepository();
			var stringWriter = new StringWriter();
			var textMonitor = new  TextProgressMonitor(stringWriter);

			var pullCommand= git.Pull();
			pullCommand.SetProgressMonitor(textMonitor);
			var pullResponse = pullCommand.Call();
			return stringWriter.ToString() + " \n\n.........\n\n " + pullResponse.ToString();
		}