graph.hon commit i18n: archive: mark errors for translation (5a36d00)
   1#ifndef GRAPH_H
   2#define GRAPH_H
   3
   4/* A graph is a pointer to this opaque structure */
   5struct git_graph;
   6
   7/*
   8 * Set up a custom scheme for column colors.
   9 *
  10 * The default column color scheme inserts ANSI color escapes to colorize
  11 * the graph. The various color escapes are stored in an array of strings
  12 * where each entry corresponds to a color, except for the last entry,
  13 * which denotes the escape for resetting the color back to the default.
  14 * When generating the graph, strings from this array are inserted before
  15 * and after the various column characters.
  16 *
  17 * This function allows you to enable a custom array of color escapes.
  18 * The 'colors_max' argument is the index of the last "reset" entry.
  19 *
  20 * This functions must be called BEFORE graph_init() is called.
  21 *
  22 * NOTE: This function isn't used in Git outside graph.c but it is used
  23 * by CGit (http://git.zx2c4.com/cgit/) to use HTML for colors.
  24 */
  25void graph_set_column_colors(const char **colors, unsigned short colors_max);
  26
  27/*
  28 * Create a new struct git_graph.
  29 */
  30struct git_graph *graph_init(struct rev_info *opt);
  31
  32/*
  33 * Update a git_graph with a new commit.
  34 * This will cause the graph to begin outputting lines for the new commit
  35 * the next time graph_next_line() is called.
  36 *
  37 * If graph_update() is called before graph_is_commit_finished() returns 1,
  38 * the next call to graph_next_line() will output an ellipsis ("...")
  39 * to indicate that a portion of the graph is missing.
  40 */
  41void graph_update(struct git_graph *graph, struct commit *commit);
  42
  43/*
  44 * Determine if a graph has finished outputting lines for the current
  45 * commit.
  46 *
  47 * Returns 1 if graph_next_line() needs to be called again before
  48 * graph_update() should be called.  Returns 0 if no more lines are needed
  49 * for this commit.  If 0 is returned, graph_next_line() may still be
  50 * called without calling graph_update(), and it will merely output
  51 * appropriate "vertical padding" in the graph.
  52 */
  53int graph_is_commit_finished(struct git_graph const *graph);
  54
  55/*
  56 * Output the next line for a graph.
  57 * This formats the next graph line into the specified strbuf.  It is not
  58 * terminated with a newline.
  59 *
  60 * Returns 1 if the line includes the current commit, and 0 otherwise.
  61 * graph_next_line() will return 1 exactly once for each time
  62 * graph_update() is called.
  63 *
  64 * NOTE: This function isn't used in Git outside graph.c but it is used
  65 * by CGit (http://git.zx2c4.com/cgit/) to wrap HTML around graph lines.
  66 */
  67int graph_next_line(struct git_graph *graph, struct strbuf *sb);
  68
  69
  70/*
  71 * Return current width of the graph in on-screen characters.
  72 */
  73int graph_width(struct git_graph *graph);
  74
  75/*
  76 * graph_show_*: helper functions for printing to stdout
  77 */
  78
  79
  80/*
  81 * If the graph is non-NULL, print the history graph to stdout,
  82 * up to and including the line containing this commit.
  83 * Does not print a terminating newline on the last line.
  84 */
  85void graph_show_commit(struct git_graph *graph);
  86
  87/*
  88 * If the graph is non-NULL, print one line of the history graph to stdout.
  89 * Does not print a terminating newline on the last line.
  90 */
  91void graph_show_oneline(struct git_graph *graph);
  92
  93/*
  94 * If the graph is non-NULL, print one line of vertical graph padding to
  95 * stdout.  Does not print a terminating newline on the last line.
  96 */
  97void graph_show_padding(struct git_graph *graph);
  98
  99/*
 100 * If the graph is non-NULL, print the rest of the history graph for this
 101 * commit to stdout.  Does not print a terminating newline on the last line.
 102 */
 103int graph_show_remainder(struct git_graph *graph);
 104
 105/*
 106 * Print a commit message strbuf and the remainder of the graph to stdout.
 107 *
 108 * This is similar to graph_show_strbuf(), but it always prints the
 109 * remainder of the graph.
 110 *
 111 * If the strbuf ends with a newline, the output printed by
 112 * graph_show_commit_msg() will end with a newline.  If the strbuf is
 113 * missing a terminating newline (including if it is empty), the output
 114 * printed by graph_show_commit_msg() will also be missing a terminating
 115 * newline.
 116 */
 117void graph_show_commit_msg(struct git_graph *graph, struct strbuf const *sb);
 118
 119#endif /* GRAPH_H */