[PATCH 27 of 55 RFC c-hglib:level1] hg_identify: creating a high level function for mercurial identify command
Iulian Stana
julian.stana at gmail.com
Fri Sep 13 19:35:39 CDT 2013
# HG changeset patch
# User Iulian Stana <julian.stana at gmail.com>
# Date 1379112299 -10800
# Sat Sep 14 01:44:59 2013 +0300
# Node ID a952f15026d3945b7a03cf59724e48de7735899c
# Parent e10357d5501c34d611ab04b8f8990b0fa09a4588
hg_identify: creating a high level function for mercurial identify command
diff --git a/client.c b/client.c
--- a/client.c
+++ b/client.c
@@ -855,6 +855,25 @@
return hbuf;
}
+/* The high level forget command for hglib API. */
+char *hg_identify(hg_handle *handle, int(*callback)(const char *msg,
+ size_t len), char *argument[])
+{
+ int exitcode;
+ char **command = cmdbuilder("identify", argument, NULL);
+
+ if(hg_rawcommand(handle, command) < 0){
+ return NULL;
+ }
+ free(command);
+
+ exitcode = hg_runcommand(handle, callback, NULL);
+ if(exitcode)
+ return NULL;
+
+ return get_output_data(handle);
+}
+
/* 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
@@ -1148,6 +1148,47 @@
(const char *msg, size_t len), char *argument[]);
/**
+ * \brief hg_identify command for hglib API.
+ *
+ * Print a summary identifying the repository state at REV using one or two
+ * parent hash identifiers, followed by a "+" if the working directory has
+ * uncommitted changes, the branch name (if not default), a list of tags, and a
+ * list of bookmarks.
+ *
+ * When REV is not given, print a summary of the current state of the
+ * repository.
+ *
+ * Specifying a path to a repository root or Mercurial bundle will cause lookup
+ * to operate on that repository/bundle
+ *
+ * Options/Argument list option:
+ *
+ * -r, --rev identify the specified revision
+ * -n, --num show local revision number
+ * -i, --id show global revision id
+ * -b, --branch show branch
+ * -t, --tags show tags
+ * -B, --bookmarks show bookmarks
+ * -e, --ssh specify ssh command to use
+ * --remotecmd specify hg command to run on the remote side
+ * --insecure do not verify server certificate (ignoring
+ * web.cacerts config)
+ * aliases: id
+ *
+ * \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 unparse_data To indicate the end of identify_command.
+ * \retval NULL To indicate an error.
+ *
+ * errno can be:
+ * - hg_rawcommand errors
+ * */
+char *hg_identify(hg_handle *handle, int (*callback)(const char *msg,
+ size_t len), char *argument[]);
+
+/**
* \brief The yield mechanism that will get the next entry.
*
* This function is used inside of hg_fetch_cset_entry() and hg_fetch_line_entry()
More information about the Mercurial-devel
mailing list