wex  v20.04.0
Public Member Functions | Static Public Member Functions | List of all members
wex::vcs Class Reference

This class collects all vcs handling. More...

#include <wex/vcs.h>

Public Member Functions

 vcs (const std::vector< path > &files=std::vector< path >(), int command_no=-1)
 Other methods. More...
 
int config_dialog (const window_data &data=window_data()) const
 Shows a dialog allowing you to choose which vcs to use and to set the path for each vcs entry. More...
 
auto & entry ()
 Returns the current vcs entry.
 
const auto & entry () const
 Returns the current vcs entry.
 
bool execute ()
 Executes the current vcs command for the current vcs entry, and collects the output. More...
 
bool execute (const std::string &command)
 Executes the specified command (git, svn subcommand). More...
 
const std::string get_branch () const
 Returns branch for current vcs entry, or empty string if vcs is not used.
 
const std::string name () const
 Returns name for current vcs entry, or empty string if vcs is not used.
 
wxStandardID request (const window_data &data=window_data())
 Combines show_dialog, execute and vcs entry show_output in one method. More...
 
bool set_entry_from_base (wxWindow *parent=nullptr)
 Sets the vcs entry using base folder. More...
 
int show_dialog (const window_data &data=window_data())
 Shows dialog for the current vcs entry.
 
bool use () const
 Returns true if vcs usage is set in the config.
 

Static Public Member Functions

static bool dir_exists (const path &filename)
 Static interface. More...
 
static bool load_document ()
 Loads all entries (first clears them) from vcs document. More...
 
static auto size ()
 Returns the number of vcs entries.
 

Detailed Description

This class collects all vcs handling.

The VCS entries are loaded from menus.xml, this is done during app startup.

Constructor & Destructor Documentation

◆ vcs()

wex::vcs::vcs ( const std::vector< path > &  files = std::vector< path >(),
int  command_no = -1 
)

Other methods.

Default constructor.

Parameters
filesSpecify several files for which you want vcs action. Sets the vcs entry for first of the specified files, or to the base folder if vector is empty.
command_noThe command no that is used to set the current vcs command (index in vcs entry commands).

Member Function Documentation

◆ config_dialog()

int wex::vcs::config_dialog ( const window_data data = window_data()) const

Shows a dialog allowing you to choose which vcs to use and to set the path for each vcs entry.

Returns dialog return code.

◆ dir_exists()

static bool wex::vcs::dir_exists ( const path filename)
static

Static interface.

Returns true if specified filename (a path) is a vcs directory.

◆ execute() [1/2]

bool wex::vcs::execute ( )

Executes the current vcs command for the current vcs entry, and collects the output.

Returns return code from vcs entry execute.

◆ execute() [2/2]

bool wex::vcs::execute ( const std::string &  command)

Executes the specified command (git, svn subcommand).

Return value is false if process could not execute.

◆ load_document()

static bool wex::vcs::load_document ( )
static

Loads all entries (first clears them) from vcs document.

Returns true if document is loaded.

◆ request()

wxStandardID wex::vcs::request ( const window_data data = window_data())

Combines show_dialog, execute and vcs entry show_output in one method.

  • Returns wxID_CANCEL if dialog was cancelled, or an execute error occurred.
  • Returns wxID_OK if okay (use vcs entry error to check whether the output contains errors or normal info).

◆ set_entry_from_base()

bool wex::vcs::set_entry_from_base ( wxWindow *  parent = nullptr)

Sets the vcs entry using base folder.

If not, it will show a dialog for selecting a vcs folder (if parent is not nullptr). Returns true if entry is under vcs control.

Parameters
parentParent window for showing dir dialog if there is not a current directory.