| 350 | " Instead of diffing a to b. Diff b to a.\n"); |
| 351 | |
| 352 | PyObject * |
| 353 | Tree_diff_to_tree(Tree *self, PyObject *args, PyObject *kwds) |
| 354 | { |
| 355 | git_diff_options opts = GIT_DIFF_OPTIONS_INIT; |
| 356 | git_diff *diff; |
| 357 | git_tree *from, *to = NULL, *tmp; |
| 358 | int err, swap = 0; |
| 359 | char *keywords[] = {"obj", "flags", "context_lines", "interhunk_lines", "swap", NULL}; |
| 360 | |
| 361 | Tree *other = NULL; |
| 362 | |
| 363 | if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!IHHi", keywords, |
| 364 | &TreeType, &other, &opts.flags, |
| 365 | &opts.context_lines, |
| 366 | &opts.interhunk_lines, &swap)) |
| 367 | return NULL; |
| 368 | |
| 369 | if (Object__load((Object*)self) == NULL) { return NULL; } // Lazy load |
| 370 | from = self->tree; |
| 371 | |
| 372 | if (other) { |
| 373 | if (Object__load((Object*)other) == NULL) { return NULL; } // Lazy load |
| 374 | to = other->tree; |
| 375 | } |
| 376 | |
| 377 | if (swap > 0) { |
| 378 | tmp = from; |
| 379 | from = to; |
| 380 | to = tmp; |
| 381 | } |
| 382 | |
| 383 | err = git_diff_tree_to_tree(&diff, self->repo->repo, from, to, &opts); |
| 384 | if (err < 0) |
| 385 | return Error_set(err); |
| 386 | |
| 387 | return wrap_diff(diff, self->repo); |
| 388 | } |
| 389 | |
| 390 | |
| 391 | PySequenceMethods Tree_as_sequence = { |
nothing calls this directly
no test coverage detected
searching dependent graphs…