diff --git a/src/LyXVC.cpp b/src/LyXVC.cpp index c53996b698..168bf55782 100644 --- a/src/LyXVC.cpp +++ b/src/LyXVC.cpp @@ -313,7 +313,7 @@ bool LyXVC::undoLastEnabled() const return vcs && vcs->undoLastEnabled(); } -bool LyXVC::prepareFileRevision(int rev, std::string & f) +bool LyXVC::prepareFileRevision(string const & rev, std::string & f) { return vcs && vcs->prepareFileRevision(rev, f); } diff --git a/src/LyXVC.h b/src/LyXVC.h index 0d9c826d5a..8cd2d89298 100644 --- a/src/LyXVC.h +++ b/src/LyXVC.h @@ -110,8 +110,9 @@ public: * Parameter rev can be either revision number or negative number * which is interpreted as how many revision back from the current * one do we want. rev=0 is reserved for the last (committed) revision. + * We need rev to be string, since in various VCS revision is not integer. */ - bool prepareFileRevision(int rev, std::string & f); + bool prepareFileRevision(std::string const & rev, std::string & f); /// Does the current VC supports this operation? bool prepareFileRevisionEnabled(); diff --git a/src/VCBackend.cpp b/src/VCBackend.cpp index e90ddcd876..bf52e7006b 100644 --- a/src/VCBackend.cpp +++ b/src/VCBackend.cpp @@ -290,7 +290,7 @@ string RCS::revisionInfo(LyXVC::RevisionInfo const info) } -bool RCS::prepareFileRevision(int, std::string &) +bool RCS::prepareFileRevision(string const &, string &) { return false; } @@ -505,7 +505,7 @@ string CVS::revisionInfo(LyXVC::RevisionInfo const info) } -bool CVS::prepareFileRevision(int, std::string &) +bool CVS::prepareFileRevision(string const &, string &) { return false; } @@ -1006,8 +1006,12 @@ void SVN::getLog(FileName const & tmpf) } -bool SVN::prepareFileRevision(int rev, string & f) +bool SVN::prepareFileRevision(string const & revis, string & f) { + if (!isStrInt(revis)) + return false; + + int rev = convert(revis); if (rev <= 0) if (!getFileRevisionInfo()) return false; diff --git a/src/VCBackend.h b/src/VCBackend.h index 6e8ef541de..a9bdb84a33 100644 --- a/src/VCBackend.h +++ b/src/VCBackend.h @@ -79,7 +79,7 @@ public: /// Return revision info specified by the argument. virtual std::string revisionInfo(LyXVC::RevisionInfo const info) = 0; - virtual bool prepareFileRevision(int rev, std::string & f) = 0; + virtual bool prepareFileRevision(std::string const & rev, std::string & f) = 0; virtual bool prepareFileRevisionEnabled() = 0; @@ -157,7 +157,7 @@ public: virtual std::string revisionInfo(LyXVC::RevisionInfo const info); - virtual bool prepareFileRevision(int rev, std::string & f); + virtual bool prepareFileRevision(std::string const & rev, std::string & f); virtual bool prepareFileRevisionEnabled(); @@ -218,7 +218,7 @@ public: virtual std::string revisionInfo(LyXVC::RevisionInfo const info); - virtual bool prepareFileRevision(int rev, std::string & f); + virtual bool prepareFileRevision(std::string const & rev, std::string & f); virtual bool prepareFileRevisionEnabled(); @@ -278,7 +278,7 @@ public: virtual std::string revisionInfo(LyXVC::RevisionInfo const info); - virtual bool prepareFileRevision(int rev, std::string & f); + virtual bool prepareFileRevision(std::string const & rev, std::string & f); virtual bool prepareFileRevisionEnabled(); diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index e55ce92220..5cb73804d4 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -2579,22 +2579,20 @@ void GuiView::dispatchVC(FuncRequest const & cmd) } case LFUN_VC_COMPARE: { - if (!isStrInt(cmd.getArg(0))) - break; - int rev1 = convert(cmd.getArg(0)); + + string rev1 = cmd.getArg(0); string f1, f2; // f1 if (!buffer->lyxvc().prepareFileRevision(rev1, f1)) break; - if (rev1 <= 0) { + if (isStrInt(rev1) && convert(rev1) <= 0) { f2 = buffer->absFileName(); } else { - string arg2 = cmd.getArg(1); - if (arg2.empty() || !isStrInt(arg2)) + string rev2 = cmd.getArg(1); + if (rev2.empty() || !isStrInt(rev2)) break; - int rev2 = convert(arg2); // f2 if (!buffer->lyxvc().prepareFileRevision(rev2, f2)) break;