]> git.lyx.org Git - lyx.git/blobdiff - src/VCBackend.cpp
Provide proper fallback if a bibliography processor is not found
[lyx.git] / src / VCBackend.cpp
index 3eeb3d6a3ef3ccccf1db19aecfdd76ede3b1e8d7..963064c93a3ac77d71e562cf4b473e8a5f40a89a 100644 (file)
@@ -31,6 +31,7 @@
 #include "support/TempFile.h"
 
 #include <fstream>
+#include <iomanip>
 #include <sstream>
 
 using namespace std;
@@ -58,11 +59,15 @@ int VCS::doVCCommand(string const & cmd, FileName const & path, bool reportError
 
        if (owner_)
                owner_->setBusy(false);
-       if (ret && reportError)
+       if (ret && reportError) {
+               docstring rcsmsg;
+               if (prefixIs(cmd, "ci "))
+                       rcsmsg = "\n" + _("Perhaps the RCS package is not installed on your system?");
                frontend::Alert::error(_("Revision control error."),
                        bformat(_("Some problem occurred while running the command:\n"
-                                 "'%1$s'."),
+                                 "'%1$s'.") + rcsmsg,
                        from_utf8(cmd)));
+       }
        return ret;
 }
 
@@ -391,7 +396,7 @@ void RCS::undoLast()
 
 bool RCS::undoLastEnabled()
 {
-       return true;
+       return owner_->hasReadonlyFlag();
 }
 
 
@@ -429,7 +434,8 @@ string RCS::revisionInfo(LyXVC::RevisionInfo const info)
                        return rev_date_cache_;
                case LyXVC::Time:
                        return rev_time_cache_;
-               default: ;
+               default:
+                       break;
        }
 
        return string();
@@ -568,10 +574,10 @@ void CVS::scanMaster()
                if (contains(line, tmpf)) {
                        // Ok extract the fields.
                        smatch sm;
-
-                       // false positive from coverity
-                       // coverity[CHECKED_RETURN]
-                       regex_match(line, sm, reg);
+                       if (!regex_match(line, sm, reg)) {
+                               LYXERR(Debug::LYXVC, "\t  Cannot parse line. Skipping.");
+                               continue;
+                       }
 
                        //sm[0]; // whole matched string
                        //sm[1]; // filename
@@ -1101,7 +1107,8 @@ string CVS::revisionInfo(LyXVC::RevisionInfo const info)
                        return rev_date_cache_;
                case LyXVC::Time:
                        return rev_time_cache_;
-               default: ;
+               default:
+                       break;
                }
        }
        return string();
@@ -1665,8 +1672,8 @@ string SVN::revisionInfo(LyXVC::RevisionInfo const info)
                        return rev_date_cache_;
                case LyXVC::Time:
                        return rev_time_cache_;
-               default: ;
-
+               default:
+                       break;
        }
 
        return string();
@@ -2134,8 +2141,8 @@ string GIT::revisionInfo(LyXVC::RevisionInfo const info)
                        return rev_date_cache_;
                case LyXVC::Time:
                        return rev_time_cache_;
-               default: ;
-
+               default:
+                       break;
        }
 
        return string();
@@ -2185,7 +2192,8 @@ bool GIT::getTreeRevisionInfo()
        }
 
        doVCCommand("git describe --abbrev --dirty --long > " + quoteName(tmpf.toFilesystemEncoding()),
-                   FileName(owner_->filePath()));
+                   FileName(owner_->filePath()),
+                   false); //git describe returns $?=128 when no tag found (but git repo still exists)
 
        if (tmpf.empty())
                return false;