<commit_before>/******************************************************************************\
* File:          vcs.h
* Purpose:       Declaration of wxExVCS class
* Author:        <NAME>
* RCS-ID:        $Id$
*
* Copyright (c) 1998-2009, <NAME>
* All rights are reserved. Reproduction in whole or part is prohibited
* without the written consent of the copyright owner.
\******************************************************************************/

#ifndef _EXVCS_H
#define _EXVCS_H

#include <wx/extension/filename.h>

class wxExSTCEntryDialog;

/// This class collects all vcs handling.
class wxExVCS
{
public:
  /// VCS types supported.
  /// See also defs.h, and do not exceed VCS_MAX_COMMANDS.
  enum wxExCommand
  {
    VCS_NO_COMMAND, ///< not ok value
    VCS_ADD,      ///< vcs add
    VCS_BLAME,    ///< vcs blame
    VCS_CAT,      ///< vcs cat
    VCS_COMMIT,   ///< vcs commit
    VCS_DIFF,     ///< vcs diff
    VCS_HELP,     ///< vcs help
    VCS_INFO,     ///< vcs info
    VCS_LOG,      ///< vcs log
    VCS_LS,       ///< vcs ls
    VCS_PROPLIST, ///< vcs prop list
    VCS_PROPSET,  ///< vcs prop set
    VCS_PUSH,     ///< vcs push
    VCS_REVERT,   ///< vcs revert
    VCS_SHOW,     ///< vcs show
    VCS_STAT,     ///< vcs stat
    VCS_UPDATE,   ///< vcs update
  };

  /// Default constructor.
  wxExVCS();

  /// Constructor, specify the command and a filename.
  wxExVCS(wxExCommand command, const wxExFileName& filename = wxExFileName());

  /// Constructor, specify the command id and a filename.
  wxExVCS(int command_id, const wxExFileName& filename = wxExFileName());

#if wxUSE_GUI
  /// Shows a dialog with options, returns dialog return code.
  int ConfigDialog(
    wxWindow* parent,
    const wxString& title = _("Set VCS And Comparator")) const;
#endif    

  /// Returns true if specified filename (a path) is a vcs directory.
  bool DirExists(const wxFileName& filename) const;

  /// Executes the vcs command, and collects the output.
  long Execute();

#if wxUSE_GUI
  /// Shows a dialog and executes the vcs command if not cancelled.
  /// If no fullpath was specified, a dialog with base folder is shown, 
  /// otherwise the specified fullpath is used for getting vcs contents from.
  /// Returns wxID_CANCEL if dialog was cancelled, wxID_OK if okay, 
  /// or wxID_ABORT if errors were reported by vcs otherwise.
  wxStandardID ExecuteDialog(wxWindow* parent);
#endif    

  /// Returns the vcs object.
  static wxExVCS* Get(bool createOnDemand = true);

  /// Gets the command.
  const wxExCommand GetCommand() const {return m_Command;};

  /// Gets the command string (without the 'vcs') used to get the output.
  const wxString& GetCommandString() const {return m_CommandString;};

  /// Gets the flags and command (without the 'vcs') used to get the output.
  const wxString& GetCommandWithFlags() const {return m_CommandWithFlags;};

  /// Gets the output from Execute.
  const wxString& GetOutput() const {return m_Output;};

  /// Returns true if this command can behave like
  /// opening a file.  
  bool IsOpenCommand() const;

#if wxUSE_GUI
  /// Combines all in one method. Shows the dialog,
  /// executes if not cancelled, and shows output in the STC dialog.
  /// Returns return code from execute.
  wxStandardID Request(wxWindow* parent);
#endif  

  /// Sets the object as the current one, returns the pointer 
  /// to the previous current object 
  /// (both the parameter and returned value may be NULL). 
  static wxExVCS* Set(wxExVCS* vcs);

#if wxUSE_GUI
  /// Shows output from Execute in a dialog only.
  void ShowOutput(wxWindow* parent) const;
#endif  

  /// Does current vcs allow keyword expansion.
  bool SupportKeywordExpansion() const;

  /// Returns true if VCS usage is set in the config.
  bool Use() const;
private:
  enum wxExSystem
  {
    VCS_NONE, ///< no version control
    VCS_GIT,  ///< GIT version control
    VCS_SVN,  ///< Subversion version control
    VCS_AUTO, ///< Uses the VCS appropriate for current file
  };

  bool CheckGIT(const wxFileName& fn) const;
  bool CheckSVN(const wxFileName& fn) const;
  wxExCommand GetType(int command_id) const;
  /// Gets the VCS system used.
  long GetVCS(const wxFileName& filename = wxFileName()) const;
  const wxString GetVCSName() const;
  void Initialize();
  int ShowDialog(wxWindow* parent);
  bool UseFlags() const;
  bool UseSubcommand() const;

  const wxExCommand m_Command;
  const wxExFileName m_FileName;

  wxString m_Caption;
  wxString m_CommandString;
  wxString m_CommandWithFlags;
  wxString m_Output;

  wxString m_FlagsKey;

  static wxExVCS* m_Self;
#if wxUSE_GUI
  static wxExSTCEntryDialog* m_STCEntryDialog;
#endif  
};
#endif
<commit_msg>improved comments<commit_after>/******************************************************************************\
* File:          vcs.h
* Purpose:       Declaration of wxExVCS class
* Author:        <NAME>
* RCS-ID:        $Id$
*
* Copyright (c) 1998-2009, <NAME>
* All rights are reserved. Reproduction in whole or part is prohibited
* without the written consent of the copyright owner.
\******************************************************************************/

