|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r81916 - branches/release/tools/inspect
From: dnljms_at_[hidden]
Date: 2012-12-13 16:46:22
Author: danieljames
Date: 2012-12-13 16:46:21 EST (Thu, 13 Dec 2012)
New Revision: 81916
URL: http://svn.boost.org/trac/boost/changeset/81916
Log:
Backing out subversion change from [78624].
Because it's breaking my release branch inspect report. But not trunk for some
reason.
Text files modified:
branches/release/tools/inspect/inspect.cpp | 48 +++++++++++++++++----------------------
1 files changed, 21 insertions(+), 27 deletions(-)
Modified: branches/release/tools/inspect/inspect.cpp
==============================================================================
--- branches/release/tools/inspect/inspect.cpp (original)
+++ branches/release/tools/inspect/inspect.cpp 2012-12-13 16:46:21 EST (Thu, 13 Dec 2012)
@@ -31,15 +31,6 @@
#include "boost/filesystem/operations.hpp"
#include "boost/filesystem/fstream.hpp"
-#include <stdio.h> // for popen, pclose
-#if defined(_MSC_VER)
-# define POPEN _popen
-# define PCLOSE _pclose
-#else
-# define POPEN popen
-# define PCLOSE pclose
-#endif
-
#include "time_string.hpp"
#include "inspector.hpp"
@@ -126,26 +117,29 @@
// get info (as a string) if inspect_root is svn working copy --------------//
+ void extract_info( fs::ifstream & entries_file, string & rev, string & repos )
+ {
+ 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
+ std::getline( entries_file, repos ); // repository as a string
+ }
+
string info( const fs::path & inspect_root )
{
- string rev("unknown");
- string repos("unknown");
- string command("cd ");
- command += inspect_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);
- string::size_type pos;
- if ((pos = ln.find("Revision: ")) != string::npos)
- rev = ln.substr(pos + 10);
- else if ((pos = ln.find("URL: ")) != string::npos)
- repos = ln.substr(pos + 5);
- }
+ string rev( "?" );
+ string repos( "unknown" );
+ fs::path entries( inspect_root / ".svn" / "entries" );
+ fs::ifstream entries_file( entries );
+ if ( entries_file )
+ extract_info( entries_file, rev, repos );
+ else
+ {
+ entries = inspect_root / ".." / "svn_info" / ".svn" / "entries";
+ fs::ifstream entries_file( entries );
+ if ( entries_file )
+ extract_info( entries_file, rev, repos );
}
return repos + " at revision " + 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