From: Pavel Sanda Date: Fri, 12 Feb 2010 01:43:55 +0000 (+0000) Subject: SVN file revision number X-Git-Tag: 2.0.0~4073 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=22b98a7ca439f3a4abf05589065b38ac0e17ae35;p=lyx.git SVN file revision number git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33424 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/VCBackend.cpp b/src/VCBackend.cpp index 56d4c3f9f6..bf439b85a3 100644 --- a/src/VCBackend.cpp +++ b/src/VCBackend.cpp @@ -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, "")) { + 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())) diff --git a/src/VCBackend.h b/src/VCBackend.h index dbcd84ca81..5f5f0f77d9 100644 --- a/src/VCBackend.h +++ b/src/VCBackend.h @@ -254,6 +254,8 @@ public: virtual bool toggleReadOnlyEnabled(); + std::string getFileRevisionInfo(); + protected: virtual void scanMaster(); /// Check for messages in svn output. Returns error.