1 #ifndef INCLUDE_git_revwalk_h__
2 #define INCLUDE_git_revwalk_h__
10 * @brief Git revision traversal routines
11 * @defgroup git_revwalk Git revision traversal routines
18 * Sort the revpool contents in no particular ordering;
19 * this sorting is arbritary, implementation-specific
20 * and subject to change at any time.
21 * This is the default sorting for new revision pools.
23 #define GIT_RPSORT_NONE (0)
26 * Sort the revpool contents in topological order
27 * (parents before children); this sorting mode
28 * can be combined with time sorting.
30 #define GIT_RPSORT_TOPOLOGICAL (1 << 0)
33 * Sort the revpool contents by commit time;
34 * this sorting mode can be combined with
35 * topological sorting.
37 #define GIT_RPSORT_TIME (1 << 1)
40 * Iterate through the revpool contents in reverse
41 * order; this sorting mode can be combined with
44 #define GIT_RPSORT_REVERSE (1 << 2)
47 * Allocate a new revision traversal pool.
49 * The configuration is copied during allocation. Changes
50 * to the configuration after allocation do not affect the pool
51 * returned by this function. Callers may safely free the
52 * passed configuration after the function completes.
54 * @param db the database objects are read from.
55 * @return the new traversal handle; NULL if memory is exhausted.
57 GIT_EXTERN(git_revpool
*) gitrp_alloc(git_odb
*db
);
60 * Reset the traversal machinary for reuse.
61 * @param pool traversal handle to reset.
63 GIT_EXTERN(void) gitrp_reset(git_revpool
*pool
);
66 * Mark an object to start traversal from.
67 * @param pool the pool being used for the traversal.
68 * @param commit the commit to start from.
70 GIT_EXTERN(void) gitrp_push(git_revpool
*pool
, git_commit
*commit
);
73 * Mark a commit (and its ancestors) uninteresting for the output.
74 * @param pool the pool being used for the traversal.
75 * @param commit the commit that will be ignored during the traversal
77 GIT_EXTERN(void) gitrp_hide(git_revpool
*pool
, git_commit
*commit
);
80 * Get the next commit from the revision traversal.
81 * @param pool the pool to pop the commit from.
82 * @return next commit; NULL if there is no more output.
84 GIT_EXTERN(git_commit
*) gitrp_next(git_revpool
*pool
);
87 * Change the sorting mode when iterating through the
88 * revision pool's contents.
89 * @param sort_mode combination of GIT_RPSORT_XXX flags
91 GIT_EXTERN(void) gitrp_sorting(git_revpool
*pool
, unsigned int sort_mode
);
94 * Free a revwalk previously allocated.
95 * @param pool traversal handle to close. If NULL nothing occurs.
97 GIT_EXTERN(void) gitrp_free(git_revpool
*pool
);