diff --git a/README.md b/README.md index 551cb44..86488ad 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,8 @@ Install: ``` dotnet tool install -g dotnet-guit -``` +```guit +gui Update: diff --git a/src/Guit.Core/GitRepository.cs b/src/Guit.Core/GitRepository.cs index d01bffb..43c1bf2 100644 --- a/src/Guit.Core/GitRepository.cs +++ b/src/Guit.Core/GitRepository.cs @@ -9,6 +9,7 @@ using System.Diagnostics; using LibGit2Sharp; + namespace Guit { public class GitRepository : IGitRepository @@ -60,16 +61,19 @@ public GitRepository(IRepository repository) public StashCollection Stashes => repository.Stashes; + /// public string GetFullPath(string filePath) => Path.IsPathRooted(filePath) ? Path.GetFullPath(filePath) : Path.GetFullPath(Path.Combine(repository.Info.WorkingDirectory, filePath)); + //// public void RevertFileChanges(params string[] filePaths) => repository.CheckoutPaths( repository.Head.FriendlyName, filePaths, new CheckoutOptions { CheckoutModifiers = CheckoutModifiers.Force }); + /// public IEnumerable GetBranchNames() => repository .Branches @@ -77,17 +81,25 @@ public IEnumerable GetBranchNames() => .Distinct() .OrderBy(x => x); + /// public IEnumerable GetRemoteNames() => repository .Network - .Remotes + .Remotes //repositories that aren't local .Select(x => x.Name) .Distinct() .OrderBy(x => x); + /// public string GetDefaultRemoteName(string defaultRemoteName = "origin") => GetRemoteNames().Contains(defaultRemoteName) ? defaultRemoteName : GetRemoteNames().FirstOrDefault(); + /// + /// + /// Not quite sure, but updates the submodules. Goes through everything(?) and pushes any chages? + /// + /// + /// public void UpdateSubmodules(bool recursive = true, IEventStream? eventStream = null) { foreach (var submodule in repository.Submodules) @@ -111,18 +123,28 @@ public void UpdateSubmodules(bool recursive = true, IEventStream? eventStream = } } + /// public void Fetch(CredentialsHandler credentials, IEventStream? eventStream = null, bool prune = false) => Fetch(repository.Network.Remotes, credentials, eventStream, prune); + /// public void Fetch(string remoteName, CredentialsHandler credentials, IEventStream? eventStream = null, bool prune = false) { if (repository.Network.Remotes.FirstOrDefault(x => x.Name == remoteName) is Remote remote) Fetch(remote, credentials, eventStream, prune); } + /// public void Fetch(Remote remote, CredentialsHandler credentials, IEventStream? eventStream = null, bool prune = false) => Fetch(new Remote[] { remote }, credentials, eventStream, prune); - + + /// + /// The fetch all the other fetches are based on. + /// + /// + /// + /// + /// public void Fetch(IEnumerable remotes, CredentialsHandler credentials, IEventStream? eventStream = null, bool prune = false) { foreach (var remote in remotes) @@ -148,18 +170,30 @@ public void Fetch(IEnumerable remotes, CredentialsHandler credentials, I } } + /// public Branch CreateBranch(string branchName) => RepositoryExtensions.CreateBranch(repository, branchName); + /// public void Checkout(Branch branch) => Git.Checkout(repository, branch); - + + /// public void Stage(string filepath) => Git.Stage(repository, filepath); + /// public void Remove(string filepath) => Git.Remove(repository, filepath); - + + /// + /// gets a list of commits that havent been rebased to the branch. + /// I'm not sure exactl what that means. + /// + /// + /// + /// IEnumerable of commits that haven't been rebased. + /// public IEnumerable GetCommitsToBeRebased(Branch branch) { foreach (var commit in repository.Commits) @@ -170,7 +204,13 @@ public IEnumerable GetCommitsToBeRebased(Branch branch) break; } } - + /// + /// Gets the URL of the repository. + /// Not sure it it's the local rep or the repo online, or what. + /// + /// + /// String of repository URL + /// public string GetRepoUrl() { var repoUrl = repository.Config.GetValueOrDefault("remote.origin.url"); @@ -180,72 +220,107 @@ public string GetRepoUrl() return repoUrl; } + /// + /// Not sure. Does it just open a url of where that commit is? + /// + /// public void OpenUrl(Commit commit) => Process.Start("cmd", $"/c start {GetRepoUrl()}/commit/{commit.Sha}"); + /// public void Checkout(Tree tree, IEnumerable paths, CheckoutOptions opts) => repository.Checkout(tree, paths, opts); + /// public void CheckoutPaths(string committishOrBranchSpec, IEnumerable paths, CheckoutOptions checkoutOptions) => repository.CheckoutPaths(committishOrBranchSpec, paths, checkoutOptions); - + + /// public GitObject Lookup(ObjectId id) => repository.Lookup(id); + /// public GitObject Lookup(string objectish) => repository.Lookup(objectish); + /// public GitObject Lookup(ObjectId id, ObjectType type) => repository.Lookup(id, type); + /// public GitObject Lookup(string objectish, ObjectType type) => repository.Lookup(objectish, type); + /// public Commit Commit(string message, Signature author, Signature committer, CommitOptions options) => repository.Commit(message, author, committer, options); - + + /// public void Reset(ResetMode resetMode, Commit commit) => repository.Reset(resetMode, commit); + /// public void Reset(ResetMode resetMode, Commit commit, CheckoutOptions options) => repository.Reset(resetMode, commit, options); + /// public void RemoveUntrackedFiles() => repository.RemoveUntrackedFiles(); + /// public RevertResult Revert(Commit commit, Signature reverter, RevertOptions options) => repository.Revert(commit, reverter, options); + /// public MergeResult Merge(Commit commit, Signature merger, MergeOptions options) => repository.Merge(commit, merger, options); + /// public MergeResult Merge(Branch branch, Signature merger, MergeOptions options) => repository.Merge(branch, merger, options); - + + /// public MergeResult Merge(string committish, Signature merger, MergeOptions options) => repository.Merge(committish, merger, options); + /// public MergeResult MergeFetchedRefs(Signature merger, MergeOptions options) => repository.MergeFetchedRefs(merger, options); + /// public CherryPickResult CherryPick(Commit commit, Signature committer, CherryPickOptions options) => repository.CherryPick(commit, committer, options); + /// public BlameHunkCollection Blame(string path, BlameOptions options) => repository.Blame(path, options); + /// public FileStatus RetrieveStatus(string filePath) => repository.RetrieveStatus(filePath); + /// public RepositoryStatus RetrieveStatus(StatusOptions options) => repository.RetrieveStatus(options); - + /// public string Describe(Commit commit, DescribeOptions options) => repository.Describe(commit, options); + /// + /// Parses out a revision? + /// + /// Not sure what a SHA-1 is. + /// + /// + /// + /// public void RevParse(string revision, out Reference reference, out GitObject obj) => repository.RevParse(revision, out reference, out obj); + /// + /// + /// So, when there is an unmanaged resource found, Dispose() gits rid of it in some way. + /// public void Dispose() => repository.Dispose(); } diff --git a/src/Guit/Guit.csproj b/src/Guit/Guit.csproj index d8bfd9e..8be0df5 100644 --- a/src/Guit/Guit.csproj +++ b/src/Guit/Guit.csproj @@ -18,6 +18,7 @@ false + true