Make updating less dangerous, see comments in #6255.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31615 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Pavel Sanda 2009-10-14 19:18:06 +00:00
parent 266cb16168
commit 4257aa5e7f
9 changed files with 40 additions and 39 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -72,7 +72,7 @@ Menuset
OptItem "Register...|R" "vc-register"
OptItem "Check In Changes...|I" "vc-check-in"
OptItem "Check Out for Edit|O" "vc-check-out"
OptItem "Synchronize local directory with repository" "vc-repo-synchro"
OptItem "Update local directory with repository" "vc-repo-synchro"
OptItem "Revert to Repository Version|v" "vc-revert"
OptItem "Undo Last Check In|U" "vc-undo-last"
OptItem "Show History...|H" "dialog-show vclog"

View File

@ -228,7 +228,7 @@ enum FuncCode
LFUN_VC_COMMAND,
LFUN_VC_LOCKING_TOGGLE,
// 165
LFUN_VC_REPO_SYNCHRO,
LFUN_VC_REPO_UPDATE,
LFUN_BUFFER_CHKTEX, // Asger 971030
LFUN_HYPERLINK_INSERT, // CFO-G 971121
LFUN_WORD_FIND_FORWARD, // Etienne 980216

View File

@ -2172,15 +2172,15 @@ void LyXAction::init()
*/
{ LFUN_VC_LOCKING_TOGGLE, "vc-locking-toggle", ReadOnly, System },
/*!
* \var lyx::FuncCode lyx::LFUN_VC_REPO_SYNCHRO
* \li Action: Synchronize the local archive directory in which resides
the current document with the repository.
* \li Notion: This is currently implemented only for SVN as revert + update operation.
* \li Syntax: vc-repo-synchro
* \var lyx::FuncCode lyx::LFUN_VC_REPO_UPDATE
* \li Action: Update the local archive directory in which resides
the current document with the remote repository.
* \li Notion: This is currently implemented only for SVN.
* \li Syntax: vc-repo-update
* \li Origin: sanda, 16 Oct 2009
* \endvar
*/
{ LFUN_VC_REPO_SYNCHRO, "vc-repo-synchro", ReadOnly, System },
{ LFUN_VC_REPO_UPDATE, "vc-repo-synchro", ReadOnly, System },
/*!
* \var lyx::FuncCode lyx::LFUN_CHANGES_TRACK

View File

@ -170,10 +170,10 @@ string LyXVC::checkOut()
}
string LyXVC::repoSynchro()
string LyXVC::repoUpdate()
{
LYXERR(Debug::LYXVC, "LyXVC: repoSynchro");
return vcs->repoSynchro();
LYXERR(Debug::LYXVC, "LyXVC: repoUpdate");
return vcs->repoUpdate();
}

View File

@ -78,9 +78,9 @@ public:
bool checkOutEnabled();
/// Synchronize the whole archive with repository
std::string repoSynchro();
std::string repoUpdate();
/// Does the current VC supports this operation?
bool repoSynchroEnabled();
bool repoUpdateEnabled();
/**
* Toggle locking property of the edited file,

View File

@ -209,14 +209,14 @@ bool RCS::checkOutEnabled()
}
string RCS::repoSynchro()
string RCS::repoUpdate()
{
lyxerr << "Sorry, not implemented." << endl;
return string();
}
bool RCS::repoSynchroEnabled()
bool RCS::repoUpdateEnabled()
{
return false;
}
@ -397,14 +397,14 @@ bool CVS::checkOutEnabled()
}
string CVS::repoSynchro()
string CVS::repoUpdate()
{
lyxerr << "Sorry, not implemented." << endl;
return string();
}
bool CVS::repoSynchroEnabled()
bool CVS::repoUpdateEnabled()
{
return false;
}
@ -704,7 +704,7 @@ bool SVN::checkOutEnabled()
}
string SVN::repoSynchro()
string SVN::repoUpdate()
{
FileName tmpf = FileName::tempName("lyxvcout");
if (tmpf.empty()) {
@ -720,9 +720,9 @@ string SVN::repoSynchro()
LYXERR(Debug::LYXVC, "Diff detected:\n" << res);
docstring const file = from_utf8(owner_->filePath());
docstring text = bformat(_("There were detected changes "
"in the working directory.\n"
"Synchronizing with repository will discard "
"any uncommitted changes in the directory:\n%1$s"
"in the working directory:\n%1$s\n\n"
"In case of file conflict version of the local directory files "
"will be preferred."
"\n\nContinue?"), file);
int const ret = frontend::Alert::prompt(_("Changes detected"),
text, 0, 1, _("&Yes"), _("&No"));
@ -732,11 +732,12 @@ string SVN::repoSynchro()
}
}
doVCCommand("svn revert -R " + quoteName(owner_->filePath())
+ " > " + quoteName(tmpf.toFilesystemEncoding()),
FileName(owner_->filePath()));
res = "Revert log:\n" + tmpf.fileContents("UTF-8");
doVCCommand("svn update " + quoteName(owner_->filePath())
// Reverting looks too harsh, see bug #6255.
// doVCCommand("svn revert -R " + quoteName(owner_->filePath())
// + " > " + quoteName(tmpf.toFilesystemEncoding()),
// FileName(owner_->filePath()));
// res = "Revert log:\n" + tmpf.fileContents("UTF-8");
doVCCommand("svn update --accept mine-full " + quoteName(owner_->filePath())
+ " > " + quoteName(tmpf.toFilesystemEncoding()),
FileName(owner_->filePath()));
res += "Update log:\n" + tmpf.fileContents("UTF-8");
@ -747,7 +748,7 @@ string SVN::repoSynchro()
}
bool SVN::repoSynchroEnabled()
bool SVN::repoUpdateEnabled()
{
return true;
}

View File

@ -44,9 +44,9 @@ public:
// can be this operation processed in the current RCS?
virtual bool checkOutEnabled() = 0;
/// synchronize with repository, returns log
virtual std::string repoSynchro() = 0;
virtual std::string repoUpdate() = 0;
// can be this operation processed in the current RCS?
virtual bool repoSynchroEnabled() = 0;
virtual bool repoUpdateEnabled() = 0;
// toggle locking property of the file
virtual std::string lockingToggle() = 0;
// can be this operation processed in the current RCS?
@ -135,9 +135,9 @@ public:
virtual bool checkOutEnabled();
virtual std::string repoSynchro();
virtual std::string repoUpdate();
virtual bool repoSynchroEnabled();
virtual bool repoUpdateEnabled();
virtual std::string lockingToggle();
@ -182,9 +182,9 @@ public:
virtual bool checkOutEnabled();
virtual std::string repoSynchro();
virtual std::string repoUpdate();
virtual bool repoSynchroEnabled();
virtual bool repoUpdateEnabled();
virtual std::string lockingToggle();
@ -232,9 +232,9 @@ public:
virtual bool checkOutEnabled();
virtual std::string repoSynchro();
virtual std::string repoUpdate();
virtual bool repoSynchroEnabled();
virtual bool repoUpdateEnabled();
virtual std::string lockingToggle();

View File

@ -1414,7 +1414,7 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
case LFUN_VC_UNDO_LAST:
enable = doc_buffer && doc_buffer->lyxvc().undoLastEnabled();
break;
case LFUN_VC_REPO_SYNCHRO:
case LFUN_VC_REPO_UPDATE:
enable = doc_buffer && doc_buffer->lyxvc().inUse();
break;
case LFUN_VC_COMMAND: {
@ -2337,10 +2337,10 @@ void GuiView::dispatchVC(FuncRequest const & cmd)
reloadBuffer();
break;
case LFUN_VC_REPO_SYNCHRO:
case LFUN_VC_REPO_UPDATE:
LASSERT(buffer, return);
if (ensureBufferClean(buffer)) {
string res = buffer->lyxvc().repoSynchro();
string res = buffer->lyxvc().repoUpdate();
message(from_utf8(res));
reloadBuffer();
}
@ -2766,7 +2766,7 @@ bool GuiView::dispatch(FuncRequest const & cmd)
case LFUN_VC_REGISTER:
case LFUN_VC_CHECK_IN:
case LFUN_VC_CHECK_OUT:
case LFUN_VC_REPO_SYNCHRO:
case LFUN_VC_REPO_UPDATE:
case LFUN_VC_LOCKING_TOGGLE:
case LFUN_VC_REVERT:
case LFUN_VC_UNDO_LAST: