Exemplo n.º 1
0
 public HashSet <T> CherryPick(string id)
 {
     if (!Commits.ContainsKey(id))
     {
         throw new KeyNotFoundException();
     }
     return(Commits[id].HashSet);
 }
Exemplo n.º 2
0
        public Log Log(string id)
        {
            if (!Commits.ContainsKey(id))
            {
                throw new KeyNotFoundException();
            }
            var commit = Commits[id];

            return(new Log(id, commit.Message));
        }
Exemplo n.º 3
0
 public void Checkout(string id)
 {
     if (!Commits.ContainsKey(id))
     {
         throw new KeyNotFoundException();
     }
     Clear();
     foreach (var commit in Commits[id].HashSet)
     {
         Add(commit);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Разрешает коммит по имени или по псевдониму
        /// </summary>
        /// <param name="hashOrAlias"></param>
        /// <returns></returns>
        public Commit Resolve(string hashOrAlias)
        {
            var hash = hashOrAlias;

            if (Aliases.ContainsKey(hashOrAlias))
            {
                hash = Aliases[hashOrAlias];
            }
            if (Commits.ContainsKey(hash))
            {
                return(Commits[hash]);
            }
            return(null);
        }
Exemplo n.º 5
0
        private void AddCommits(IEnumerable <GitCommit> commits)
        {
            foreach (var v in commits)
            {
                if (v == null)
                {
                    return;
                }

                if (Commits.ContainsKey(v.Id))
                {
                    return;
                }

                Commits.Add(v.Id, new GitCommitInfo(v.Id, Repository));
            }
        }