[PATCH 31 of 55 RFC c-hglib:level1] hg_log: creating a high level function for mercurial log command
Iulian Stana
julian.stana at gmail.com
Sat Sep 14 00:35:43 UTC 2013
# HG changeset patch
# User Iulian Stana <julian.stana at gmail.com>
# Date 1379112656 -10800
# Sat Sep 14 01:50:56 2013 +0300
# Node ID c67bbcf6e45df6deb1e0f009c5f1145c541b4b83
# Parent f878cd8368a6d91d2107af4e93ead5f4b7dc69e5
hg_log: creating a high level function for mercurial log command
diff --git a/client.c b/client.c
--- a/client.c
+++ b/client.c
@@ -932,6 +932,27 @@
return lbuf;
}
+/* The high level log command for hglib API. */
+hg_csetstream_buffer *hg_log(hg_handle *handle, int (*callback)(const char *msg,
+ size_t len), char *argument[])
+{
+ hg_csetstream_buffer *cbuf = malloc(sizeof(hg_csetstream_buffer));
+ cbuf->handle = handle;
+
+ cbuf->command = cmdbuilder("log", argument, "--template", CHANGESET,
+ NULL);
+
+ if(hg_rawcommand(handle, cbuf->command) < 0){
+ return NULL;
+ }
+
+ cbuf->callback = callback;
+ cbuf->buffer = NULL;
+ cbuf->buf_size = 0;
+
+ return cbuf;
+}
+
/* The yield next step. Getting the next entry. */
int hg_fetch_entry(hg_stream_buffer *stream, int (*detect_byte)(char *buff,
int buf_size, int data_on_pipe), int func_type)
diff --git a/client.h b/client.h
--- a/client.h
+++ b/client.h
@@ -1324,8 +1324,68 @@
* - hg_rawcommand errors
* */
hg_linestream_buffer *hg_locate(hg_handle *handle, int (*callback)
- (const char *msg, size_t len), char *argument[]);
-
+ (const char *msg, size_t len), char *argument[]);
+
+/**
+ * \brief hg_log command for hglib API.
+ *
+ * Print the revision history of the specified files or the entire project.
+ *
+ * If no revision range is specified, the default is tip:0 unless --follow is
+ * set, in which case the working directory parent is used as the starting
+ * revision.
+ *
+ * File history is shown without following rename or copy history of files. Use
+ * -f/--follow with a filename to follow history across renames and copies.
+ * --follow without a filename will only show ancestors or descendants of the
+ * starting revision.
+ *
+ * Options/Argument list option:
+ *
+ * -f, --follow follow changeset history, or file history across
+ * copies and renames
+ * --follow-first only follow the first parent of merge changesets
+ * (DEPRECATED)
+ * -d, --date show revisions matching date spec
+ * -C, --copies show copied files
+ * -k, --keyword do case-insensitive search for a given text
+ * -r, --rev show the specified revision or range
+ * --removed include revisions where files were removed
+ * -m, --only-merges show only merges (DEPRECATED)
+ * -u, --user revisions committed by user
+ * --only-branch show only changesets within the given named branch
+ * (DEPRECATED)
+ * -b, --branch show changesets within the given named branch
+ * -P, --prune do not display revision or any of its ancestors
+ * -p, --patch show patch
+ * -g, --git use git extended diff format
+ * -l, --limit limit number of changes displayed
+ * -M, --no-merges do not show merges
+ * --stat output diffstat-style summary of changes
+ * -G, --graph show the revision DAG
+ * --style display using template map file
+ * --template display with template
+ * -I, --include include names matching the given patterns
+ * -X, --exclude exclude names matching the given patterns
+ * aliases: history
+ *
+ * To get incoming information use the returned hg_csetstream_buffer structure
+ * with hg_fetch_cset_entry() function.
+ *
+ * \param handle The handle of the connection, wherewith I want to communicate
+ * \param callback A function that will handle error data.
+ * A NULL pointer will ignore error data.
+ * \param argument The option list. Will contain all option that you wish.
+ * \retval hg_csetstream_buffer A pointer to hg_csetstream_buffer structure if
+ * successful
+ * \retval NULL to indicate an error, with errno set appropriately.
+ *
+ * errno can be:
+ * - hg_rawcommand errors
+ * */
+hg_csetstream_buffer *hg_log(hg_handle *handle, int (*callback)(const char *msg,
+ size_t len), char *argument[]);
+
/**
* \brief The yield mechanism that will get the next entry.
*
More information about the Mercurial-devel
mailing list