public Resolve ( string revision ) : ObjectId | ||
revision | string | A git object references expression. |
return | ObjectId |
/// <summary> /// Access a git object by name, id or path. Use the type parameter to tell what kind of object you like to get. Supported types are /// <ul> /// <il><see cref="Blob"/></il> /// <il><see cref="Branch"/></il> /// <il><see cref="GitSharp.Commit"/></il> /// <il><see cref="Leaf"/></il> /// <il><see cref="Tag"/></il> /// <il><see cref="Tree"/></il> /// <il><see cref="AbstractTreeNode"/> - use this if you are not sure about the type of a path (Tree or Leaf)</il> /// <il><see cref="AbstractObject"/> - use this if you are not sure about the type yourself. You will get back an object of the correct type (Blob, Commit, Tag or Tree).</il> /// </ul> /// <para /> /// Branches, Commits or Tags may be accessed by name or reference expression. Currently supported are combinations of these: /// <ul> /// <li>hash - a SHA-1 hash</li> /// <li>refs/... - a ref name</li> /// <li>ref^n - nth parent reference</li> /// <li>ref~n - distance via parent reference</li> /// <li>ref@{n} - nth version of ref</li> /// <li>ref^{tree} - tree references by ref</li> /// <li>ref^{commit} - commit references by ref</li> /// </ul> /// <para /> /// Not supported is /// <ul> /// <li>abbreviated SHA-1</li> /// <li>timestamps in reflogs, ref@{full or relative timestamp}</li> /// </ul> /// <para/> /// Tree or Leaf objects can be addressed by long hash or by their absolute or relative repository path /// </summary> /// <returns></returns> public T Get <T>(string identifier) where T : class { if (typeof(T) == typeof(Blob)) { return(GetBlob(identifier) as T); } if (typeof(T) == typeof(Branch)) { return(GetBranch(identifier) as T); } if (typeof(T) == typeof(Commit)) { return(GetCommit(identifier) as T); } if (typeof(T) == typeof(Leaf)) { return(GetLeaf(identifier) as T); } if (typeof(T) == typeof(Tag)) { return(GetTag(identifier) as T); } if (typeof(T) == typeof(Tree)) { return(GetTree(identifier) as T); } if (typeof(T) == typeof(AbstractTreeNode)) { return(GetTreeNode(identifier) as T); } if (typeof(T) == typeof(AbstractObject)) { return(Get(_internal_repo.Resolve(identifier)) as T); } throw new ArgumentException("Type parameter " + typeof(T).Name + " is not supported by Get<T>!"); }
public void Refresh() { cache.Clear(); if (!string.IsNullOrEmpty(initFolder)) { try { this.repository = Repository.Open(initFolder); if (this.repository != null) { var id = repository.Resolve("HEAD"); var commit = repository.MapCommit(id); this.commitTree = (commit != null ? commit.TreeEntry : new Tree(repository)); this.index = repository.Index; this.index.RereadIfNecessary(); //this.ignoreHandler = new IgnoreHandler(repository); //this.watcher = new FileSystemWatcher(this.repository.WorkingDirectory.FullName); } } catch (Exception ex) { } } }