]> git.lyx.org Git - features.git/blobdiff - src/VCBackend.cpp
Spots from Abdel
[features.git] / src / VCBackend.cpp
index bf439b85a3d76575d3ab75e35adab328a4999c33..908593b967edffedb8722d790972e47c8c8f84d4 100644 (file)
@@ -280,6 +280,12 @@ bool RCS::toggleReadOnlyEnabled()
        return false;
 }
 
+// FIXME This could be implemented with cache from scanMaster
+string RCS::revisionInfo(LyXVC::RevisionInfo const)
+{
+       return string();
+}
+
 
 /////////////////////////////////////////////////////////////////////
 //
@@ -475,6 +481,13 @@ bool CVS::toggleReadOnlyEnabled()
        return false;
 }
 
+
+string CVS::revisionInfo(LyXVC::RevisionInfo const)
+{
+       return string();
+}
+
+
 /////////////////////////////////////////////////////////////////////
 //
 // SVN
@@ -844,7 +857,25 @@ bool SVN::undoLastEnabled()
 }
 
 
-string SVN::getFileRevisionInfo(){
+string SVN::revisionInfo(LyXVC::RevisionInfo const info)
+{
+       switch (info) {
+               case LyXVC::File:
+                       if (rev_file_cache_.empty())
+                               rev_file_cache_ = getFileRevisionInfo();
+                       if (rev_file_cache_.empty())
+                               rev_file_cache_ = "?";
+                       if (rev_file_cache_ == "?")
+                               return string();
+
+                       return rev_file_cache_;
+       }
+       return string();
+}
+
+
+std::string SVN::getFileRevisionInfo()
+{
        FileName tmpf = FileName::tempName("lyxvcout");
 
        doVCCommand("svn info --xml " + quoteName(onlyFilename(owner_->absFileName()))
@@ -867,7 +898,7 @@ string SVN::getFileRevisionInfo(){
                        c = true;
                if (c && prefixIs(line, "   revision=\"") && suffixIs(line, "\">")) {
                        string l1 = subst(line, "revision=\"", "");
-                       string l2 = subst(l1, "\">", "");
+                       string l2 = trim(subst(l1, "\">", ""));
                        if (isStrInt(l2))
                                rev = l2;
                }