manipulate and inspect VCS repositories in Go
Branch: master
Clone or download
Pull request Compare This branch is 2 commits behind sourcegraph:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

go-vcs - manipulate and inspect VCS repositories

go-vcs is a library for manipulating and inspecting VCS repositories in Go. It currently supports Git and Mercurial (hg).

Note: the public API is experimental and subject to change until further notice.

Build Status GoDoc

Resolving dependencies

For hg blame, you need to install hglib: pip install python-hglib.


go get -u

Implementation differences

The goal is to have all supported backends at feature parity, but until then, consult this table for implementation differences.

Feature git gitcmd hg hgcmd
vcs.CommitsOptions.Path ⬜️ ⬜️ ⬜️
vcs.BranchesOptions.MergedInto ⬜️ ⬜️ ⬜️
vcs.BranchesOptions.IncludeCommit ⬜️ ⬜️ ⬜️
vcs.BranchesOptions.BehindAheadBranch ⬜️ ⬜️ ⬜️
vcs.Repository.Committers ⬜️ ⬜️ ⬜️
vcs.FileLister ⬜️ ⬜️ ⬜️
vcs.UpdateResult ⬜️ ⬜️ ⬜️

Contributions that fill in the gaps are welcome!


First-time installation of protobuf and other codegen tools

You need to install and run the protobuf compiler before you can regenerate Go code after you change the vcs.proto file.

  1. Install protoc, the protobuf compiler. Find more details in the protobuf README.

    On OS X, you can install it with Homebrew by running:

    brew install --devel protobuf

    Then make sure the protoc binary is in your $PATH.

  2. Install gogo/protobuf.

    go get -u
  3. Install gopathexec:

    go get -u

Regenerating Go code after changing vcs.proto

go generate

Running tests

Run go test ./vcs/....


See all contributors here.