| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
MODULE = Git::Raw PACKAGE = Git::Raw::Diff |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
Diff |
|
4
|
|
|
|
|
|
|
new(class, buffer) |
|
5
|
|
|
|
|
|
|
SV *class |
|
6
|
|
|
|
|
|
|
SV *buffer |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
PREINIT: |
|
9
|
|
|
|
|
|
|
int rc; |
|
10
|
|
|
|
|
|
|
Diff diff; |
|
11
|
|
|
|
|
|
|
const char *b; |
|
12
|
|
|
|
|
|
|
STRLEN len; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
CODE: |
|
15
|
1
|
|
|
|
|
|
b = git_ensure_pv_with_len(buffer, "buffer", &len); |
|
16
|
1
|
|
|
|
|
|
rc = git_diff_from_buffer(&diff, |
|
17
|
|
|
|
|
|
|
b, len); |
|
18
|
1
|
|
|
|
|
|
git_check_error(rc); |
|
19
|
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
|
RETVAL = diff; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
OUTPUT: RETVAL |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
void |
|
25
|
|
|
|
|
|
|
merge(self, from) |
|
26
|
|
|
|
|
|
|
Diff self |
|
27
|
|
|
|
|
|
|
Diff from |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
PREINIT: |
|
30
|
|
|
|
|
|
|
int rc; |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
CODE: |
|
33
|
0
|
|
|
|
|
|
rc = git_diff_merge(self, from); |
|
34
|
0
|
|
|
|
|
|
git_check_error(rc); |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
SV * |
|
37
|
|
|
|
|
|
|
buffer(self, format) |
|
38
|
|
|
|
|
|
|
Diff self |
|
39
|
|
|
|
|
|
|
SV *format |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
PREINIT: |
|
42
|
|
|
|
|
|
|
int rc; |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
git_diff_format_t fmt; |
|
45
|
1
|
|
|
|
|
|
git_buf buf = GIT_BUF_INIT_CONST(NULL, 0); |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
CODE: |
|
48
|
1
|
|
|
|
|
|
fmt = git_sv_to_diff_format(format); |
|
49
|
1
|
|
|
|
|
|
rc = git_diff_to_buf(&buf, self, fmt); |
|
50
|
1
|
|
|
|
|
|
git_check_error(rc); |
|
51
|
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
|
RETVAL = newSVpv(buf.ptr, buf.size); |
|
53
|
|
|
|
|
|
|
|
|
54
|
1
|
|
|
|
|
|
git_buf_dispose(&buf); |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
OUTPUT: RETVAL |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
void |
|
59
|
|
|
|
|
|
|
print(self, format, callback) |
|
60
|
|
|
|
|
|
|
Diff self |
|
61
|
|
|
|
|
|
|
SV *format |
|
62
|
|
|
|
|
|
|
SV *callback |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
PREINIT: |
|
65
|
|
|
|
|
|
|
int rc; |
|
66
|
|
|
|
|
|
|
git_diff_format_t fmt; |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
CODE: |
|
69
|
13
|
|
|
|
|
|
fmt = git_sv_to_diff_format(format); |
|
70
|
12
|
|
|
|
|
|
rc = git_diff_print(self, fmt, git_diff_cb, callback); |
|
71
|
12
|
|
|
|
|
|
git_check_error(rc); |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
SV * |
|
74
|
|
|
|
|
|
|
delta_count(self) |
|
75
|
|
|
|
|
|
|
Diff self |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
CODE: |
|
78
|
9
|
|
|
|
|
|
RETVAL = newSVuv(git_diff_num_deltas(self)); |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
OUTPUT: RETVAL |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
void |
|
83
|
|
|
|
|
|
|
deltas(self, ...) |
|
84
|
|
|
|
|
|
|
SV *self |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
PROTOTYPE: $;$ |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
PREINIT: |
|
89
|
|
|
|
|
|
|
int ctx; |
|
90
|
8
|
|
|
|
|
|
size_t start = 0, end, num_deltas; |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
PPCODE: |
|
93
|
8
|
50
|
|
|
|
|
ctx = GIMME_V; |
|
94
|
|
|
|
|
|
|
|
|
95
|
8
|
100
|
|
|
|
|
if (ctx == G_VOID) |
|
96
|
1
|
|
|
|
|
|
XSRETURN_EMPTY; |
|
97
|
|
|
|
|
|
|
|
|
98
|
7
|
|
|
|
|
|
num_deltas = git_diff_num_deltas(GIT_SV_TO_PTR(Diff, self)); |
|
99
|
|
|
|
|
|
|
|
|
100
|
7
|
100
|
|
|
|
|
if (items == 2) { |
|
101
|
6
|
|
|
|
|
|
SV *index = ST(1); |
|
102
|
|
|
|
|
|
|
|
|
103
|
6
|
100
|
|
|
|
|
if (!SvIOK(index) || SvIV(index) < 0) |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
104
|
1
|
|
|
|
|
|
croak_usage("Invalid type for 'index'"); |
|
105
|
|
|
|
|
|
|
|
|
106
|
5
|
50
|
|
|
|
|
start = SvUV(index); |
|
107
|
5
|
100
|
|
|
|
|
if (start >= num_deltas) |
|
108
|
1
|
|
|
|
|
|
croak_usage("index %" PRIuZ " out of range", start); |
|
109
|
|
|
|
|
|
|
|
|
110
|
4
|
|
|
|
|
|
num_deltas = 1; |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
|
|
113
|
5
|
|
|
|
|
|
end = start + num_deltas; |
|
114
|
|
|
|
|
|
|
|
|
115
|
11
|
100
|
|
|
|
|
for (; start < end; ++start) { |
|
116
|
|
|
|
|
|
|
SV *delta; |
|
117
|
6
|
|
|
|
|
|
const git_diff_delta *d = git_diff_get_delta( |
|
118
|
6
|
|
|
|
|
|
GIT_SV_TO_PTR(Diff, self), start |
|
119
|
|
|
|
|
|
|
); |
|
120
|
|
|
|
|
|
|
|
|
121
|
6
|
|
|
|
|
|
GIT_NEW_OBJ_WITH_MAGIC( |
|
122
|
|
|
|
|
|
|
delta, "Git::Raw::Diff::Delta", |
|
123
|
|
|
|
|
|
|
(Diff_Delta) d, SvRV(self) |
|
124
|
|
|
|
|
|
|
); |
|
125
|
|
|
|
|
|
|
|
|
126
|
6
|
50
|
|
|
|
|
mXPUSHs(delta); |
|
127
|
|
|
|
|
|
|
} |
|
128
|
|
|
|
|
|
|
|
|
129
|
5
|
|
|
|
|
|
XSRETURN(num_deltas); |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
void |
|
132
|
|
|
|
|
|
|
find_similar(self, ...) |
|
133
|
|
|
|
|
|
|
Diff self |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
PROTOTYPE: $;$ |
|
136
|
|
|
|
|
|
|
PREINIT: |
|
137
|
|
|
|
|
|
|
int rc; |
|
138
|
|
|
|
|
|
|
|
|
139
|
4
|
|
|
|
|
|
git_diff_find_options find_opts = GIT_DIFF_FIND_OPTIONS_INIT; |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
CODE: |
|
142
|
4
|
100
|
|
|
|
|
if (items == 2) { |
|
143
|
|
|
|
|
|
|
SV *opt; |
|
144
|
|
|
|
|
|
|
HV *hopt; |
|
145
|
|
|
|
|
|
|
HV *opts; |
|
146
|
|
|
|
|
|
|
|
|
147
|
2
|
|
|
|
|
|
opts = git_ensure_hv(ST(1), "options"); |
|
148
|
|
|
|
|
|
|
|
|
149
|
1
|
50
|
|
|
|
|
if ((hopt = git_hv_hash_entry(opts, "flags"))) |
|
150
|
1
|
|
|
|
|
|
find_opts.flags |= git_hv_to_diff_find_flag(hopt); |
|
151
|
|
|
|
|
|
|
|
|
152
|
1
|
50
|
|
|
|
|
if ((opt = git_hv_int_entry(opts, "rename_threshold"))) |
|
153
|
1
|
50
|
|
|
|
|
find_opts.rename_threshold = SvIV(opt); |
|
154
|
|
|
|
|
|
|
|
|
155
|
1
|
50
|
|
|
|
|
if ((opt = git_hv_int_entry(opts, "rename_from_rewrite_threshold"))) |
|
156
|
1
|
50
|
|
|
|
|
find_opts.rename_from_rewrite_threshold = SvIV(opt); |
|
157
|
|
|
|
|
|
|
|
|
158
|
1
|
50
|
|
|
|
|
if ((opt = git_hv_int_entry(opts, "copy_threshold"))) |
|
159
|
1
|
50
|
|
|
|
|
find_opts.copy_threshold = SvIV(opt); |
|
160
|
|
|
|
|
|
|
|
|
161
|
1
|
50
|
|
|
|
|
if ((opt = git_hv_int_entry(opts, "break_rewrite_threshold"))) |
|
162
|
1
|
50
|
|
|
|
|
find_opts.break_rewrite_threshold = SvIV(opt); |
|
163
|
|
|
|
|
|
|
|
|
164
|
1
|
50
|
|
|
|
|
if ((opt = git_hv_int_entry(opts, "rename_limit"))) |
|
165
|
1
|
50
|
|
|
|
|
find_opts.rename_limit = SvIV(opt); |
|
166
|
|
|
|
|
|
|
} |
|
167
|
|
|
|
|
|
|
|
|
168
|
3
|
|
|
|
|
|
rc = git_diff_find_similar(self, &find_opts); |
|
169
|
3
|
|
|
|
|
|
git_check_error(rc); |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
SV * |
|
172
|
|
|
|
|
|
|
stats(self) |
|
173
|
|
|
|
|
|
|
SV *self |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
PREINIT: |
|
176
|
|
|
|
|
|
|
int rc; |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
Diff_Stats stats; |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
CODE: |
|
181
|
2
|
|
|
|
|
|
rc = git_diff_get_stats(&stats, GIT_SV_TO_PTR(Diff, self)); |
|
182
|
2
|
|
|
|
|
|
git_check_error(rc); |
|
183
|
|
|
|
|
|
|
|
|
184
|
2
|
|
|
|
|
|
GIT_NEW_OBJ_WITH_MAGIC( |
|
185
|
|
|
|
|
|
|
RETVAL, "Git::Raw::Diff::Stats", stats, SvRV(self) |
|
186
|
|
|
|
|
|
|
); |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
OUTPUT: RETVAL |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
void |
|
191
|
|
|
|
|
|
|
patches(self) |
|
192
|
|
|
|
|
|
|
SV *self |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
PREINIT: |
|
195
|
|
|
|
|
|
|
int ctx; |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
PPCODE: |
|
198
|
9
|
50
|
|
|
|
|
ctx = GIMME_V; |
|
199
|
|
|
|
|
|
|
|
|
200
|
9
|
100
|
|
|
|
|
if (ctx != G_VOID) { |
|
201
|
|
|
|
|
|
|
int rc; |
|
202
|
|
|
|
|
|
|
size_t count; |
|
203
|
|
|
|
|
|
|
Diff diff_ptr; |
|
204
|
8
|
|
|
|
|
|
diff_ptr = GIT_SV_TO_PTR(Diff, self); |
|
205
|
|
|
|
|
|
|
|
|
206
|
8
|
|
|
|
|
|
count = git_diff_num_deltas(diff_ptr); |
|
207
|
8
|
100
|
|
|
|
|
if (ctx == G_ARRAY) { |
|
208
|
|
|
|
|
|
|
size_t i; |
|
209
|
|
|
|
|
|
|
|
|
210
|
17
|
100
|
|
|
|
|
for (i = 0; i < count; ++i) { |
|
211
|
|
|
|
|
|
|
SV *tmp; |
|
212
|
|
|
|
|
|
|
Patch patch; |
|
213
|
|
|
|
|
|
|
|
|
214
|
10
|
|
|
|
|
|
rc = git_patch_from_diff(&patch, diff_ptr, i); |
|
215
|
10
|
|
|
|
|
|
git_check_error(rc); |
|
216
|
|
|
|
|
|
|
|
|
217
|
10
|
|
|
|
|
|
GIT_NEW_OBJ_WITH_MAGIC( |
|
218
|
|
|
|
|
|
|
tmp, "Git::Raw::Patch", patch, SvRV(self) |
|
219
|
|
|
|
|
|
|
); |
|
220
|
|
|
|
|
|
|
|
|
221
|
10
|
50
|
|
|
|
|
mXPUSHs(tmp); |
|
222
|
|
|
|
|
|
|
} |
|
223
|
|
|
|
|
|
|
|
|
224
|
7
|
|
|
|
|
|
XSRETURN((int) count); |
|
225
|
|
|
|
|
|
|
} else { |
|
226
|
1
|
50
|
|
|
|
|
mXPUSHs(newSViv((int) count)); |
|
227
|
1
|
|
|
|
|
|
XSRETURN(1); |
|
228
|
|
|
|
|
|
|
} |
|
229
|
|
|
|
|
|
|
} else |
|
230
|
1
|
|
|
|
|
|
XSRETURN_EMPTY; |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
SV * |
|
233
|
|
|
|
|
|
|
patchid(self) |
|
234
|
|
|
|
|
|
|
Diff self |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
PREINIT: |
|
237
|
|
|
|
|
|
|
int rc; |
|
238
|
|
|
|
|
|
|
git_oid id; |
|
239
|
1
|
|
|
|
|
|
git_diff_patchid_options opts = GIT_DIFF_PATCHID_OPTIONS_INIT; |
|
240
|
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
CODE: |
|
242
|
1
|
|
|
|
|
|
rc = git_diff_patchid(&id, self, &opts); |
|
243
|
1
|
|
|
|
|
|
git_check_error(rc); |
|
244
|
|
|
|
|
|
|
|
|
245
|
1
|
|
|
|
|
|
RETVAL = git_oid_to_sv(&id); |
|
246
|
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
OUTPUT: RETVAL |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
void |
|
250
|
|
|
|
|
|
|
DESTROY(self) |
|
251
|
|
|
|
|
|
|
SV *self |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
CODE: |
|
254
|
17
|
|
|
|
|
|
git_diff_free(GIT_SV_TO_PTR(Diff, self)); |
|
255
|
17
|
|
|
|
|
|
SvREFCNT_dec(GIT_SV_TO_MAGIC(self)); |