mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-13 17:20:55 +00:00
Backport LFUN_VC_COMMAND
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@28151 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
7c78f0e483
commit
0d8ca0d309
@ -1,4 +1,4 @@
|
||||
#LyX 1.6.0 created this file. For more info see http://www.lyx.org/
|
||||
#LyX 1.6.1 created this file. For more info see http://www.lyx.org/
|
||||
\lyxformat 345
|
||||
\begin_document
|
||||
\begin_header
|
||||
@ -76,6 +76,7 @@ End
|
||||
\font_osf false
|
||||
\font_sf_scale 100
|
||||
\font_tt_scale 100
|
||||
|
||||
\graphics default
|
||||
\paperfontsize 12
|
||||
\spacing single
|
||||
@ -109,10 +110,10 @@ End
|
||||
\papercolumns 1
|
||||
\papersides 2
|
||||
\paperpagestyle headings
|
||||
\tracking_changes false
|
||||
\tracking_changes true
|
||||
\output_changes false
|
||||
\author ""
|
||||
\author ""
|
||||
\author "pavel"
|
||||
\author ""
|
||||
\end_header
|
||||
|
||||
\begin_body
|
||||
@ -16881,6 +16882,17 @@ Later basic CVS/SVN support was added.
|
||||
\begin_layout Standard
|
||||
The implementation in LyX assumes a recent version of the GNU RCS or CVS/SVN
|
||||
package---no guarantees are made for older versions.
|
||||
\change_inserted 0 1231929523
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
|
||||
\change_inserted 0 1231929529
|
||||
For introducing your own external commands consult vc-command in the manual
|
||||
of LyX functions.
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsection
|
||||
|
@ -1,4 +1,4 @@
|
||||
#LyX 1.6.1 created this file. For more info see http://www.lyx.org/
|
||||
#LyX 1.6.2svn created this file. For more info see http://www.lyx.org/
|
||||
\lyxformat 345
|
||||
\begin_document
|
||||
\begin_header
|
||||
@ -49,7 +49,7 @@ theorems-ams
|
||||
\begin_body
|
||||
|
||||
\begin_layout Section*
|
||||
LFUNs documentation automatically generated 11.01.2009.
|
||||
LFUNs documentation automatically generated 14.01.2009.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
@ -4016,6 +4016,65 @@ Syntax vc-check-out
|
||||
Origin Lgb, 1 Jul 1997
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsection*
|
||||
LFUN_VC_COMMAND
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
Action Executes external command.
|
||||
This command is intended to support additional VCS commands.
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
Syntax vc-command <FLAG> <PATH> <COMMAND>
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
Params <FLAG>: Flags for the command can be combined together.
|
||||
|
||||
\begin_inset Newline newline
|
||||
\end_inset
|
||||
|
||||
U - dUmmy - no flags
|
||||
\begin_inset Newline newline
|
||||
\end_inset
|
||||
|
||||
D - Doc - need document loaded to proceed
|
||||
\begin_inset Newline newline
|
||||
\end_inset
|
||||
|
||||
I - dIrty - mark document dirty
|
||||
\begin_inset Newline newline
|
||||
\end_inset
|
||||
|
||||
R - Reload - reload the document after command execution
|
||||
\begin_inset Newline newline
|
||||
\end_inset
|
||||
|
||||
M - Message - ask for input string (commit message)
|
||||
\begin_inset Newline newline
|
||||
\end_inset
|
||||
|
||||
<PATH>: path where to start.
|
||||
$$p will be replaced by the current document path.
|
||||
|
||||
\begin_inset Newline newline
|
||||
\end_inset
|
||||
|
||||
<COMMAND>: command to execute.
|
||||
$$i/$$p/$$m will be replaced by the current document/path/message.
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
Sample vc-command DR $$p "svn up"
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
Origin sanda, 13 Jan 2009
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsection*
|
||||
LFUN_CHANGES_TRACK
|
||||
\end_layout
|
||||
|
@ -410,6 +410,7 @@ enum FuncCode
|
||||
// 315
|
||||
LFUN_TAB_INSERT,
|
||||
LFUN_TAB_DELETE,
|
||||
LFUN_VC_COMMAND,
|
||||
LFUN_LASTACTION // end of the table
|
||||
};
|
||||
|
||||
|
@ -1959,6 +1959,24 @@ void LyXAction::init()
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_VC_UNDO_LAST, "vc-undo-last", ReadOnly, System },
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_VC_COMMAND
|
||||
* \li Action: Executes external command. This command is intended to support
|
||||
additional VCS commands.
|
||||
* \li Syntax: vc-command <FLAG> <PATH> <COMMAND>
|
||||
* \li Params: <FLAG>: Flags for the command can be combined together.\n
|
||||
U - dUmmy - no flags \n
|
||||
D - Doc - need document loaded to proceed \n
|
||||
I - dIrty - mark document dirty \n
|
||||
R - Reload - reload the document after command execution \n
|
||||
M - Message - ask for input string (commit message)\n
|
||||
<PATH>: path where to start. $$p will be replaced by the current document path.\n
|
||||
<COMMAND>: command to execute. $$i/$$p/$$m will be replaced by the current document/path/message.
|
||||
* \li Sample: vc-command DR $$p "svn up"
|
||||
* \li Origin: sanda, 13 Jan 2009
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_VC_COMMAND, "vc-command", NoBuffer | ReadOnly, System },
|
||||
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_CHANGES_TRACK
|
||||
|
@ -566,6 +566,15 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_VC_COMMAND: {
|
||||
if (cmd.argument().empty())
|
||||
enable = false;
|
||||
|
||||
if (!buf && contains(cmd.getArg(0), 'D'))
|
||||
enable = false;
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_WORD_FIND_FORWARD:
|
||||
case LFUN_WORD_FIND_BACKWARD:
|
||||
case LFUN_COMMAND_PREFIX:
|
||||
@ -1589,6 +1598,48 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
theSession().bookmarks().clear();
|
||||
break;
|
||||
|
||||
case LFUN_VC_COMMAND: {
|
||||
string flag = cmd.getArg(0);
|
||||
if (buffer && contains(flag, 'R') && !ensureBufferClean(view()))
|
||||
break;
|
||||
docstring message;
|
||||
if (contains(flag, 'M'))
|
||||
if (!Alert::askForText(message, _("LyX VC: Log Message")))
|
||||
break;
|
||||
|
||||
string path = cmd.getArg(1);
|
||||
if (contains(path, "$$p") && buffer)
|
||||
path = subst(path, "$$p", buffer->filePath());
|
||||
LYXERR(Debug::LYXVC, "Directory: " << path);
|
||||
FileName pp(path);
|
||||
if (!pp.isReadableDirectory()) {
|
||||
lyxerr<< _("Directory is not readable.\n");
|
||||
break;
|
||||
}
|
||||
support::PathChanger p(pp);
|
||||
|
||||
string command = cmd.getArg(2);
|
||||
if (command.empty())
|
||||
break;
|
||||
if (buffer) {
|
||||
command = subst(command, "$$i", buffer->absFileName());
|
||||
command = subst(command, "$$p", buffer->filePath());
|
||||
}
|
||||
command = subst(command, "$$m", to_utf8(message));
|
||||
LYXERR(Debug::LYXVC, "Command: " << command);
|
||||
Systemcall one;
|
||||
one.startscript(Systemcall::Wait, command);
|
||||
|
||||
if (!buffer)
|
||||
break;
|
||||
if (contains(flag, 'I'))
|
||||
buffer->markDirty();
|
||||
if (contains(flag, 'R'))
|
||||
reloadBuffer();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
LASSERT(theApp(), /**/);
|
||||
// Let the frontend dispatch its own actions.
|
||||
|
@ -70,6 +70,9 @@ What's new
|
||||
even when the name in the BibTeX file is "John Doe" rather than
|
||||
"Doe, John".
|
||||
|
||||
- Added LFUN_VC_COMMAND to support customizable user commands
|
||||
for version control.
|
||||
|
||||
* WINDOWS INSTALLER
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user