- if(version.isEmpty()) {
- // hmm, Git failed... let's check for version.dist instead
- QFile dist(gitroot + "/version.dist");
- if(dist.open(QIODevice::ReadOnly | QIODevice::Text)) {
- version = dist.readAll();
- dist.close();
+
+ // parse version.inc
+ QFile verfile(gitroot + "/version.inc");
+ if(verfile.open(QIODevice::ReadOnly | QIODevice::Text)) {
+ QString ver = verfile.readAll();
+
+ QRegExp rxBasever("baseVersion\\s*=\\s*\"(.*)\";");
+ if(rxBasever.indexIn(ver) >= 0)
+ basever = rxBasever.cap(1);
+
+ QRegExp rxProtover("protocolVersion\\s*=\\s*(\\d+)");
+ if(rxProtover.indexIn(ver) >= 0)
+ protover = rxProtover.cap(1);
+
+ QRegExp rxClientneeds("clientNeedsProtocol\\s*=\\s*(\\d+)");
+ if(rxClientneeds.indexIn(ver) >= 0)
+ clientneeds = rxClientneeds.cap(1);
+
+ QRegExp rxCoreneeds("coreNeedsProtocol\\s*=\\s*(\\d+)");
+ if(rxCoreneeds.indexIn(ver) >= 0)
+ coreneeds = rxCoreneeds.cap(1);
+
+ if(committish.isEmpty()) {
+ QRegExp rxCommit("distCommittish\\s*=\\s*([0-9a-f]+)");
+ if(rxCommit.indexIn(ver) >= 0) committish = rxCommit.cap(1);