Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76602 - trunk/tools/regression/src
From: bdawes_at_[hidden]
Date: 2012-01-20 21:03:28


Author: bemandawes
Date: 2012-01-20 21:03:27 EST (Fri, 20 Jan 2012)
New Revision: 76602
URL: http://svn.boost.org/trac/boost/changeset/76602

Log:
Rewrite code to discover revision of trunk in a way that is not dependent on internal .svn directory contents, which have changed recently.
Text files modified:
   trunk/tools/regression/src/compiler_status.cpp | 36 +++++++++++++++++++++++++++---------
   1 files changed, 27 insertions(+), 9 deletions(-)

Modified: trunk/tools/regression/src/compiler_status.cpp
==============================================================================
--- trunk/tools/regression/src/compiler_status.cpp (original)
+++ trunk/tools/regression/src/compiler_status.cpp 2012-01-20 21:03:27 EST (Fri, 20 Jan 2012)
@@ -34,7 +34,7 @@
 namespace xml = boost::tiny_xml;
 
 #include <cstdlib> // for abort, exit
-#include <cctype> // for toupper
+#include <cctype> // for toupper, isdigit
 #include <string>
 #include <vector>
 #include <set>
@@ -46,6 +46,15 @@
 #include <stdexcept>
 #include <cassert>
 
+#include <stdio.h> // for popen, pclose
+#if defined(_MSC_VER)
+# define POPEN _popen
+# define PCLOSE _pclose
+#else
+# define POPEN popen
+# define PCLOSE pclose
+#endif
+
 using std::string;
 
 const string pass_msg( "Pass" );
@@ -107,15 +116,24 @@
   string revision( const fs::path & boost_root )
   {
     string rev;
- fs::path entries( boost_root / ".svn" / "entries" );
- fs::ifstream entries_file( entries );
- if ( entries_file )
- {
- std::getline( entries_file, rev );
- std::getline( entries_file, rev );
- std::getline( entries_file, rev );
- std::getline( entries_file, rev ); // revision number as a string
+ string command("cd ");
+ command += boost_root.string() + " & svn info";
+ FILE* fp = POPEN(command.c_str(), "r");
+ if (fp)
+ {
+ static const int line_max = 128;
+ char line[line_max];
+ while (fgets(line, line_max, fp) != NULL)
+ {
+ string ln(line);
+ if (ln.find("Revision: ") != string::npos)
+ {
+ for(auto itr = ln.begin()+10; itr != ln.end() && isdigit(*itr); ++itr)
+ rev += *itr;
+ }
+ }
     }
+ std::cout << "Revision: " << rev << std::endl;
     return rev;
   }
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk