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

Get Current version #36

Closed
2 tasks done
mattfarina opened this issue Apr 28, 2016 · 4 comments
Closed
2 tasks done

Get Current version #36

mattfarina opened this issue Apr 28, 2016 · 4 comments

Comments

@mattfarina
Copy link
Member

mattfarina commented Apr 28, 2016

This is a loose "version" and is different from the Version method which returns a revision. For example, in Git if you're on a branch that name would be returned. If on a tag that name would be returned. Otherwise a revision is returned.

This is a little more difficult in other VCS and am still working out the details if it's possible.

Git

  1. Run git symbolic-ref HEAD to see if this is a branch and get the name. If not use Version() to get the revision and TagsFromCommit() to get a tag if one is present.
  2. Similar to the first but instead read directly from the file .git/HEAD for the first step.

Hg

  1. Run hg parent -T "{node}" to get current commit. Then compare that to hg parent -r tip -T "{node}" to see if on the tip of the branch. If so, hg branch to get the name. Otherwise, use TagsFromCommit() to see if on a tag to return. Or, return commit id.

TODO:

  • Bzr
  • Strategy for Svn
@mattfarina
Copy link
Member Author

mattfarina commented Apr 29, 2016

Bzr

In our handling of Bzr we are currently skipping shared repos. In that case each branch (aliased to clone) is it's own directory. That means we can:

  • Use bzr log --log-format=line -r-1 to get the id of HEAD
  • Use bzr version-info to get the info for the current checkout. _Note, version-info with --custom and --template can be used to replace the innards of CommitInfo() more safely.
  • Compare the 2 versions. If they are different, the actual commit we're on can be checked for a tag which can be returned. Otherwise return the revision.
  • If on the tip of the branch return -1 (the bzr representation for the last commit)?

@mattfarina
Copy link
Member Author

Svn

Given the current tt could be done.

  • Get current rev and the HEAD rev. If they are not equal return the current rev.
  • If they are equal it's the tip so return HEAD?

mattfarina added a commit that referenced this issue May 3, 2016
Includes:
- Fix to SVN versions. There were times an incorrect version would
  be returned.
- Hg now using full hash for versions as it should have been. This
  fixes a bug.
@mattfarina
Copy link
Member Author

See #38 for implementation

mattfarina added a commit that referenced this issue May 4, 2016
@mattfarina
Copy link
Member Author

Merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant