Blame


1 e67369ac 2018-06-22 stsp /*
2 e67369ac 2018-06-22 stsp * Copyright (c) 2018 Stefan Sperling <stsp@openbsd.org>
3 e67369ac 2018-06-22 stsp *
4 e67369ac 2018-06-22 stsp * Permission to use, copy, modify, and distribute this software for any
5 e67369ac 2018-06-22 stsp * purpose with or without fee is hereby granted, provided that the above
6 e67369ac 2018-06-22 stsp * copyright notice and this permission notice appear in all copies.
7 e67369ac 2018-06-22 stsp *
8 e67369ac 2018-06-22 stsp * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 e67369ac 2018-06-22 stsp * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 e67369ac 2018-06-22 stsp * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 e67369ac 2018-06-22 stsp * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 e67369ac 2018-06-22 stsp * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 e67369ac 2018-06-22 stsp * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 e67369ac 2018-06-22 stsp * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 e67369ac 2018-06-22 stsp */
16 e67369ac 2018-06-22 stsp
17 84451b3e 2018-07-10 stsp /*
18 84451b3e 2018-07-10 stsp * Write an annotated version of a file at a given in-repository path,
19 84451b3e 2018-07-10 stsp * as found in the commit specified by ID, to the specified output file.
20 84451b3e 2018-07-10 stsp */
21 e67369ac 2018-06-22 stsp const struct got_error *got_blame(const char *, struct got_object_id *,
22 e67369ac 2018-06-22 stsp struct got_repository *, FILE *);
23 84451b3e 2018-07-10 stsp
24 84451b3e 2018-07-10 stsp /*
25 84451b3e 2018-07-10 stsp * Like got_blame() but instead of generating an output file invoke
26 84451b3e 2018-07-10 stsp * a callback whenever an annotation has been computed for a line.
27 84451b3e 2018-07-10 stsp *
28 84451b3e 2018-07-10 stsp * The callback receives the provided void * argument, the total number
29 84451b3e 2018-07-10 stsp * of lines of the annotated file, a line number, and the ID of the commit
30 84451b3e 2018-07-10 stsp * which last changed this line.
31 d68a0a7d 2018-07-10 stsp *
32 d68a0a7d 2018-07-10 stsp * The callback is invoked for each commit as history is traversed.
33 3bf198ba 2018-07-10 stsp * If no changes to the file were made in a commit, line number -1 will
34 3bf198ba 2018-07-10 stsp * be reported.
35 d68a0a7d 2018-07-10 stsp *
36 d68a0a7d 2018-07-10 stsp * If the callback returns GOT_ERR_ITER_COMPLETED, the blame operation
37 d68a0a7d 2018-07-10 stsp * will be aborted and this function returns NULL.
38 d68a0a7d 2018-07-10 stsp * If the callback returns any other error, the blame operation will be
39 d68a0a7d 2018-07-10 stsp * aborted and the callback's error is returned from this function.
40 84451b3e 2018-07-10 stsp */
41 84451b3e 2018-07-10 stsp const struct got_error *got_blame_incremental(const char *,
42 84451b3e 2018-07-10 stsp struct got_object_id *, struct got_repository *,
43 84451b3e 2018-07-10 stsp const struct got_error *(*cb)(void *, int, int, struct got_object_id *),
44 84451b3e 2018-07-10 stsp void *);