]> git.lyx.org Git - lyx.git/blobdiff - src/VCBackend.cpp
Buffer: Rename function names:
[lyx.git] / src / VCBackend.cpp
index 208161bb24a928eed815748e483273d951c5b2ae..f2057cd360441051e0cf8a94c5ed080ae28dfe26 100644 (file)
@@ -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");
@@ -430,7 +443,9 @@ string const CVS::getTarget(OperationMode opmode) const
 {
        switch(opmode) {
        case Directory:
-               return quoteName(owner_->filePath());
+               // in client server mode CVS does not like full path operand for directory operation
+               // since LyX switches to the repo dir "." is good enough as target
+               return ".";
        case File:
                return quoteName(onlyFileName(owner_->absFileName()));
        }
@@ -612,6 +627,13 @@ bool CVS::checkInEnabled()
 }
 
 
+bool CVS::isCheckInWithConfirmation()
+{
+       CvsStatus status = getStatus();
+       return status == LocallyModified || status == LocallyAdded;
+}
+
+
 string CVS::checkOut()
 {
        if (vcstatus != NOLOCKING && edit())
@@ -705,6 +727,13 @@ bool CVS::lockingToggleEnabled()
 }
 
 
+bool CVS::isRevertWithConfirmation()
+{
+       CvsStatus status = getStatus();
+       return !owner_->isClean() || status == LocallyModified || status == NeedsMerge;
+}
+
+
 void CVS::revert()
 {
        // Reverts to the version in CVS repository and
@@ -724,17 +753,22 @@ void CVS::revert()
                owner_->markClean();
                break;
        }
-       case LocallyAdded:
+       case LocallyAdded: {
+               docstring const file = owner_->fileName().displayName(20);
                frontend::Alert::error(_("Revision control error."),
-                       _("The current file is not in repository.\n"
-                         "You have to check in the first revision before you can revert.")) ;
+                       bformat(_("The document %1$s is not in repository.\n"
+                                 "You have to check in the first revision before you can revert."),
+                               file)) ;
                break;
-       default:
+       }
+       default: {
+               docstring const file = owner_->fileName().displayName(20);
                frontend::Alert::error(_("Revision control error."),
-                       bformat(_("Bad status when checking in changes.\n"
-                                         "\n'%1$s'\n\n"),
-                               toString(status)));
+                       bformat(_("Cannot revert document %1$s to repository version.\n"
+                                 "The status '%2$s' is unexpected."),
+                               file, toString(status)));
                break;
+               }
        }
 }
 
@@ -928,6 +962,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 +1170,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 +1180,13 @@ void SVN::revert()
 }
 
 
+bool SVN::isRevertWithConfirmation()
+{
+       //FIXME owner && diff
+       return true;
+}
+
+
 void SVN::undoLast()
 {
        // merge the current with the previous version