# eric6.Plugins.VcsPlugins.vcsGit.GitDiffGenerator

Module implementing a class to generate the output of the git diff command process.

### Global Attributes

None

### Classes

GitDiffGenerator | Class implementing the generation of output of the git diff command.

### Functions

None

## GitDiffGenerator

Class implementing the generation of output of the git diff command.

### Signals

finished()
  emitted when all processes have finished

### Derived from

QObject

### Class Attributes

None

### Class Methods

None

### Methods

GitDiffGenerator | Constructor
__procFinished | Private slot connected to the finished signal.
__processFileLine | Private slot to process a line giving the old/new file.
__processLine | Private method to process one line of output.
__readStderr | Private slot to handle the readyReadStandardError signal.
__readStdout | Private slot to handle the readyReadStandardOutput signal.
getResult | Public method to return the result data.
start | Public slot to start the git diff command.
stopProcesses | Public slot to stop the diff processes.

### Static Methods

None

#### GitDiffGenerator (Constructor)

GitDiffGenerator(vcs, parent=None)

Constructor

vcs
  reference to the vcs object
parent
  parent widget (QWidget)

#### GitDiffGenerator.__procFinished

__procFinished(exitCode, exitStatus)

Private slot connected to the finished signal.

exitCode
  exit code of the process (integer)
exitStatus
  exit status of the process (QProcess.ExitStatus)

#### GitDiffGenerator.__processFileLine

__processFileLine(line, isTopDiff)

Private slot to process a line giving the old/new file.

line
  line to be processed (string)
isTopDiff
  flag indicating to show the output in the top output widget (boolean)

#### GitDiffGenerator.__processLine

__processLine(line, isTopDiff)

Private method to process one line of output.

line
  output line to process (string)
isTopDiff
  flag indicating to show the output in the top output widget (boolean)

#### GitDiffGenerator.__readStderr

__readStderr(process)

Private slot to handle the readyReadStandardError signal.

It reads the error output of the process and inserts it into the error pane.

process (QProcess)
  reference to the process providing error output

#### GitDiffGenerator.__readStdout

__readStdout(process)

Private slot to handle the readyReadStandardOutput signal.

It reads the output of the process, formats it and inserts it into the contents pane.

process (QProcess)
  reference to the process providing output

#### GitDiffGenerator.getResult

getResult()

Public method to return the result data.

Returns:
  tuple of lists of string containing lines of the diff, the diff between stage and repo for 'work2stage2repo' mode (empty otherwise), the list of errors and a list of tuples of filenames and the line into the diff output.

#### GitDiffGenerator.start

start(fn, versions=None, diffMode="work2repo", stashName="")

Public slot to start the git diff command.

fn
  filename to be diffed (string)
versions
  list of versions to be diffed (list of up to 2 strings or None)
diffMode
  indication for the type of diff to be performed ( 'work2repo' compares the working tree with the HEAD commit, 'work2stage' compares the working tree with the staging area, 'stage2repo' compares the staging area with the HEAD commit, 'work2stage2repo' compares the working tree with the staging area and the staging area with the HEAD commit, 'stash' shows the diff for a stash)
stashName
  name of the stash to show a diff for (string)

Returns:
  flag indicating the start status (boolean)

#### GitDiffGenerator.stopProcesses

stopProcesses()

Public slot to stop the diff processes.

Up