Documentation/Source/eric6.Plugins.VcsPlugins.vcsGit.GitDiffParser.html

Sun, 10 Dec 2017 17:42:11 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 10 Dec 2017 17:42:11 +0100
changeset 6020
baf6da1ae288
permissions
-rw-r--r--

Added the git plug-in to the core plug-ins.

<!DOCTYPE html>
<html><head>
<title>eric6.Plugins.VcsPlugins.vcsGit.GitDiffParser</title>
<meta charset="UTF-8">
<style>
body {
    background: #EDECE6;
    margin: 0em 1em 10em 1em;
    color: black;
}

h1 { color: white; background: #85774A; }
h2 { color: white; background: #85774A; }
h3 { color: white; background: #9D936E; }
h4 { color: white; background: #9D936E; }
    
a { color: #BA6D36; }

</style>
</head>
<body><a NAME="top" ID="top"></a>
<h1>eric6.Plugins.VcsPlugins.vcsGit.GitDiffParser</h1>
<p>
Module implementing a class to store and parse diff output.
</p>
<h3>Global Attributes</h3>
<table>
<tr><td>None</td></tr>
</table>
<h3>Classes</h3>
<table>
<tr>
<td><a href="#GitDiffParser">GitDiffParser</a></td>
<td>Class implementing a class to store and parse diff output.</td>
</tr>
</table>
<h3>Functions</h3>
<table>
<tr><td>None</td></tr>
</table>
<hr /><hr />
<a NAME="GitDiffParser" ID="GitDiffParser"></a>
<h2>GitDiffParser</h2>
<p>
    Class implementing a class to store and parse diff output.
</p>
<h3>Derived from</h3>
object
<h3>Class Attributes</h3>
<table>
<tr><td>HunkHeaderRegexp</td></tr>
</table>
<h3>Class Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<h3>Methods</h3>
<table>
<tr>
<td><a href="#GitDiffParser.__init__">GitDiffParser</a></td>
<td>Constructor</td>
</tr><tr>
<td><a href="#GitDiffParser.__generateHunkHeader">__generateHunkHeader</a></td>
<td>Private method to generate a hunk header line.</td>
</tr><tr>
<td><a href="#GitDiffParser.__generateRange">__generateRange</a></td>
<td>Private method to generate a hunk header range.</td>
</tr><tr>
<td><a href="#GitDiffParser.__initHunk">__initHunk</a></td>
<td>Private method to initialize a hunk data structure.</td>
</tr><tr>
<td><a href="#GitDiffParser.__parseDiff">__parseDiff</a></td>
<td>Private method to parse the diff output.</td>
</tr><tr>
<td><a href="#GitDiffParser.__parseRange">__parseRange</a></td>
<td>Private method to parse the hunk header range part.</td>
</tr><tr>
<td><a href="#GitDiffParser.createHunkPatch">createHunkPatch</a></td>
<td>Public method to create a hunk based patch.</td>
</tr><tr>
<td><a href="#GitDiffParser.createLinesPatch">createLinesPatch</a></td>
<td>Public method to create a selected lines based patch.</td>
</tr><tr>
<td><a href="#GitDiffParser.headerLength">headerLength</a></td>
<td>Public method to get the header length.</td>
</tr>
</table>
<h3>Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>
<a NAME="GitDiffParser.__init__" ID="GitDiffParser.__init__"></a>
<h4>GitDiffParser (Constructor)</h4>
<b>GitDiffParser</b>(<i>diff</i>)
<p>
        Constructor
</p><dl>
<dt><i>diff</i></dt>
<dd>
output of the diff command (list of string)
</dd>
</dl><a NAME="GitDiffParser.__generateHunkHeader" ID="GitDiffParser.__generateHunkHeader"></a>
<h4>GitDiffParser.__generateHunkHeader</h4>
<b>__generateHunkHeader</b>(<i>oldStart, oldCount, newStart, newCount, heading=os.linesep</i>)
<p>
        Private method to generate a hunk header line.
</p><dl>
<dt><i>oldStart</i></dt>
<dd>
start line of the old part (integer)
</dd><dt><i>oldCount</i></dt>
<dd>
line count of the old part (integer)
</dd><dt><i>newStart</i></dt>
<dd>
start line of the new part (integer)
</dd><dt><i>newCount</i></dt>
<dd>
line count of the new part (integer)
</dd><dt><i>heading</i></dt>
<dd>
hunk heading (string)
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
hunk header (string)
</dd>
</dl><a NAME="GitDiffParser.__generateRange" ID="GitDiffParser.__generateRange"></a>
<h4>GitDiffParser.__generateRange</h4>
<b>__generateRange</b>(<i>start, count</i>)
<p>
        Private method to generate a hunk header range.
</p><dl>
<dt><i>start</i></dt>
<dd>
start line (integer)
</dd><dt><i>count</i></dt>
<dd>
line count (integer)
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
hunk header range (string)
</dd>
</dl><a NAME="GitDiffParser.__initHunk" ID="GitDiffParser.__initHunk"></a>
<h4>GitDiffParser.__initHunk</h4>
<b>__initHunk</b>(<i></i>)
<p>
        Private method to initialize a hunk data structure.
</p><dl>
<dt>Returns:</dt>
<dd>
hunk data structure (dictionary)
</dd>
</dl><a NAME="GitDiffParser.__parseDiff" ID="GitDiffParser.__parseDiff"></a>
<h4>GitDiffParser.__parseDiff</h4>
<b>__parseDiff</b>(<i></i>)
<p>
        Private method to parse the diff output.
</p><dl>
<dt>Raises <b>AssertionError</b>:</dt>
<dd>
raised when a malformed hunk header is
            encountered
</dd>
</dl><a NAME="GitDiffParser.__parseRange" ID="GitDiffParser.__parseRange"></a>
<h4>GitDiffParser.__parseRange</h4>
<b>__parseRange</b>(<i>headerRange</i>)
<p>
        Private method to parse the hunk header range part.
</p><dl>
<dt><i>headerRange</i></dt>
<dd>
hunk header range (string)
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
tuple of hunk start and hunk length (integer, integer)
</dd>
</dl><a NAME="GitDiffParser.createHunkPatch" ID="GitDiffParser.createHunkPatch"></a>
<h4>GitDiffParser.createHunkPatch</h4>
<b>createHunkPatch</b>(<i>lineIndex</i>)
<p>
        Public method to create a hunk based patch.
</p><dl>
<dt><i>lineIndex</i></dt>
<dd>
line number of the hunk (integer)
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
diff lines of the patch (string)
</dd>
</dl><a NAME="GitDiffParser.createLinesPatch" ID="GitDiffParser.createLinesPatch"></a>
<h4>GitDiffParser.createLinesPatch</h4>
<b>createLinesPatch</b>(<i>startIndex, endIndex, reverse=False</i>)
<p>
        Public method to create a selected lines based patch.
</p><dl>
<dt><i>startIndex</i></dt>
<dd>
start line number (integer)
</dd><dt><i>endIndex</i></dt>
<dd>
end line number (integer)
</dd><dt><i>reverse</i></dt>
<dd>
flag indicating a reverse patch (boolean)
</dd>
</dl><dl>
<dt>Returns:</dt>
<dd>
diff lines of the patch (string)
</dd>
</dl><a NAME="GitDiffParser.headerLength" ID="GitDiffParser.headerLength"></a>
<h4>GitDiffParser.headerLength</h4>
<b>headerLength</b>(<i></i>)
<p>
        Public method to get the header length.
</p><dl>
<dt>Returns:</dt>
<dd>
length of the header (integer)
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
</body></html>

eric ide

mercurial