#ifndef _EXVCS_H
#define _EXVCS_H

#include <wx/extension/filename.h>

class wxExSTCEntryDialog;

/// This class collects all vcs handling.
class wxExVCS
{
public:
  /// VCS types supported.
  /// See also defs.h, and do not exceed VCS_MAX_COMMANDS.
  enum wxExCommand
  {
    VCS_NO_COMMAND, ///< not ok value
    VCS_ADD,      ///< vcs add
    VCS_BLAME,    ///< vcs blame
    VCS_CAT,      ///< vcs cat
    VCS_COMMIT,   ///< vcs commit
    VCS_DIFF,     ///< vcs diff
    VCS_HELP,     ///< vcs help
    VCS_INFO,     ///< vcs info
    VCS_LOG,      ///< vcs log
    VCS_LS,       ///< vcs ls
    VCS_PROPLIST, ///< vcs prop list
    VCS_PROPSET,  ///< vcs prop set
    VCS_PUSH,     ///< vcs push
    VCS_REVERT,   ///< vcs revert
    VCS_SHOW,     ///< vcs show
    VCS_STAT,     ///< vcs stat
    VCS_UPDATE,   ///< vcs update
  };

  /// Default constructor.
  wxExVCS();

  /// Constructor, specify the command and a filename.
  wxExVCS(wxExCommand command, const wxExFileName& filename = wxExFileName());

  /// Constructor, specify the command id and a filename.
  wxExVCS(int command_id, const wxExFileName& filename = wxExFileName());

#if wxUSE_GUI
  /// Shows a dialog with options, returns dialog return code.
  int ConfigDialog(
    wxWindow* parent,
    const wxString& title = _("Set VCS And Comparator")) const;
#endif    

  /// Returns true if specified filename (a path) is a vcs directory.
  bool DirExists(const wxFileName& filename) const;

  /// Executes the vcs command, and collects the output.
  long Execute();

#if wxUSE_GUI
  /// Shows a dialog and executes the vcs command if not cancelled.
  /// If no fullpath was specified, a dialog with base folder is shown, 
  /// otherwise the specified fullpath is used for getting vcs contents from.
  /// Returns wxID_CANCEL if dialog was cancelled, wxID_OK if okay, 
  /// or wxID_ABORT if errors were reported by vcs otherwise.
  wxStandardID ExecuteDialog(wxWindow* parent);
#endif    

  /// Returns the vcs object.
  static wxExVCS* Get(bool createOnDemand = true);

  /// Gets the command.
  const wxExCommand GetCommand() const {return m_Command;};

  /// Gets the command string (without the 'vcs') used to get the output.
  const wxString& GetCommandString() const {return m_CommandString;};

  /// Gets the flags and command (without the 'vcs') used to get the output.
  const wxString& GetCommandWithFlags() const {return m_CommandWithFlags;};

  /// Gets the output from Execute.
  const wxString& GetOutput() const {return m_Output;};

  /// Returns true if this command can behave like
  /// opening a file.  
  bool IsOpenCommand() const;

#if wxUSE_GUI
  /// Combines all in one method. Calls the ExecuteDialog,
  /// executes if not cancelled, and calls ShowOutput.
  /// Returns return code from execute.
  wxStandardID Request(wxWindow* parent);
#endif  

  /// Sets the object as the current one, returns the pointer 
  /// to the previous current object 
  /// (both the parameter and returned value may be NULL). 
  static wxExVCS* Set(wxExVCS* vcs);

#if wxUSE_GUI
  /// Shows output from Execute in a dialog.
  void ShowOutput(wxWindow* parent) const;
#endif  

  /// Does current vcs allow keyword expansion.
  bool SupportKeywordExpansion() const;

  /// Returns true if VCS usage is set in the config.
  bool Use() const;
private:
  enum wxExSystem
  {
    VCS_NONE, ///< no version control
    VCS_GIT,  ///< GIT version control
    VCS_SVN,  ///< Subversion version control
    VCS_AUTO, ///< Uses the VCS appropriate for current file
  };

  bool CheckGIT(const wxFileName& fn) const;
  bool CheckSVN(const wxFileName& fn) const;
  wxExCommand GetType(int command_id) const;
  /// Gets the VCS system used.
  long GetVCS(const wxFileName& filename = wxFileName()) const;
  const wxString GetVCSName() const;
  void Initialize();
  int ShowDialog(wxWindow* parent);
  bool UseFlags() const;
  bool UseSubcommand() const;

  const wxExCommand m_Command;
  const wxExFileName m_FileName;

  wxString m_Caption;
  wxString m_CommandString;
  wxString m_CommandWithFlags;
  wxString m_Output;

  wxString m_FlagsKey;

  static wxExVCS* m_Self;
#if wxUSE_GUI
  static wxExSTCEntryDialog* m_STCEntryDialog;
#endif  
};
#endif

{'fraction_non_alphanumeric': 0.1295744680851064, 'fraction_numerical': 0.001702127659574468, 'mean_word_length': 3.0644185041072203, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2262140', 'n_tokens_mistral': 2983, 'n_tokens_neox': 2889, 'n_words': 1038}