Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/go/vcs: package could provide an id of current working index #10159

Open
krnowak opened this Issue Mar 13, 2015 · 0 comments

Comments

Projects
None yet
3 participants
@krnowak
Copy link

krnowak commented Mar 13, 2015

Something like:

rr, _ := vcs.RepoRootForImportPath("github.com/golang/go", false)
fmt.Println("Current working change id:", rr.Cmd.GetId())

The GetId() function prototype could be func (v *Cmd) GetId() (string, error) and getting an id means:

  1. git - git rev-parse HEAD
  2. hg - hg id -i
  3. bzr - bzr revno
  4. svn - svnversion

The subversion here is an odd man out, which might be troublesome as the code in vcs package assumes that a command stored in Cmd member can provide all info.

My use case is creating container images from given project, so the created image could have a vcs info in its (JSON) metadata, for example git: 66199afb25487fd75bf870c72bc3cea33d95f89e

@mikioh mikioh added the repo-tools label Mar 14, 2015

@mikioh mikioh changed the title vcs package could provide an id of current working index go/vcs: package could provide an id of current working index Mar 14, 2015

@rsc rsc added this to the Unplanned milestone Apr 10, 2015

@rsc rsc changed the title go/vcs: package could provide an id of current working index x/tools/go/vcs: package could provide an id of current working index Apr 14, 2015

@rsc rsc modified the milestones: Unreleased, Unplanned Apr 14, 2015

@rsc rsc removed the repo-tools label Apr 14, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.