Improved debug output. Added a todo.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using CommandLine.OptParse;
|
||||
using Sep.Git.Tfs.Util;
|
||||
|
||||
@@ -40,13 +41,35 @@ namespace Sep.Git.Tfs.Commands
|
||||
// I don't know what this is
|
||||
// public int LogWindowSize { get; set; }
|
||||
// public bool NoCheckout { get; set; }
|
||||
|
||||
[OptDef(OptValType.IncrementalFlag)]
|
||||
[ShortOptionName('q')]
|
||||
[LongOptionName("quiet")]
|
||||
|
||||
private int? _debugTraceListener;
|
||||
|
||||
[OptDef(OptValType.Flag)]
|
||||
[ShortOptionName('d')]
|
||||
[LongOptionName("debug")]
|
||||
[UseNameAsLongOption(false)]
|
||||
[Description("Reduce the amount of logged information.")]
|
||||
public int OutputLevel { get; set; }
|
||||
[Description("Show lots of output.")]
|
||||
public bool DebugOutput
|
||||
{
|
||||
get { return _debugTraceListener.HasValue; }
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
if (_debugTraceListener == null)
|
||||
{
|
||||
_debugTraceListener = Trace.Listeners.Add(new ConsoleTraceListener());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_debugTraceListener != null)
|
||||
{
|
||||
Trace.Listeners.RemoveAt(_debugTraceListener.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// I think I'm going to make these the default. I may allow their disablement
|
||||
// later.
|
||||
|
||||
@@ -116,11 +116,19 @@ namespace Sep.Git.Tfs.Core
|
||||
initialize(startInfo);
|
||||
Trace.WriteLine("Starting process: " + startInfo.FileName + " " + startInfo.Arguments, "git command");
|
||||
var process = Process.Start(startInfo);
|
||||
process.ErrorDataReceived += (sender, e) => Trace.WriteLine(e.Data, "git stderr");
|
||||
process.ErrorDataReceived += StdErrReceived;
|
||||
process.BeginErrorReadLine();
|
||||
return process;
|
||||
}
|
||||
|
||||
private void StdErrReceived(object sender, DataReceivedEventArgs e)
|
||||
{
|
||||
if(e.Data != null && e.Data.Trim() != "")
|
||||
{
|
||||
Trace.WriteLine(e.Data.TrimEnd(), "git stderr");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// WrapGitCommandErrors the actions, and if there are any git exceptions, rethrow a new exception with the given message.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using Microsoft.TeamFoundation.Client;
|
||||
@@ -78,6 +79,7 @@ namespace Sep.Git.Tfs.Core
|
||||
|
||||
public IEnumerable<ITfsChangeset> GetChangesets(string path, long startVersion)
|
||||
{
|
||||
Trace.WriteLine("Getting changesets from " + startVersion + " to current ...", "tfs");
|
||||
var changesets = VersionControl.QueryHistory(path, VersionSpec.Latest, 0, RecursionType.Full,
|
||||
null, new ChangesetVersionSpec((int) startVersion), VersionSpec.Latest, int.MaxValue, true,
|
||||
true, true);
|
||||
|
||||
@@ -34,4 +34,7 @@ The commands I plan to implement, in order of priority:
|
||||
migrate ?
|
||||
|
||||
Known bugs:
|
||||
None right now.
|
||||
None right now.
|
||||
|
||||
Potential enhancements:
|
||||
Query history in chunks, either in a background thread or just with 100 changeset chunks, in order to speed up the initial output from a fetch.
|
||||
Reference in New Issue
Block a user