Exemplo n.º 1
0
        public ITask UpdateGitAheadBehindStatus()
        {
            ConfigBranch?configBranch;
            ConfigRemote?configRemote;

            GetCurrentBranchAndRemote(out configBranch, out configRemote);

            var updateTask = new ActionTask <GitAheadBehindStatus>(token, (success, status) =>
            {
                if (success)
                {
                    GitAheadBehindStatusUpdated?.Invoke(status);
                }
            });

            if (configBranch.HasValue && configBranch.Value.Remote.HasValue)
            {
                var name         = configBranch.Value.Name;
                var trackingName = configBranch.Value.IsTracking ? configBranch.Value.Remote.Value.Name + "/" + configBranch.Value.TrackingBranch : "[None]";

                var task = GitClient.AheadBehindStatus(name, trackingName)
                           .Then(updateTask);
                return(HookupHandlers(task, false));
            }
            else
            {
                updateTask.PreviousResult = GitAheadBehindStatus.Default;
                return(updateTask);
            }
        }