]> git.ipfire.org Git - thirdparty/git.git/blame - range-diff.c
xdiff: mark unused parameter in xdl_call_hunk_func()
[thirdparty/git.git] / range-diff.c
CommitLineData
d9c66f0b
JS
1#include "cache.h"
2#include "range-diff.h"
3#include "string-list.h"
4#include "run-command.h"
dbbcd44f 5#include "strvec.h"
d9c66f0b
JS
6#include "hashmap.h"
7#include "xdiff-interface.h"
8#include "linear-assignment.h"
c8c5e43a 9#include "diffcore.h"
eb0be38c
JS
10#include "commit.h"
11#include "pretty.h"
4eba1fe6 12#include "userdiff.h"
b66885a3 13#include "apply.h"
359f0d75 14#include "revision.h"
d9c66f0b
JS
15
16struct patch_util {
17 /* For the search for an exact match */
18 struct hashmap_entry e;
19 const char *diff, *patch;
20
9dc46e02 21 int i, shown;
d9c66f0b
JS
22 int diffsize;
23 size_t diff_offset;
24 /* the index of the matching item in the other branch, or -1 */
25 int matching;
26 struct object_id oid;
27};
28
29/*
30 * Reads the patches into a string list, with the `util` field being populated
31 * as struct object_id (will need to be free()d).
32 */
bd361918 33static int read_patches(const char *range, struct string_list *list,
c972bf4c 34 const struct strvec *other_arg)
d9c66f0b
JS
35{
36 struct child_process cp = CHILD_PROCESS_INIT;
44b67cb6 37 struct strbuf buf = STRBUF_INIT, contents = STRBUF_INIT;
d9c66f0b
JS
38 struct patch_util *util = NULL;
39 int in_header = 1;
444e0969 40 char *line, *current_filename = NULL;
c4d59073 41 ssize_t len;
44b67cb6 42 size_t size;
2d102c2b 43 int ret = -1;
d9c66f0b 44
c972bf4c 45 strvec_pushl(&cp.args, "log", "--no-color", "-p", "--no-merges",
f6d8942b 46 "--reverse", "--date-order", "--decorate=no",
04b1f1fd 47 "--no-prefix", "--submodule=short",
f6d8942b
JK
48 /*
49 * Choose indicators that are not used anywhere
50 * else in diffs, but still look reasonable
51 * (e.g. will not be confusing when debugging)
52 */
53 "--output-indicator-new=>",
54 "--output-indicator-old=<",
55 "--output-indicator-context=#",
56 "--no-abbrev-commit",
57 "--pretty=medium",
58 "--notes",
59 NULL);
b7574782 60 strvec_push(&cp.args, range);
bd361918 61 if (other_arg)
d70a9eb6 62 strvec_pushv(&cp.args, other_arg->v);
d9c66f0b
JS
63 cp.out = -1;
64 cp.no_stdin = 1;
65 cp.git_cmd = 1;
66
67 if (start_command(&cp))
68 return error_errno(_("could not start `log`"));
44b67cb6 69 if (strbuf_read(&contents, cp.out, 0) < 0) {
d9c66f0b
JS
70 error_errno(_("could not read `log` output"));
71 finish_command(&cp);
2d102c2b 72 goto cleanup;
d9c66f0b 73 }
5189bb87 74 if (finish_command(&cp))
2d102c2b 75 goto cleanup;
d9c66f0b 76
44b67cb6
TG
77 line = contents.buf;
78 size = contents.len;
47ac23d3 79 for (; size > 0; size -= len, line += len) {
d9c66f0b 80 const char *p;
7c86d365
JK
81 char *eol;
82
83 eol = memchr(line, '\n', size);
84 if (eol) {
85 *eol = '\0';
86 len = eol + 1 - line;
87 } else {
88 len = size;
89 }
d9c66f0b 90
44b67cb6 91 if (skip_prefix(line, "commit ", &p)) {
d9c66f0b
JS
92 if (util) {
93 string_list_append(list, buf.buf)->util = util;
94 strbuf_reset(&buf);
95 }
ca56dadb 96 CALLOC_ARRAY(util, 1);
d9c66f0b
JS
97 if (get_oid(p, &util->oid)) {
98 error(_("could not parse commit '%s'"), p);
2d102c2b 99 FREE_AND_NULL(util);
d9c66f0b 100 string_list_clear(list, 1);
2d102c2b 101 goto cleanup;
d9c66f0b
JS
102 }
103 util->matching = -1;
104 in_header = 1;
105 continue;
106 }
107
8cf51561
VD
108 if (!util) {
109 error(_("could not parse first line of `log` output: "
110 "did not start with 'commit ': '%s'"),
111 line);
112 string_list_clear(list, 1);
2d102c2b 113 goto cleanup;
8cf51561
VD
114 }
115
44b67cb6 116 if (starts_with(line, "diff --git")) {
b66885a3
TG
117 struct patch patch = { 0 };
118 struct strbuf root = STRBUF_INIT;
119 int linenr = 0;
8d1675eb 120 int orig_len;
b66885a3 121
d9c66f0b
JS
122 in_header = 0;
123 strbuf_addch(&buf, '\n');
124 if (!util->diff_offset)
125 util->diff_offset = buf.len;
7c86d365
JK
126 if (eol)
127 *eol = '\n';
8d1675eb 128 orig_len = len;
937b76ed 129 len = parse_git_diff_header(&root, &linenr, 0, line,
b66885a3 130 len, size, &patch);
a2d474ad
JS
131 if (len < 0) {
132 error(_("could not parse git header '%.*s'"),
133 orig_len, line);
2d102c2b 134 FREE_AND_NULL(util);
a2d474ad 135 string_list_clear(list, 1);
2d102c2b 136 goto cleanup;
a2d474ad 137 }
b66885a3
TG
138 strbuf_addstr(&buf, " ## ");
139 if (patch.is_new > 0)
140 strbuf_addf(&buf, "%s (new)", patch.new_name);
141 else if (patch.is_delete > 0)
142 strbuf_addf(&buf, "%s (deleted)", patch.old_name);
143 else if (patch.is_rename)
144 strbuf_addf(&buf, "%s => %s", patch.old_name, patch.new_name);
145 else
146 strbuf_addstr(&buf, patch.new_name);
147
444e0969
TG
148 free(current_filename);
149 if (patch.is_delete > 0)
150 current_filename = xstrdup(patch.old_name);
151 else
152 current_filename = xstrdup(patch.new_name);
153
b66885a3
TG
154 if (patch.new_mode && patch.old_mode &&
155 patch.old_mode != patch.new_mode)
156 strbuf_addf(&buf, " (mode change %06o => %06o)",
157 patch.old_mode, patch.new_mode);
158
159 strbuf_addstr(&buf, " ##");
4998e93f 160 release_patch(&patch);
d9c66f0b 161 } else if (in_header) {
44b67cb6 162 if (starts_with(line, "Author: ")) {
499352c2 163 strbuf_addstr(&buf, " ## Metadata ##\n");
44b67cb6 164 strbuf_addstr(&buf, line);
d9c66f0b 165 strbuf_addstr(&buf, "\n\n");
499352c2 166 strbuf_addstr(&buf, " ## Commit message ##\n");
9f726e1b
DL
167 } else if (starts_with(line, "Notes") &&
168 line[strlen(line) - 1] == ':') {
169 strbuf_addstr(&buf, "\n\n");
170 /* strip the trailing colon */
171 strbuf_addf(&buf, " ## %.*s ##\n",
172 (int)(strlen(line) - 1), line);
44b67cb6
TG
173 } else if (starts_with(line, " ")) {
174 p = line + len - 2;
175 while (isspace(*p) && p >= line)
176 p--;
177 strbuf_add(&buf, line, p - line + 1);
d9c66f0b
JS
178 strbuf_addch(&buf, '\n');
179 }
180 continue;
e1db2630
TG
181 } else if (skip_prefix(line, "@@ ", &p)) {
182 p = strstr(p, "@@");
444e0969
TG
183 strbuf_addstr(&buf, "@@");
184 if (current_filename && p[2])
185 strbuf_addf(&buf, " %s:", current_filename);
186 if (p)
187 strbuf_addstr(&buf, p + 2);
b66885a3 188 } else if (!line[0])
d9c66f0b
JS
189 /*
190 * A completely blank (not ' \n', which is context)
191 * line is not valid in a diff. We skip it
192 * silently, because this neatly handles the blank
193 * separator line between commits in git-log
194 * output.
d9c66f0b
JS
195 */
196 continue;
44b67cb6 197 else if (line[0] == '>') {
8d5ccb59 198 strbuf_addch(&buf, '+');
44b67cb6
TG
199 strbuf_addstr(&buf, line + 1);
200 } else if (line[0] == '<') {
8d5ccb59 201 strbuf_addch(&buf, '-');
44b67cb6
TG
202 strbuf_addstr(&buf, line + 1);
203 } else if (line[0] == '#') {
8d5ccb59 204 strbuf_addch(&buf, ' ');
44b67cb6 205 strbuf_addstr(&buf, line + 1);
8d5ccb59 206 } else {
2543a641 207 strbuf_addch(&buf, ' ');
44b67cb6 208 strbuf_addstr(&buf, line);
8d5ccb59 209 }
d9c66f0b
JS
210
211 strbuf_addch(&buf, '\n');
212 util->diffsize++;
213 }
2d102c2b
ÆAB
214
215 ret = 0;
216cleanup:
44b67cb6 217 strbuf_release(&contents);
d9c66f0b
JS
218
219 if (util)
220 string_list_append(list, buf.buf)->util = util;
221 strbuf_release(&buf);
444e0969 222 free(current_filename);
d9c66f0b 223
2d102c2b 224 return ret;
d9c66f0b
JS
225}
226
5cf88fd8 227static int patch_util_cmp(const void *cmp_data UNUSED,
02c3c59e
JK
228 const struct patch_util *a,
229 const struct patch_util *b,
230 const char *keydata)
d9c66f0b
JS
231{
232 return strcmp(a->diff, keydata ? keydata : b->diff);
233}
234
235static void find_exact_matches(struct string_list *a, struct string_list *b)
236{
b19315d8 237 struct hashmap map = HASHMAP_INIT((hashmap_cmp_fn)patch_util_cmp, NULL);
d9c66f0b
JS
238 int i;
239
d9c66f0b
JS
240 /* First, add the patches of a to a hash map */
241 for (i = 0; i < a->nr; i++) {
242 struct patch_util *util = a->items[i].util;
243
244 util->i = i;
245 util->patch = a->items[i].string;
246 util->diff = util->patch + util->diff_offset;
d22245a2 247 hashmap_entry_init(&util->e, strhash(util->diff));
b94e5c1d 248 hashmap_add(&map, &util->e);
d9c66f0b
JS
249 }
250
251 /* Now try to find exact matches in b */
252 for (i = 0; i < b->nr; i++) {
253 struct patch_util *util = b->items[i].util, *other;
254
255 util->i = i;
256 util->patch = b->items[i].string;
257 util->diff = util->patch + util->diff_offset;
d22245a2 258 hashmap_entry_init(&util->e, strhash(util->diff));
404ab78e 259 other = hashmap_remove_entry(&map, util, e, NULL);
d9c66f0b
JS
260 if (other) {
261 if (other->matching >= 0)
262 BUG("already assigned!");
263
264 other->matching = i;
265 util->matching = other->i;
266 }
267 }
268
6da1a258 269 hashmap_clear(&map);
d9c66f0b
JS
270}
271
a8d5eb6d 272static int diffsize_consume(void *data, char *line, unsigned long len)
d9c66f0b
JS
273{
274 (*(int *)data)++;
a8d5eb6d 275 return 0;
d9c66f0b
JS
276}
277
d2eb8093
JK
278static void diffsize_hunk(void *data, long ob, long on, long nb, long nn,
279 const char *funcline, long funclen)
280{
281 diffsize_consume(data, NULL, 0);
282}
283
d9c66f0b
JS
284static int diffsize(const char *a, const char *b)
285{
286 xpparam_t pp = { 0 };
287 xdemitconf_t cfg = { 0 };
288 mmfile_t mf1, mf2;
289 int count = 0;
290
291 mf1.ptr = (char *)a;
292 mf1.size = strlen(a);
293 mf2.ptr = (char *)b;
294 mf2.size = strlen(b);
295
296 cfg.ctxlen = 3;
d2eb8093
JK
297 if (!xdi_diff_outf(&mf1, &mf2,
298 diffsize_hunk, diffsize_consume, &count,
299 &pp, &cfg))
d9c66f0b
JS
300 return count;
301
302 error(_("failed to generate diff"));
303 return COST_MAX;
304}
305
306static void get_correspondences(struct string_list *a, struct string_list *b,
307 int creation_factor)
308{
309 int n = a->nr + b->nr;
310 int *cost, c, *a2b, *b2a;
311 int i, j;
312
313 ALLOC_ARRAY(cost, st_mult(n, n));
314 ALLOC_ARRAY(a2b, n);
315 ALLOC_ARRAY(b2a, n);
316
317 for (i = 0; i < a->nr; i++) {
318 struct patch_util *a_util = a->items[i].util;
319
320 for (j = 0; j < b->nr; j++) {
321 struct patch_util *b_util = b->items[j].util;
322
323 if (a_util->matching == j)
324 c = 0;
325 else if (a_util->matching < 0 && b_util->matching < 0)
326 c = diffsize(a_util->diff, b_util->diff);
327 else
328 c = COST_MAX;
329 cost[i + n * j] = c;
330 }
331
332 c = a_util->matching < 0 ?
333 a_util->diffsize * creation_factor / 100 : COST_MAX;
334 for (j = b->nr; j < n; j++)
335 cost[i + n * j] = c;
336 }
337
338 for (j = 0; j < b->nr; j++) {
339 struct patch_util *util = b->items[j].util;
340
341 c = util->matching < 0 ?
342 util->diffsize * creation_factor / 100 : COST_MAX;
343 for (i = a->nr; i < n; i++)
344 cost[i + n * j] = c;
345 }
346
347 for (i = a->nr; i < n; i++)
348 for (j = b->nr; j < n; j++)
349 cost[i + n * j] = 0;
350
351 compute_assignment(n, n, cost, a2b, b2a);
352
353 for (i = 0; i < a->nr; i++)
354 if (a2b[i] >= 0 && a2b[i] < b->nr) {
355 struct patch_util *a_util = a->items[i].util;
356 struct patch_util *b_util = b->items[a2b[i]].util;
357
358 a_util->matching = a2b[i];
359 b_util->matching = i;
360 }
361
362 free(cost);
363 free(a2b);
364 free(b2a);
365}
366
faa1df86 367static void output_pair_header(struct diff_options *diffopt,
d1f87a2d 368 int patch_no_width,
faa1df86 369 struct strbuf *buf,
eb0be38c
JS
370 struct strbuf *dashes,
371 struct patch_util *a_util,
372 struct patch_util *b_util)
d9c66f0b 373{
eb0be38c
JS
374 struct object_id *oid = a_util ? &a_util->oid : &b_util->oid;
375 struct commit *commit;
faa1df86
JS
376 char status;
377 const char *color_reset = diff_get_color_opt(diffopt, DIFF_RESET);
378 const char *color_old = diff_get_color_opt(diffopt, DIFF_FILE_OLD);
379 const char *color_new = diff_get_color_opt(diffopt, DIFF_FILE_NEW);
380 const char *color_commit = diff_get_color_opt(diffopt, DIFF_COMMIT);
381 const char *color;
eb0be38c
JS
382
383 if (!dashes->len)
384 strbuf_addchars(dashes, '-',
385 strlen(find_unique_abbrev(oid,
386 DEFAULT_ABBREV)));
387
faa1df86
JS
388 if (!b_util) {
389 color = color_old;
390 status = '<';
391 } else if (!a_util) {
392 color = color_new;
393 status = '>';
394 } else if (strcmp(a_util->patch, b_util->patch)) {
395 color = color_commit;
396 status = '!';
397 } else {
398 color = color_commit;
399 status = '=';
400 }
401
eb0be38c 402 strbuf_reset(buf);
faa1df86 403 strbuf_addstr(buf, status == '!' ? color_old : color);
eb0be38c 404 if (!a_util)
d1f87a2d 405 strbuf_addf(buf, "%*s: %s ", patch_no_width, "-", dashes->buf);
eb0be38c 406 else
d1f87a2d 407 strbuf_addf(buf, "%*d: %s ", patch_no_width, a_util->i + 1,
eb0be38c
JS
408 find_unique_abbrev(&a_util->oid, DEFAULT_ABBREV));
409
faa1df86
JS
410 if (status == '!')
411 strbuf_addf(buf, "%s%s", color_reset, color);
412 strbuf_addch(buf, status);
413 if (status == '!')
414 strbuf_addf(buf, "%s%s", color_reset, color_new);
eb0be38c
JS
415
416 if (!b_util)
d1f87a2d 417 strbuf_addf(buf, " %*s: %s", patch_no_width, "-", dashes->buf);
eb0be38c 418 else
d1f87a2d 419 strbuf_addf(buf, " %*d: %s", patch_no_width, b_util->i + 1,
eb0be38c
JS
420 find_unique_abbrev(&b_util->oid, DEFAULT_ABBREV));
421
422 commit = lookup_commit_reference(the_repository, oid);
423 if (commit) {
faa1df86
JS
424 if (status == '!')
425 strbuf_addf(buf, "%s%s", color_reset, color);
426
eb0be38c
JS
427 strbuf_addch(buf, ' ');
428 pp_commit_easy(CMIT_FMT_ONELINE, commit, buf);
429 }
faa1df86 430 strbuf_addf(buf, "%s\n", color_reset);
eb0be38c 431
87f1b2d4 432 fwrite(buf->buf, buf->len, 1, diffopt->file);
d9c66f0b
JS
433}
434
499352c2
TG
435static struct userdiff_driver section_headers = {
436 .funcname = { "^ ## (.*) ##$\n"
437 "^.?@@ (.*)$", REG_EXTENDED }
4eba1fe6
JS
438};
439
c8c5e43a
JS
440static struct diff_filespec *get_filespec(const char *name, const char *p)
441{
442 struct diff_filespec *spec = alloc_filespec(name);
443
14228447 444 fill_filespec(spec, null_oid(), 0, 0100644);
c8c5e43a
JS
445 spec->data = (char *)p;
446 spec->size = strlen(p);
447 spec->should_munmap = 0;
448 spec->is_stdin = 1;
499352c2 449 spec->driver = &section_headers;
c8c5e43a
JS
450
451 return spec;
452}
453
454static void patch_diff(const char *a, const char *b,
1ca69225 455 struct diff_options *diffopt)
c8c5e43a
JS
456{
457 diff_queue(&diff_queued_diff,
458 get_filespec("a", a), get_filespec("b", b));
459
460 diffcore_std(diffopt);
461 diff_flush(diffopt);
462}
463
3e6046ed
JS
464static struct strbuf *output_prefix_cb(struct diff_options *opt, void *data)
465{
466 return data;
467}
468
c8c5e43a 469static void output(struct string_list *a, struct string_list *b,
3e6046ed 470 struct range_diff_options *range_diff_opts)
d9c66f0b 471{
eb0be38c 472 struct strbuf buf = STRBUF_INIT, dashes = STRBUF_INIT;
d1f87a2d 473 int patch_no_width = decimal_width(1 + (a->nr > b->nr ? a->nr : b->nr));
9dc46e02 474 int i = 0, j = 0;
3e6046ed
JS
475 struct diff_options opts;
476 struct strbuf indent = STRBUF_INIT;
477
478 if (range_diff_opts->diffopt)
479 memcpy(&opts, range_diff_opts->diffopt, sizeof(opts));
480 else
481 diff_setup(&opts);
482
709b3f32 483 opts.no_free = 1;
3e6046ed
JS
484 if (!opts.output_format)
485 opts.output_format = DIFF_FORMAT_PATCH;
486 opts.flags.suppress_diff_headers = 1;
487 opts.flags.dual_color_diffed_diffs =
488 range_diff_opts->dual_color;
489 opts.flags.suppress_hunk_header_line_count = 1;
490 opts.output_prefix = output_prefix_cb;
491 strbuf_addstr(&indent, " ");
492 opts.output_prefix_data = &indent;
493 diff_setup_done(&opts);
9dc46e02
JS
494
495 /*
496 * We assume the user is really more interested in the second argument
497 * ("newer" version). To that end, we print the output in the order of
498 * the RHS (the `b` parameter). To put the LHS (the `a` parameter)
499 * commits that are no longer in the RHS into a good place, we place
500 * them once we have shown all of their predecessors in the LHS.
501 */
502
503 while (i < a->nr || j < b->nr) {
504 struct patch_util *a_util, *b_util;
505 a_util = i < a->nr ? a->items[i].util : NULL;
506 b_util = j < b->nr ? b->items[j].util : NULL;
507
508 /* Skip all the already-shown commits from the LHS. */
509 while (i < a->nr && a_util->shown)
510 a_util = ++i < a->nr ? a->items[i].util : NULL;
511
512 /* Show unmatched LHS commit whose predecessors were shown. */
513 if (i < a->nr && a_util->matching < 0) {
1e79f973
JS
514 if (!range_diff_opts->right_only)
515 output_pair_header(&opts, patch_no_width,
faa1df86 516 &buf, &dashes, a_util, NULL);
9dc46e02
JS
517 i++;
518 continue;
519 }
d9c66f0b 520
9dc46e02
JS
521 /* Show unmatched RHS commits. */
522 while (j < b->nr && b_util->matching < 0) {
1e79f973
JS
523 if (!range_diff_opts->left_only)
524 output_pair_header(&opts, patch_no_width,
faa1df86 525 &buf, &dashes, NULL, b_util);
9dc46e02 526 b_util = ++j < b->nr ? b->items[j].util : NULL;
d9c66f0b 527 }
d9c66f0b 528
9dc46e02
JS
529 /* Show matching LHS/RHS pair. */
530 if (j < b->nr) {
531 a_util = a->items[b_util->matching].util;
3e6046ed 532 output_pair_header(&opts, patch_no_width,
faa1df86 533 &buf, &dashes, a_util, b_util);
3e6046ed 534 if (!(opts.output_format & DIFF_FORMAT_NO_OUTPUT))
c8c5e43a 535 patch_diff(a->items[b_util->matching].string,
3e6046ed 536 b->items[j].string, &opts);
9dc46e02
JS
537 a_util->shown = 1;
538 j++;
539 }
d9c66f0b 540 }
eb0be38c
JS
541 strbuf_release(&buf);
542 strbuf_release(&dashes);
3e6046ed 543 strbuf_release(&indent);
709b3f32
RS
544 opts.no_free = 0;
545 diff_free(&opts);
73a834e9
ES
546}
547
d9c66f0b 548int show_range_diff(const char *range1, const char *range2,
f1ce6c19 549 struct range_diff_options *range_diff_opts)
d9c66f0b
JS
550{
551 int res = 0;
552
553 struct string_list branch1 = STRING_LIST_INIT_DUP;
554 struct string_list branch2 = STRING_LIST_INIT_DUP;
555
1e79f973 556 if (range_diff_opts->left_only && range_diff_opts->right_only)
43ea635c 557 res = error(_("options '%s' and '%s' cannot be used together"), "--left-only", "--right-only");
1e79f973
JS
558
559 if (!res && read_patches(range1, &branch1, range_diff_opts->other_arg))
d9c66f0b 560 res = error(_("could not parse log for '%s'"), range1);
f1ce6c19 561 if (!res && read_patches(range2, &branch2, range_diff_opts->other_arg))
d9c66f0b
JS
562 res = error(_("could not parse log for '%s'"), range2);
563
564 if (!res) {
565 find_exact_matches(&branch1, &branch2);
f1ce6c19
JS
566 get_correspondences(&branch1, &branch2,
567 range_diff_opts->creation_factor);
3e6046ed 568 output(&branch1, &branch2, range_diff_opts);
d9c66f0b
JS
569 }
570
571 string_list_clear(&branch1, 1);
572 string_list_clear(&branch2, 1);
573
574 return res;
575}
679b5916
JS
576
577int is_range_diff_range(const char *arg)
578{
359f0d75
JS
579 char *copy = xstrdup(arg); /* setup_revisions() modifies it */
580 const char *argv[] = { "", copy, "--", NULL };
581 int i, positive = 0, negative = 0;
582 struct rev_info revs;
583
584 init_revisions(&revs, NULL);
585 if (setup_revisions(3, argv, &revs, NULL) == 1) {
586 for (i = 0; i < revs.pending.nr; i++)
587 if (revs.pending.objects[i].item->flags & UNINTERESTING)
588 negative++;
589 else
590 positive++;
591 for (i = 0; i < revs.pending.nr; i++) {
592 struct object *obj = revs.pending.objects[i].item;
593
594 if (obj->type == OBJ_COMMIT)
595 clear_commit_marks((struct commit *)obj,
596 ALL_REV_FLAGS);
597 }
598 }
599
600 free(copy);
1878b5ed 601 release_revisions(&revs);
359f0d75 602 return negative > 0 && positive > 0;
679b5916 603}