Skip to content

Commit d410d04

Browse files
committed
Write docs for convenient patch and convenient hunk
1 parent 2fca86e commit d410d04

File tree

2 files changed

+197
-0
lines changed

2 files changed

+197
-0
lines changed

lib/convenient_hunks.js

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
var NodeGit = require("../");
2+
3+
var ConvenientHunk = NodeGit.ConvenientHunk;
4+
5+
var header = ConvenientHunk.prototype.header;
6+
/**
7+
* Diff header string that represents the context of this hunk
8+
* of the diff. Something like `@@ -169,14 +167,12 @@ ...`
9+
* @return {String}
10+
*/
11+
ConvenientHunk.prototype.header = header;
12+
13+
var size = ConvenientHunk.prototype.size;
14+
/**
15+
* Number of lines in this hunk
16+
* @return {Number}
17+
*/
18+
ConvenientHunk.prototype.size = size;
19+
20+
var lines = ConvenientHunk.prototype.lines;
21+
/**
22+
* The lines in this hunk
23+
* @async
24+
* @return {Array<DiffLine>}
25+
*/
26+
ConvenientHunk.prototype.lines = lines;
27+
28+
var headerLen = ConvenientHunk.prototype.headerLen;
29+
/**
30+
* The length of the header
31+
* @return {Number}
32+
*/
33+
ConvenientHunk.prototype.headerLen = headerLen;
34+
35+
var newLines = ConvenientHunk.prototype.newLines;
36+
/**
37+
* The number of new lines in the hunk
38+
* @return {Number}
39+
*/
40+
ConvenientHunk.prototype.newLines = newLines;
41+
42+
var newStart = ConvenientHunk.prototype.newStart;
43+
/**
44+
* The starting offset of the first new line in the file
45+
* @return {Number}
46+
*/
47+
ConvenientHunk.prototype.newStart = newStart;
48+
49+
var oldLines = ConvenientHunk.prototype.oldLines;
50+
/**
51+
* The number of old lines in the hunk
52+
* @return {Number}
53+
*/
54+
ConvenientHunk.prototype.oldLines = oldLines;
55+
56+
var oldStart = ConvenientHunk.prototype.oldStart;
57+
/**
58+
* The starting offset of the first old line in the file
59+
* @return {Number}
60+
*/
61+
ConvenientHunk.prototype.oldStart = oldStart;
62+
63+
exports.module = ConvenientHunk;

lib/convenient_patch.js

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
var NodeGit = require("../");
2+
3+
var ConvenientPatch = NodeGit.ConvenientPatch;
4+
5+
var oldFile = ConvenientPatch.prototype.oldFile;
6+
/**
7+
* Old name of the file
8+
* @return {String}
9+
*/
10+
ConvenientPatch.prototype.oldFile = oldFile;
11+
12+
var newFile = ConvenientPatch.prototype.newFile;
13+
/**
14+
* New name of the file
15+
* @return {String}
16+
*/
17+
ConvenientPatch.prototype.newFile = newFile;
18+
19+
var size = ConvenientPatch.prototype.size;
20+
/**
21+
* The number of hunks in this patch
22+
* @return {Number}
23+
*/
24+
ConvenientPatch.prototype.size = size;
25+
26+
var hunks = ConvenientPatch.prototype.hunks;
27+
/**
28+
* The hunks in this patch
29+
* @async
30+
* @return {Array<ConvenientHunk>} a promise that resolves to an array of
31+
* ConvenientHunks
32+
*/
33+
ConvenientPatch.prototype.hunks = hunks;
34+
35+
var status = ConvenientPatch.prototype.status;
36+
/**
37+
* The status of this patch (unmodified, added, deleted)
38+
* @return {Number}
39+
*/
40+
ConvenientPatch.prototype.status = status;
41+
42+
/**
43+
* @typedef lineStats
44+
* @type {Object}
45+
* @property {number} total_context # of contexts in the patch
46+
* @property {number} total_additions # of lines added in the patch
47+
* @property {number} total_deletions # of lines deleted in the patch
48+
*/
49+
50+
var lineStats = ConvenientPatch.prototype.lineStats;
51+
/**
52+
* The line statistics of this patch (#contexts, #added, #deleted)
53+
* @return {lineStats}
54+
*/
55+
ConvenientPatch.prototype.lineStats = lineStats;
56+
57+
var isUnmodified = ConvenientPatch.prototype.isUnmodified;
58+
/**
59+
* Is this an unmodified patch?
60+
* @return {Boolean}
61+
*/
62+
ConvenientPatch.prototype.isUnmodified = isUnmodified;
63+
64+
var isAdded = ConvenientPatch.prototype.isAdded;
65+
/**
66+
* Is this an added patch?
67+
* @return {Boolean}
68+
*/
69+
ConvenientPatch.prototype.isAdded = isAdded;
70+
71+
var isDeleted = ConvenientPatch.prototype.isDeleted;
72+
/**
73+
* Is this a deleted patch?
74+
* @return {Boolean}
75+
*/
76+
ConvenientPatch.prototype.isDeleted = isDeleted;
77+
78+
var isModified = ConvenientPatch.prototype.isModified;
79+
/**
80+
* Is this an modified patch?
81+
* @return {Boolean}
82+
*/
83+
ConvenientPatch.prototype.isModified = isModified;
84+
85+
var isRenamed = ConvenientPatch.prototype.isRenamed;
86+
/**
87+
* Is this a renamed patch?
88+
* @return {Boolean}
89+
*/
90+
ConvenientPatch.prototype.isRenamed = isRenamed;
91+
92+
var isCopied = ConvenientPatch.prototype.isCopied;
93+
/**
94+
* Is this a copied patch?
95+
* @return {Boolean}
96+
*/
97+
ConvenientPatch.prototype.isCopied = isCopied;
98+
99+
var isIgnored = ConvenientPatch.prototype.isIgnored;
100+
/**
101+
* Is this an ignored patch?
102+
* @return {Boolean}
103+
*/
104+
ConvenientPatch.prototype.isIgnored = isIgnored;
105+
106+
var isUntracked = ConvenientPatch.prototype.isUntracked;
107+
/**
108+
* Is this an untracked patch?
109+
* @return {Boolean}
110+
*/
111+
ConvenientPatch.prototype.isUntracked = isUntracked;
112+
113+
var isTypeChange = ConvenientPatch.prototype.isTypeChange;
114+
/**
115+
* Is this a type change?
116+
* @return {Boolean}
117+
*/
118+
ConvenientPatch.prototype.isTypeChange = isTypeChange;
119+
120+
var isUnreadable = ConvenientPatch.prototype.isUnreadable;
121+
/**
122+
* Is this an undreadable patch?
123+
* @return {Boolean}
124+
*/
125+
ConvenientPatch.prototype.isUnreadable = isUnreadable;
126+
127+
var isConflicted = ConvenientPatch.prototype.isConflicted;
128+
/**
129+
* Is this a conflicted patch?
130+
* @return {Boolean}
131+
*/
132+
ConvenientPatch.prototype.isConflicted = isConflicted;
133+
134+
exports.module = ConvenientPatch;

0 commit comments

Comments
 (0)