Commit Graph

9 Commits

Author SHA1 Message Date
Jim Grosbach
0a2e27d964 CMake: Don't run 'git svn' if there is no .git/svn directory.
If the local checkout does not have 'git svn' references set up, don't try
to use 'git svn' for version information.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169749 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-10 19:03:37 +00:00
Dylan Noblesmith
f931261b51 cmake: work with CMake < 2.8.5
CMake versions 2.8.4 and earlier were giving this error since r146323:
"string end index: -1 is out of range 0 - 6"

Passing -1 as the length of the desired substring was a new feature
added in CMake 2.8.5:
http://www.cmake.org/Bug/view.php?id=10740

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146372 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12 13:06:25 +00:00
Chandler Carruth
4fd061e4d9 Use a simpler and more reliable command for converting from HEAD to
commit-ish. Funny thing, they have a command designed for this. ;]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146325 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-10 10:18:47 +00:00
Chandler Carruth
78304a9131 Teach the VCS detection to set some root-level variables with the raw
revision and git commit data extracted. This will be used in the Clang
CMake build to avoid trying to re-detect the information.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146324 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-10 10:04:38 +00:00
Chandler Carruth
1f8bd3057e At the request of Michael Spencer, make the VCS version detection logic
in CMake a bit more handy. Previously we would get such charming
versions as the following for revision NNNN and commit-ish XXXXX:
  3.1svnsvn-rNNNN
  3.1svngit-svn-rNNNN
  3.1svngit-svn-XXXXX

The mechanism selecting betwene the latter two was particularly odd, and
didn't work with all of the ways git-svn repos are set up apparently. It
also misses an important point -- both the revision *and* the git commit
might be relevant when working on a local branch some distance from
mainline. The new logic does several things:

1) It strips the redundant initial 'svn'.
2) It always looks for a git-svn revision number base, and when found
   includes it in the version.
3) If the git commit-ish for the current HEAD is not exactly that
   revision number, it is also included.

The resulting strings should roughly be:
  3.1svn-rNNNN
  3.1git-svn-rNNNN
  3.1git-svn-rNNNN-XXXXX

Suggestions on formatting etc always welcome. =] I've only looked at the
LLVM version string here, not Clang's (yet).

Note that the commit-ish reported is *not* terribly accurate. It updates
when 'cmake' is run, not when the binary is built. Still, it may be
better than nothing, especially if people have fairly long-lived git
repos and branches. This is not a new limitation, just didn't want
anyone to be surprised.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146323 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-10 09:41:13 +00:00
Oscar Fuentes
c54ca79854 Don't try to guess svn version when current path is a symlink.
See PR 8473.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117109 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-22 17:16:26 +00:00
Michael J. Spencer
3df9c6bbae CMake: Use the svn revision information from git-svn if available.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113405 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-08 20:49:40 +00:00
Oscar Fuentes
59d5145d7d When building from git, add ref-id to PACKAGE_VERSION
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110301 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-05 02:22:51 +00:00
Oscar Fuentes
ee99317554 CMake: add version control info to PACKAGE_VERSION, if available.
Adds "svn" or "git", depending on the VCS used. If svn, adds the
revision number as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110121 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-03 17:28:09 +00:00