wex  v21.04.0
Public Member Functions | List of all members
wex::vcs_entry Class Reference

This class collects a single vcs. More...

#include <wex/vcs-entry.h>

Inheritance diagram for wex::vcs_entry:
Inheritance graph
[legend]

Public Member Functions

 vcs_entry (const pugi::xml_node &node=pugi::xml_node())
 Default constructor using xml node.
 
const auto & admin_dir () const
 Returns the administrative directory.
 
size_t build_menu (int base_id, menu *menu) const
 Builds a menu from all vcs commands. More...
 
bool execute (const std::string &args=std::string(), const lexer &lexer=wex::lexer(), const std::string &wd=std::string())
 Executes the current vcs command (from SetCommand), or the first command if SetCommand was not yet invoked. More...
 
bool execute (const std::string &command, const std::string &wd)
 Executes the command. More...
 
auto flags_location () const
 Returns flags location.
 
const blameget_blame () const
 Returns blame info.
 
const std::string get_branch (const std::string &wd=std::string()) const
 Returns the name of current branch.
 
const std::string get_flags () const
 Returns the flags used to run the command.
 
bool log (const path &p, const std::string &id)
 Executes the log command using the log id to be retrieved. More...
 
void show_output (const std::string &caption=std::string()) const override
 Shows stdout or stderr from execute on the shell component. More...
 
- Public Member Functions inherited from wex::process
 process ()
 Other methods. More...
 
virtual ~process ()
 Destructor.
 
 process (const process &process)
 Copy constructor.
 
processoperator= (const process &p)
 Assignment operator.
 
bool execute (const std::string &command=std::string(), exec_t type=EXEC_NO_WAIT, const std::string &wd=std::string())
 Executes the process. More...
 
const auto & get_exec () const
 Returns command.
 
auto * get_frame ()
 Returns the frame.
 
const auto & get_stderr () const
 Returns the stderr.
 
const auto & get_stdout () const
 Returns the stdout.
 
bool is_debug () const
 Is this a debug process.
 
bool is_running () const
 Returns true if this process is running.
 
bool stop ()
 Stops this process. More...
 
bool write (const std::string &text)
 Writes text to stdin of process. More...
 
- Public Member Functions inherited from wex::menu_commands< vcs_command >
 menu_commands (const std::string &name=std::string(), const std::vector< vcs_command > &commands={})
 Default constructor.
 
 menu_commands (const pugi::xml_node &node)
 Constructor using xml node.
 
const vcs_command find (const std::string &name) const
 Returns the menu command equal to name specified. More...
 
const auto & flags_key () const
 Returns the flags key.
 
const auto get_command () const
 Returns the current command.
 
const auto & get_commands () const
 Returns all the commands.
 
const auto & name () const
 Returns the name for this group of commands.
 
bool set_command (int command_no)
 Sets the current command. More...
 

Additional Inherited Members

- Public Types inherited from wex::process
enum  exec_t { EXEC_NO_WAIT , EXEC_WAIT }
 process execute type More...
 
- Static Public Member Functions inherited from wex::process
static int config_dialog (const data::window &data=data::window())
 Static interface. More...
 
static auto * get_shell ()
 Returns the shell component (might be nullptr if prepare_output is not yet invoked).
 
static shellprepare_output (wxWindow *parent)
 Construct the shell component, and returns it.
 

Detailed Description

This class collects a single vcs.

Member Function Documentation

◆ build_menu()

size_t wex::vcs_entry::build_menu ( int  base_id,
menu menu 
) const

Builds a menu from all vcs commands.

Returns (total) number of items in menu.

Parameters
base_idmenu id to be added to the vcs commands
menumenu to be built

◆ execute() [1/2]

bool wex::vcs_entry::execute ( const std::string &  args = std::string(),
const lexer lexer = wex::lexer(),
const std::string &  wd = std::string() 
)

Executes the current vcs command (from SetCommand), or the first command if SetCommand was not yet invoked.

Might ask for vcs binary if it is not yet known. Return code is code from process Execute, and also can be false if dialog for vcs bin was cancelled.

Parameters
argsargs, like filenames, or vcs flags
lexerlexer that is used for presenting the output
wdworking directory

◆ execute() [2/2]

bool wex::vcs_entry::execute ( const std::string &  command,
const std::string &  wd 
)

Executes the command.

Return value is false if process could not execute.

Parameters
commandcommand to be executed
wdworking dir

◆ log()

bool wex::vcs_entry::log ( const path p,
const std::string &  id 
)

Executes the log command using the log id to be retrieved.

Return value is false if process could not execute.

Parameters
ppath to be used
idid to be retrieved

◆ show_output()

void wex::vcs_entry::show_output ( const std::string &  caption = std::string()) const
overridevirtual

Shows stdout or stderr from execute on the shell component.

You can override this method to e.g. prepare a lexer on get_shell before calling this base method.

Reimplemented from wex::process.