Pavel Sanda wrote: > the 2nd patch is not finished should i apply here and try to finish svn part
here is the superflous-dialog fix which is on the top of your first patch. it basically (should) not change behaviour of svn and rcs and let you do any bussiness inside cvs (i let the cvs routines in your version.) untested, i will get to the svn/rcs part later. pavel
diff --git a/src/LyXVC.cpp b/src/LyXVC.cpp index 922ecff..65e83a3 100644 --- a/src/LyXVC.cpp +++ b/src/LyXVC.cpp @@ -165,7 +165,9 @@ string LyXVC::checkIn() docstring empty(_("(no log message)")); docstring response; string log; - bool ok = Alert::askForText(response, _("LyX VC: Log Message")); + bool ok = true; + if (vcs->isCheckInWithConfirmation()) + ok = Alert::askForText(response, _("LyX VC: Log Message")); if (ok) { if (response.empty()) response = empty; @@ -214,8 +216,10 @@ void LyXVC::revert() docstring text = bformat(_("Reverting to the stored version of the " "document %1$s will lose all current changes.\n\n" "Do you want to revert to the older version?"), file); - int const ret = Alert::prompt(_("Revert to stored version of document?"), - text, 0, 1, _("&Revert"), _("&Cancel")); + int ret = 0; + if (vcs->isRevertWithConfirmation()) + ret = Alert::prompt(_("Revert to stored version of document?"), + text, 0, 1, _("&Revert"), _("&Cancel")); if (ret == 0) vcs->revert(); diff --git a/src/VCBackend.cpp b/src/VCBackend.cpp index c1831e3..eba725d 100644 --- a/src/VCBackend.cpp +++ b/src/VCBackend.cpp @@ -195,6 +195,12 @@ bool RCS::checkInEnabled() return owner_ && !owner_->isReadonly(); } +bool RCS::isCheckInWithConfirmation() +{ + //FIXME diff + return true; +} + string RCS::checkOut() { @@ -247,6 +253,13 @@ void RCS::revert() } +bool RCS::isRevertWithConfirmation() +{ + //FIXME owner && diff ? + return true; +} + + void RCS::undoLast() { LYXERR(Debug::LYXVC, "LyXVC: undoLast"); @@ -612,6 +625,13 @@ bool CVS::checkInEnabled() } +bool CVS::isCheckInWithConfirmation() +{ + CvsStatus status = getStatus(); + return status == LocallyModified || status == LocallyAdded; +} + + string CVS::checkOut() { if (vcstatus != NOLOCKING && edit()) @@ -705,6 +725,13 @@ bool CVS::lockingToggleEnabled() } +bool CVS::isRevertWithConfirmation() +{ + CvsStatus status = getStatus(); + return !owner_->isClean() || status == LocallyModified || status == LocallyAdded; +} + + void CVS::revert() { // Reverts to the version in CVS repository and @@ -928,6 +955,13 @@ bool SVN::checkInEnabled() } +bool SVN::isCheckInWithConfirmation() +{ + //FIXME diff + return true; +} + + // FIXME Correctly return code should be checked instead of this. // This would need another solution than just plain startscript. // Hint from Andre': QProcess::readAllStandardError()... @@ -1129,7 +1163,7 @@ bool SVN::lockingToggleEnabled() void SVN::revert() { - // Reverts to the version in CVS repository and + // Reverts to the version in SVN repository and // gets the updated version from the repository. string const fil = quoteName(onlyFileName(owner_->absFileName())); @@ -1139,6 +1173,13 @@ void SVN::revert() } +bool SVN::isRevertWithConfirmation() +{ + //FIXME owner && diff + return true; +} + + void SVN::undoLast() { // merge the current with the previous version diff --git a/src/VCBackend.h b/src/VCBackend.h index a7df807..b50fe37 100644 --- a/src/VCBackend.h +++ b/src/VCBackend.h @@ -42,6 +42,8 @@ public: virtual std::string checkIn(std::string const & msg) = 0; // can be this operation processed in the current RCS? virtual bool checkInEnabled() = 0; + // should a log message provided for next checkin? + virtual bool isCheckInWithConfirmation() = 0; /// check out for editing, returns log virtual std::string checkOut() = 0; // can be this operation processed in the current RCS? @@ -54,10 +56,10 @@ public: virtual std::string lockingToggle() = 0; // can be this operation processed in the current RCS? virtual bool lockingToggleEnabled() = 0; - // should a confirmation before revert requested? - virtual bool revertWithConfirmation() { return true; } /// revert current edits virtual void revert() = 0; + // should a confirmation before revert requested? + virtual bool isRevertWithConfirmation() = 0; /// FIXME virtual void undoLast() = 0; // can be this operation processed in the current RCS? @@ -131,6 +133,8 @@ public: virtual bool checkInEnabled(); + virtual bool isCheckInWithConfirmation(); + virtual std::string checkOut(); virtual bool checkOutEnabled(); @@ -145,6 +149,8 @@ public: virtual void revert(); + virtual bool isRevertWithConfirmation(); + virtual void undoLast(); virtual bool undoLastEnabled(); @@ -192,6 +198,8 @@ public: virtual bool checkInEnabled(); + virtual bool isCheckInWithConfirmation(); + virtual std::string checkOut(); virtual bool checkOutEnabled(); @@ -204,6 +212,8 @@ public: virtual bool lockingToggleEnabled(); + virtual bool isRevertWithConfirmation(); + virtual void revert(); virtual void undoLast(); @@ -289,6 +299,8 @@ public: virtual bool checkInEnabled(); + virtual bool isCheckInWithConfirmation(); + virtual std::string checkOut(); virtual bool checkOutEnabled(); @@ -303,6 +315,8 @@ public: virtual void revert(); + virtual bool isRevertWithConfirmation(); + virtual void undoLast(); virtual bool undoLastEnabled();