aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTorgny Nyblom <kde@nyblom.org>2010-12-21 10:30:15 +0100
committerTorgny Nyblom <kde@nyblom.org>2010-12-21 10:42:44 +0100
commit508a67a69eafd07a2e1ce9020983e7113b91d919 (patch)
tree31e9972a16a75dfce6e70e3abd19f43d31cc8381 /src
parentd57295761cdea09bc93a73c0189c971da29b92a4 (diff)
downloadsvn2git-508a67a69eafd07a2e1ce9020983e7113b91d919.tar
svn2git-508a67a69eafd07a2e1ce9020983e7113b91d919.tar.gz
svn2git-508a67a69eafd07a2e1ce9020983e7113b91d919.tar.bz2
svn2git-508a67a69eafd07a2e1ce9020983e7113b91d919.tar.xz
svn2git-508a67a69eafd07a2e1ce9020983e7113b91d919.zip
Fix the --version option
When supplying --version the git commit that was used to create the version should be printed to stdout.
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp4
-rw-r--r--src/src.pro8
2 files changed, 12 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 1cabbad..e6a2bfa 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -117,6 +117,10 @@ int main(int argc, char **argv)
CommandLineParser::addOptionDefinitions(options);
Stats::init();
CommandLineParser *args = CommandLineParser::instance();
+ if(args->contains(QLatin1String("version"))) {
+ printf("Git version: %s\n", VER);
+ return 0;
+ }
if (args->contains(QLatin1String("help")) || args->arguments().count() != 1) {
args->usage(QString(), "[Path to subversion repo]");
return 0;
diff --git a/src/src.pro b/src/src.pro
index 2626a6f..da6d40d 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -6,6 +6,14 @@ SVN_INCLUDE = /usr/include/subversion-1 /usr/local/include/subversion-1
APR_INCLUDE = /usr/include/apr-1.0 /usr/include/apr-1 /usr/local/include/apr-1
exists(local-config.pri):include(local-config.pri)
+VERSION = $$system(git --no-pager show --pretty=oneline --no-notes | head -1 | cut -b-40)
+ !isEmpty(VERSION){
+ VERSION = $${VERSION}
+ }
+
+VERSTR = '\\"$${VERSION}\\"' # place quotes around the version string
+DEFINES += VER=\"$${VERSTR}\" # create a VER macro containing the version string
+
TEMPLATE = app
TARGET = ../svn-all-fast-export
DEPENDPATH += .