[PATCH 22 of 55 RFC c-hglib:level1] hg_forget: creating a high level function for mercurial forget command

Iulian Stana julian.stana at gmail.com
Sat Sep 14 00:35:34 UTC 2013


# HG changeset patch
# User Iulian Stana <julian.stana at gmail.com>
# Date 1379111931 -10800
#      Sat Sep 14 01:38:51 2013 +0300
# Node ID 83ef0a283b1a285e5bbdf13752d2e9d44ddc0c7a
# Parent  96cf6fc587a26c0c104ec243f9305b69ad7ecb99
hg_forget: creating a high level function for mercurial forget command

diff --git a/client.c b/client.c
--- a/client.c
+++ b/client.c
@@ -760,6 +760,23 @@
 	return ebuf;
 }
 
+/* The high level forget command for hglib API. */
+int hg_forget(hg_handle *handle, int(*callback)(const char *msg, size_t len),
+							char *argument[])
+{
+	int exitcode;
+	char **command = cmdbuilder("forget", argument, NULL);
+
+	if(hg_rawcommand(handle, command) < 0){
+		return -1;
+	}
+	free(command);
+
+	exitcode = hg_runcommand(handle, callback, NULL);
+
+	return exitcode;
+}
+
 /* 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
@@ -955,6 +955,32 @@
 			(const char *msg, size_t len), char *argument[]);
 
 /**
+ * \brief hg_forgot command for hglib API.
+ *
+ * Mark the specified files so they will no longer be tracked after the next
+ * commit.
+ *
+ * This only removes files from the current branch, not from the entire project
+ * history, and it does not delete them from the working directory.
+ *
+ * Options/Argument list option:
+ *
+ *	-I, --include	include names matching the given patterns
+ *	-X, --exclude	exclude names matching the given patterns
+ *
+ * \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 copy_command.
+ *
+ * errno can be:
+ *      - hg_rawcommand errors
+ * */
+int hg_forget(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