SVN file revision number

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33424 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Pavel Sanda 2010-02-12 01:43:55 +00:00
parent 59d0045a72
commit 22b98a7ca4
2 changed files with 36 additions and 0 deletions

View File

@ -844,6 +844,40 @@ bool SVN::undoLastEnabled()
}
string SVN::getFileRevisionInfo(){
FileName tmpf = FileName::tempName("lyxvcout");
doVCCommand("svn info --xml " + quoteName(onlyFilename(owner_->absFileName()))
+ " > " + quoteName(tmpf.toFilesystemEncoding()),
FileName(owner_->filePath()));
if (tmpf.empty())
return string();
ifstream ifs(tmpf.toFilesystemEncoding().c_str());
string line;
// commit log part
bool c = false;
string rev;
while (ifs) {
getline(ifs, line);
LYXERR(Debug::LYXVC, line);
if (prefixIs(line, "<commit"))
c = true;
if (c && prefixIs(line, " revision=\"") && suffixIs(line, "\">")) {
string l1 = subst(line, "revision=\"", "");
string l2 = subst(l1, "\">", "");
if (isStrInt(l2))
rev = l2;
}
}
ifs.close();
tmpf.erase();
return rev;
}
void SVN::getLog(FileName const & tmpf)
{
doVCCommand("svn log " + quoteName(onlyFilename(owner_->absFileName()))

View File

@ -254,6 +254,8 @@ public:
virtual bool toggleReadOnlyEnabled();
std::string getFileRevisionInfo();
protected:
virtual void scanMaster();
/// Check for messages in svn output. Returns error.