Contains the number of commits a branch is ahead or behind.
        /// <summary>
        /// Determines how many commits the from branch is ahead and/or behind the toBranch.
        /// </summary>
        /// <param name="from">From branch.</param>
        /// <param name="to">To branch.</param>
        /// <returns>A tuple(ahead, behind)</returns>
        public static AheadBehind BranchAheadOrBehind(string from, string to)
        {
            var comparison = new AheadBehind();

            // Gets a list of commits which are in one branch but not the other on separate lines.
            // if the commit is in the left branch but not the right the line start with "<", otherwise ">"
            var status = RunGitCommand("rev-list --left-right " + from + "..." + to, silent: true).Output;

            // Count the number of arrows.
            var lines = status.Split(new[] { "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);
            foreach (var line in lines)
            {
                if (line.StartsWith(">"))
                {
                    // fromBranch is a commit behind the toBranch
                    comparison.Behind++;
                }
                else if (line.StartsWith("<"))
                {
                    // fromBranch has a commit ahead of the toBranch
                    comparison.Ahead++;
                }
            }

            return comparison;
        }
 /// <summary>
 /// Updates the TFS status.
 /// </summary>
 /// <param name="aheadBehind">The ahead behind.</param>
 public void UpdateTfsStatus(AheadBehind aheadBehind)
 {
     Action action = () =>
     {
         var text = string.Format("{0} ahead, {1} behind TFS", aheadBehind.Ahead, aheadBehind.Behind);
         TfsStatusLabel.Content = text;
         TfsStatusLabel.Foreground = aheadBehind.Behind == 0 ? System.Windows.Media.Brushes.DarkGreen : System.Windows.Media.Brushes.DarkRed;
     };
     this.Dispatcher.BeginInvoke(action, DispatcherPriority.ApplicationIdle);
 }