chiark
/
gitweb
/
~mdw
/
tig
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ccc3344
)
Use 'graph' instead of 'stack' in the rev graph code
author
Jonas Fonseca
<fonseca@diku.dk>
Tue, 12 Sep 2006 16:43:52 +0000
(18:43 +0200)
committer
Jonas Fonseca
<fonseca@antimatter.localdomain>
Tue, 12 Sep 2006 16:43:52 +0000
(18:43 +0200)
tig.c
patch
|
blob
|
blame
|
history
diff --git
a/tig.c
b/tig.c
index c88ba2e3f6a687ae7580e221299b13bf2381cfc9..96ab67ffb7fcd280efabb7de8a2006744f77d0da 100644
(file)
--- a/
tig.c
+++ b/
tig.c
@@
-2681,8
+2681,8
@@
struct commit {
/* Size of rev graph with no "padding" columns */
#define SIZEOF_REVITEMS (SIZEOF_REVGRAPH - (SIZEOF_REVGRAPH / 2))
/* Size of rev graph with no "padding" columns */
#define SIZEOF_REVITEMS (SIZEOF_REVGRAPH - (SIZEOF_REVGRAPH / 2))
-struct rev_
stack
{
- struct rev_
stack
*prev, *next, *parents;
+struct rev_
graph
{
+ struct rev_
graph
*prev, *next, *parents;
char rev[SIZEOF_REVITEMS][SIZEOF_REV];
size_t size;
struct commit *commit;
char rev[SIZEOF_REVITEMS][SIZEOF_REV];
size_t size;
struct commit *commit;
@@
-2690,30
+2690,30
@@
struct rev_stack {
};
/* Parents of the commit being visualized. */
};
/* Parents of the commit being visualized. */
-static struct rev_
stack
graph_parents[3];
+static struct rev_
graph
graph_parents[3];
/* The current stack of revisions on the graph. */
/* The current stack of revisions on the graph. */
-static struct rev_
stack
graph_stacks[3] = {
+static struct rev_
graph
graph_stacks[3] = {
{ &graph_stacks[2], &graph_stacks[1], &graph_parents[0] },
{ &graph_stacks[0], &graph_stacks[2], &graph_parents[1] },
{ &graph_stacks[1], &graph_stacks[0], &graph_parents[2] },
};
static inline bool
{ &graph_stacks[2], &graph_stacks[1], &graph_parents[0] },
{ &graph_stacks[0], &graph_stacks[2], &graph_parents[1] },
{ &graph_stacks[1], &graph_stacks[0], &graph_parents[2] },
};
static inline bool
-graph_parent_is_merge(struct rev_
stack
*graph)
+graph_parent_is_merge(struct rev_
graph
*graph)
{
return graph->parents->size > 1;
}
static inline void
{
return graph->parents->size > 1;
}
static inline void
-append_to_rev_graph(struct rev_
stack *stack
, chtype symbol)
+append_to_rev_graph(struct rev_
graph *graph
, chtype symbol)
{
{
- if (
stack->commit->graph_size < ARRAY_SIZE(stack
->commit->graph) - 1)
-
stack->commit->graph[stack
->commit->graph_size++] = symbol;
+ if (
graph->commit->graph_size < ARRAY_SIZE(graph
->commit->graph) - 1)
+
graph->commit->graph[graph
->commit->graph_size++] = symbol;
}
static void
}
static void
-done_rev_graph(struct rev_
stack
*graph)
+done_rev_graph(struct rev_
graph
*graph)
{
if (graph_parent_is_merge(graph) &&
graph->pos < graph->size - 1 &&
{
if (graph_parent_is_merge(graph) &&
graph->pos < graph->size - 1 &&
@@
-2734,20
+2734,20
@@
done_rev_graph(struct rev_stack *graph)
}
static void
}
static void
-push_rev_
stack(struct rev_stack *stack
, char *parent)
+push_rev_
graph(struct rev_graph *graph
, char *parent)
{
/* Combine duplicate parents lines. */
{
/* Combine duplicate parents lines. */
- if (
stack
->size > 0 &&
- !strncmp(
stack->rev[stack
->size - 1], parent, SIZEOF_REV))
+ if (
graph
->size > 0 &&
+ !strncmp(
graph->rev[graph
->size - 1], parent, SIZEOF_REV))
return;
return;
- if (
stack
->size < SIZEOF_REVITEMS) {
- string_ncopy(
stack->rev[stack
->size++], parent, SIZEOF_REV);
+ if (
graph
->size < SIZEOF_REVITEMS) {
+ string_ncopy(
graph->rev[graph
->size++], parent, SIZEOF_REV);
}
}
static void
}
}
static void
-draw_rev_graph(struct rev_
stack
*graph)
+draw_rev_graph(struct rev_
graph
*graph)
{
chtype symbol, separator, line;
size_t i;
{
chtype symbol, separator, line;
size_t i;
@@
-2809,7
+2809,7
@@
draw_rev_graph(struct rev_stack *graph)
}
void
}
void
-update_rev_graph(struct rev_
stack
*graph)
+update_rev_graph(struct rev_
graph
*graph)
{
size_t i;
{
size_t i;
@@
-2818,15
+2818,15
@@
update_rev_graph(struct rev_stack *graph)
if (!strcmp(graph->rev[graph->pos], graph->commit->id))
break;
if (!strcmp(graph->rev[graph->pos], graph->commit->id))
break;
- push_rev_
stack
(graph->next, graph->rev[graph->pos]);
+ push_rev_
graph
(graph->next, graph->rev[graph->pos]);
}
for (i = 0; i < graph->parents->size; i++)
}
for (i = 0; i < graph->parents->size; i++)
- push_rev_
stack
(graph->next, graph->parents->rev[i]);
+ push_rev_
graph
(graph->next, graph->parents->rev[i]);
/* FIXME: Moving branches left and right when collapsing a branch. */
for (i = graph->pos + 1; i < graph->size; i++)
/* FIXME: Moving branches left and right when collapsing a branch. */
for (i = graph->pos + 1; i < graph->size; i++)
- push_rev_
stack
(graph->next, graph->rev[i]);
+ push_rev_
graph
(graph->next, graph->rev[i]);
draw_rev_graph(graph);
done_rev_graph(graph->prev);
draw_rev_graph(graph);
done_rev_graph(graph->prev);
@@
-2948,7
+2948,7
@@
main_draw(struct view *view, struct line *line, unsigned int lineno, bool select
static bool
main_read(struct view *view, char *line)
{
static bool
main_read(struct view *view, char *line)
{
- static struct rev_
stack
*graph = graph_stacks;
+ static struct rev_
graph
*graph = graph_stacks;
enum line_type type = get_line_type(line);
struct commit *commit = view->lines
? view->line[view->lines - 1].data : NULL;
enum line_type type = get_line_type(line);
struct commit *commit = view->lines
? view->line[view->lines - 1].data : NULL;
@@
-2970,7
+2970,7
@@
main_read(struct view *view, char *line)
case LINE_PARENT:
if (commit) {
line += STRING_SIZE("parent ");
case LINE_PARENT:
if (commit) {
line += STRING_SIZE("parent ");
- push_rev_
stack
(graph->parents, line);
+ push_rev_
graph
(graph->parents, line);
}
break;
}
break;