VCS: Introduce Base class for VCS plugins, use in git.

Fixes:
- Cannot diff a file that does not belong to a project
- Cannot commit when a temporary diff/log view is open
  due to the current file pointing to a temporary directory
- git's project-related actions not passing the correct
  relative path.

Implementation:
- Centralize code to listen for Qt Creator's relevant state changes
  in VCSBasePlugin, dispatching the changes to the instances affected.
  (avoiding multiple invocations of searches/QFileInfo on current).
- Do the same for the corelistener catching closing SubmitEditors.
- Introduce VCSBasePluginState representing the relevant state
  (current file/project).
- Call git with working directory set and relative arguments
- Remove setEnabled/isEnabled() logic of IVersionControl
- Pass toplevel from VCSManager to avoid duplicate searches.
This commit is contained in:
Friedemann Kleint
2009-12-08 14:26:41 +01:00
parent 8d6b4e51ab
commit 8097879d6d
31 changed files with 891 additions and 699 deletions

View File

@@ -128,6 +128,15 @@ public:
//Helper to go to line of editor if it is a text editor
static bool gotoLineOfEditor(Core::IEditor *e, int lineNumber);
// Convenience functions to determine the source to pass on to a diff
// editor if one has a call consisting of working directory and file arguments.
// ('git diff XX' -> 'XX' , 'git diff XX file' -> 'XX/file').
static QString getSource(const QString &workingDirectory, const QString &fileName);
static QString getSource(const QString &workingDirectory, const QStringList &fileNames);
// Convenience functions to determine an title/id to identify the editor
// from the arguments (','-joined arguments or directory).
static QString getTitleId(const QString &workingDirectory, const QStringList &fileNames);
signals:
void describeRequested(const QString &source, const QString &change);