LFUN_WORD_FINDADV, // Tommaso, 20081003
LFUN_REGEXP_MODE, // Tommaso, 20081003
LFUN_COPY_LABEL_AS_REF, // sts, 20081116
+ // 320
+ LFUN_VC_COMMAND,
LFUN_LASTACTION // end of the table
};
* \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
+ additonal 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
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_WORD_FINDADV:
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.