[PATCH 05 of 55 RFC c-hglib:level1] hg_add: creating a high level function for mercurial add command
Iulian Stana
julian.stana at gmail.com
Fri Sep 13 19:35:17 CDT 2013
# HG changeset patch
# User Iulian Stana <julian.stana at gmail.com>
# Date 1379109101 -10800
# Sat Sep 14 00:51:41 2013 +0300
# Node ID 1d2acde6fdfd8d4c7fecf8c40d8f56e686e9a9bd
# Parent a48c610e5e6425f88530f8640910c658dd442a47
hg_add: creating a high level function for mercurial add command
diff --git a/client.c b/client.c
--- a/client.c
+++ b/client.c
@@ -367,3 +367,20 @@
return exitcode;
}
+/* The high level add command for hglib API.*/
+int hg_add(hg_handle *handle, int (*callback)(const char *msg, size_t len),
+ char *argument[])
+{
+ int exitcode;
+ char **command = cmdbuilder("add", argument, NULL);
+
+ if(hg_rawcommand(handle, command) < 0){
+ return -1;
+ }
+ free(command);
+
+ exitcode = hg_runcommand(handle, callback, NULL);
+
+ return exitcode;
+}
+
diff --git a/client.h b/client.h
--- a/client.h
+++ b/client.h
@@ -234,4 +234,30 @@
int hg_runcommand(hg_handle *handle, int (*callback)(const char *msg, size_t len),
char *(*prompt)(const char *msg, size_t len))
+/**
+ * \brief hg_add command for hglib API.
+ *
+ * Add the specified files on the next commit.
+ * If no files are given, add all files to the repository.
+ *
+ * Options/Argument list option:
+ *
+ * -I, --include include names matching the given patterns
+ * -X, --exclude exclude names matching the given patterns
+ * -S, --subrepos recurse into subrepositories
+ * -n, --dry-run do not perform actions, just print output
+ *
+ * \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 exitcode To indicate the end of add_command.
+ *
+ * errno can be:
+ * - hg_rawcommand errors
+ * */
+int hg_add(hg_handle *handle, int (*callback)(const char *msg, size_t len),
+ char *argument[]);
+
+
#endif
More information about the Mercurial-devel
mailing list