wex v24.10.0
|
This class collects all vcs handling. More...
#include <wex/vcs/vcs.h>
Public Types | |
typedef std::vector< vcs_entry > | store_t |
The store is a vector of vcs entries. | |
Public Member Functions | |
vcs (const std::vector< wex::path > &files=std::vector< wex::path >(), int command_no=-1) | |
Default constructor. | |
int | config_dialog (const data::window &data=data::window()) const |
Shows a dialog allowing you to choose which vcs to use and to set the path for each vcs entry. | |
auto & | entry () |
Returns the current writeable vcs entry. | |
const auto & | entry () const |
Returns the current readonly vcs entry. | |
bool | execute () |
Executes the current vcs command for the current vcs entry, and collects the output. | |
bool | execute (const std::string &command) |
Executes the specified command (git, svn subcommand). | |
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 data::window &data=data::window()) |
Combines show_dialog, execute and vcs entry show_output in one method. | |
void | set (const wex::path &p) |
Sets the vector of paths to specified path. | |
bool | set_entry_from_base (wxWindow *parent=nullptr) |
Sets the vcs entry using base folder. | |
int | show_dialog (const data::window &data=data::window()) |
Shows dialog for the current vcs entry. | |
path | toplevel () const |
Returns toplevel dir. | |
bool | use () const |
Returns true if vcs usage is set in the config. | |
bool | is_dir_excluded (const path &p) const override |
Returns true if dir is to be excluded. | |
bool | is_file_excluded (const path &p) const override |
Returns true if file is set to be excluded. | |
bool | setup_exclude (const path &dir) override |
Sets up the exclude files or dirs, return true if anything was added. | |
Public Member Functions inherited from wex::factory::vcs | |
virtual | ~vcs ()=default |
Destructor. | |
bool | is_setup () const |
Returns whether setup was ok. | |
Static Public Member Functions | |
static void | destroy_dialog () |
Destroys dialog. | |
static bool | dir_exists (const path &filename) |
Returns true if specified filename (a path) is a vcs directory. | |
static bool | empty () |
Returns true if vcs is empty. | |
static bool | load_document () |
Loads all entries (first clears them) from vcs document. | |
static void | on_exit () |
Exits vcs, cleans up store. | |
static void | on_init () |
Initializes the vcs store and loads document. | |
static size_t | size () |
Returns the number of vcs entries. | |
Additional Inherited Members | |
Protected Member Functions inherited from wex::factory::vcs | |
bool | is_setup (bool rhs) |
Sets the setup member, and return value. | |
This class collects all vcs handling.
The VCS entries are loaded from menus.xml, this is done during app startup.
wex::vcs::vcs | ( | const std::vector< wex::path > & | files = std::vector< wex::path >(), |
int | command_no = -1 ) |
Default constructor.
files | Specify 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_no | The command no that is used to set the current vcs command (index in vcs entry commands). |
int wex::vcs::config_dialog | ( | const data::window & | data = data::window() | ) | 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.
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.
bool wex::vcs::execute | ( | const std::string & | command | ) |
Executes the specified command (git, svn subcommand).
Return value is false if process could not execute.
|
overridevirtual |
Returns true if dir is to be excluded.
Default returns value of m_is_setup.
Reimplemented from wex::factory::vcs.
|
overridevirtual |
Returns true if file is set to be excluded.
Default returns value of m_is_setup.
Reimplemented from wex::factory::vcs.
|
static |
Loads all entries (first clears them) from vcs document.
Returns true if document is loaded.
|
static |
Exits vcs, cleans up store.
The wex::del::app::OnExit takes care of this.
|
static |
Initializes the vcs store and loads document.
The wex::del::app::OnInit takes care of this.
wxStandardID wex::vcs::request | ( | const data::window & | data = data::window() | ) |
Combines show_dialog, execute and vcs entry show_output in one method.
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.
parent | Parent window for showing dir dialog if there is not a current directory. |
|
overridevirtual |
Sets up the exclude files or dirs, return true if anything was added.
You should invoke is_setup(true) if anything was added. Default returns false.
dir | The path to start with. |
Reimplemented from wex::factory::vcs.