Exemple #1
0
        private void PullOriginHead()
        {
            using Repository repo = new Repository(Environment.CurrentDirectory);
            string currentHead = repo.Head.FriendlyName;

            GitUtils.PerformPull(currentHead);
            GitUtils.ShowLatestCommit(repo);
        }
Exemple #2
0
        public void RunShortcut(string action)
        {
            GitUtils.CheckIfRepository();
            using Repository repo = new Repository(Environment.CurrentDirectory);

            Branch branch;

            try
            {
                branch = repo.Branches.First(b => !b.IsRemote && IsRequiredBranch(action, b));
            }
            catch (Exception e)
            {
                if (e is InvalidOperationException)
                {
                    branch = null;
                }
                else
                {
                    throw;
                }
            }

            if (branch == null)
            {
                Log.Error("No such branch found.");
                return;
            }

            GitUtils.CheckOutBranch(repo, branch);
            GitUtils.ShowLatestCommit(repo);

            if (Args.Length == 1 && Args[0] == "-r")
            {
                GitUtils.PerformPull(branch.FriendlyName);
                GitUtils.ShowLatestCommit(repo);
                return;
            }

            if (Args.Length > 0)
            {
                HandleUnknownParam();
            }
        }