summaryrefslogtreecommitdiff
path: root/src/git
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2010-05-25 19:48:13 +0200
committerAndreas Ericsson <ae@op5.se>2010-06-02 10:32:07 +0200
commite5d1faefab1bb51f3d0fff2d5e2cfe4fe96a9c22 (patch)
treeefa3c49e538c7d0724cbd9c32b24bbcde100b3cb /src/git
parent9bdb75947178f72df30314d66bc9bcc90df643d7 (diff)
downloadlibgit2-e5d1faefab1bb51f3d0fff2d5e2cfe4fe96a9c22.tar.gz
Add external API for revision sorting.
The GIT_RPSORT_XXX flags have been moved to the external API, and a new method 'gitrp_sorting(...)' has been added to safely change the sorting method of a revision pool. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Diffstat (limited to 'src/git')
-rw-r--r--src/git/revwalk.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/git/revwalk.h b/src/git/revwalk.h
index 4e7e9f60b..0a902f96c 100644
--- a/src/git/revwalk.h
+++ b/src/git/revwalk.h
@@ -15,6 +15,35 @@
GIT_BEGIN_DECL
/**
+ * Sort the revpool contents in no particular ordering;
+ * this sorting is arbritary, implementation-specific
+ * and subject to change at any time.
+ * This is the default sorting for new revision pools.
+ */
+#define GIT_RPSORT_NONE (0)
+
+/**
+ * Sort the revpool contents in topological order
+ * (parents before children); this sorting mode
+ * can be combined with time sorting.
+ */
+#define GIT_RPSORT_TOPOLOGICAL (1 << 0)
+
+/**
+ * Sort the revpool contents by commit time;
+ * this sorting mode can be combined with
+ * topological sorting.
+ */
+#define GIT_RPSORT_TIME (1 << 1)
+
+/**
+ * Iterate through the revpool contents in reverse
+ * order; this sorting mode can be combined with
+ * any of the above.
+ */
+#define GIT_RPSORT_REVERSE (1 << 2)
+
+/**
* Allocate a new revision traversal pool.
*
* The configuration is copied during allocation. Changes
@@ -55,6 +84,13 @@ GIT_EXTERN(void) gitrp_hide(git_revpool *pool, git_commit *commit);
GIT_EXTERN(git_commit *) gitrp_next(git_revpool *pool);
/**
+ * Change the sorting mode when iterating through the
+ * revision pool's contents.
+ * @param sort_mode combination of GIT_RPSORT_XXX flags
+ */
+GIT_EXTERN(void) gitrp_sorting(git_revpool *pool, unsigned int sort_mode);
+
+/**
* Free a revwalk previously allocated.
* @param pool traversal handle to close. If NULL nothing occurs.
*/