mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-27 14:29:21 +00:00
Prepare VCS part for comparison.
We probably need to enhance comparison API for external calls. Closing the party for today. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33449 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3e83e10ffe
commit
3788adf6ce
@ -229,7 +229,7 @@ enum FuncCode
|
||||
LFUN_VC_LOCKING_TOGGLE,
|
||||
// 165
|
||||
LFUN_VC_REPO_UPDATE,
|
||||
LFUN_BUFFER_CHKTEX, // Asger 971030
|
||||
LFUN_VC_COMPARE,
|
||||
LFUN_HYPERLINK_INSERT, // CFO-G 971121
|
||||
LFUN_WORD_FIND_FORWARD, // Etienne 980216
|
||||
LFUN_WORD_FIND_BACKWARD, // Etienne 980220
|
||||
@ -445,6 +445,7 @@ enum FuncCode
|
||||
LFUN_SPELLING_ADD, // spitz 20100118
|
||||
// 345
|
||||
LFUN_SPELLING_IGNORE, // spitz 20100118
|
||||
LFUN_BUFFER_CHKTEX, // Asger 971030
|
||||
|
||||
LFUN_LASTACTION // end of the table
|
||||
};
|
||||
|
@ -2190,6 +2190,26 @@ void LyXAction::init()
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_VC_REPO_UPDATE, "vc-repo-update", ReadOnly, System },
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_VC_COMPARE
|
||||
* \li Action: Compares two revisions of the same file under version control.
|
||||
* \li Notion: This is currently implemented only for SVN.
|
||||
* \li Syntax: vc-compare <REV1> [<REV2>]
|
||||
* \li Params: Revision number either points directly to commit in history
|
||||
or - if negative number -x - it points to last commit - x.
|
||||
Special case "0" is reserved for the last committed revision.\n
|
||||
<REV1>: Older file.\n
|
||||
<REV2>: Newer file. Used only if REV1 > 0.
|
||||
* \li Sample: Compare current document against last commit\n
|
||||
vc-compare 0
|
||||
* \li Sample: Compare current document against current revision - 5 commits\n
|
||||
vc-compare -5
|
||||
* \li Sample: Compare revisions 120 and 155\n
|
||||
vc-compare 120 155
|
||||
* \li Origin: sanda, 12 Feb 2010
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_VC_COMPARE, "vc-compare", ReadOnly, System },
|
||||
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_CHANGES_TRACK
|
||||
|
@ -1601,6 +1601,10 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
|
||||
enable = false;
|
||||
break;
|
||||
}
|
||||
case LFUN_VC_COMPARE:
|
||||
enable = doc_buffer && !cmd.argument().empty()
|
||||
&& doc_buffer->lyxvc().prepareFileRevisionEnabled();
|
||||
break;
|
||||
|
||||
case LFUN_SERVER_GOTO_FILE_ROW:
|
||||
break;
|
||||
@ -2573,6 +2577,33 @@ void GuiView::dispatchVC(FuncRequest const & cmd)
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_VC_COMPARE: {
|
||||
if (!isStrInt(cmd.getArg(0)))
|
||||
break;
|
||||
int rev1 = convert<int>(cmd.getArg(0));
|
||||
string f1, f2;
|
||||
|
||||
// f1
|
||||
if (!buffer->lyxvc().prepareFileRevision(rev1, f1))
|
||||
break;
|
||||
|
||||
if (rev1 <= 0) {
|
||||
f2 = buffer->absFileName();
|
||||
} else {
|
||||
string arg2 = cmd.getArg(1);
|
||||
if (arg2.empty() || !isStrInt(arg2))
|
||||
break;
|
||||
int rev2 = convert<int>(arg2);
|
||||
// f2
|
||||
if (!buffer->lyxvc().prepareFileRevision(rev2, f2))
|
||||
break;
|
||||
}
|
||||
// FIXME We need to call comparison feature here
|
||||
// I'm not sure whether with or without dialog.
|
||||
// (Gui)Compare::compare(f1, f2);
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user