[PATCH 54 of 55 RFC c-hglib:level1] hg_verify: creating a high level function for mercurial verify command
Iulian Stana
julian.stana at gmail.com
Fri Sep 13 19:36:06 CDT 2013
# HG changeset patch
# User Iulian Stana <julian.stana at gmail.com>
# Date 1379118588 -10800
# Sat Sep 14 03:29:48 2013 +0300
# Node ID 6f885ae8f3c02696497e3a31c768629c0b5bf481
# Parent 4a430affaa639c3e7466b3570611baae9e79aae4
hg_verify: creating a high level function for mercurial verify command
diff --git a/client.c b/client.c
--- a/client.c
+++ b/client.c
@@ -1471,6 +1471,24 @@
return update;
}
+/* The high level verify command for hglib API. */
+char *hg_verify(hg_handle *handle, int(*callback)(const char *msg,
+ size_t len))
+{
+ char **command = cmdbuilder("verify", NULL , NULL);
+
+ if(hg_rawcommand(handle, command) < 0){
+ return NULL;
+ }
+ free(command);
+
+ hg_runcommand(handle, callback, NULL);
+
+ char *out = get_output_data(handle);
+
+ return out;
+}
+
/* 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
@@ -2303,6 +2303,31 @@
size_t len), char *argument[]);
/**
+ * \brief hg_verify command for hglib API.
+ *
+ * Verify the integrity of the current repository.
+ *
+ * This will perform an extensive check of the repository's integrity,
+ * validating the hashes and checksums of each entry in the changelog, manifest,
+ * and tracked files, as well as the integrity of their crosslinks and indices.
+ *
+ * Please see http://mercurial.selenic.com/wiki/RepositoryCorruption for more
+ * information about recovery from corruption of the repository.
+ *
+ * \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.
+ * \retval out_dat Output data received from cmdserver
+ * \retval NULL To indicate an error.
+ *
+ * errno can be:
+ * - hg_rawcommand errors
+ *
+ * */
+char *hg_verify(hg_handle *handle, int(*callback)(const char *msg,
+ size_t len));
+
+/**
* \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