Comments
Patch
@@ -1217,6 +1217,23 @@
return lbuf;
}
+/* The high level revert command for hglib API. */
+int hg_revert(hg_handle *handle, int(*callback)(const char *msg, size_t len),
+ char *argument[])
+{
+ int exitcode;
+ char **command = cmdbuilder("revert", 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)
@@ -1852,6 +1852,43 @@
size_t len), char *argument[]);
/**
+ * \brief hg_revert command for hglib API.
+ *
+ * With no revision specified, revert the specified files or directories to the
+ * contents they had in the parent of the working directory. This restores the
+ * contents of files to an unmodified state and unschedules adds, removes,
+ * copies, and renames. If the working directory has two parents, you must
+ * explicitly specify a revision.
+ *
+ * Using the -r/--rev or -d/--date options, revert the given files or
+ * directories to their states as of a specific revision. Because revert does
+ * not change the working directory parents, this will cause these files to
+ * appear modified. This can be helpful to "back out" some or all of an earlier
+ * change. See hg backout for a related method.
+ *
+ * Options/Argument list option:
+ *
+ * -a, --all revert all changes when no arguments given
+ * -d, --date tipmost revision matching date
+ * -r, --rev revert to the specified revision
+ * -C, --no-backup do not save backup copies of files
+ * -I, --include include names matching the given patterns
+ * -X, --exclude exclude names matching the given patterns
+ * -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 rename_command.
+ *
+ * errno can be:
+ * - hg_rawcommand errors
+ **/
+int hg_revert(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()