Comments
Patch
@@ -106,6 +106,53 @@
return exitcode;
}
+/**
+ * \brief 'Parse a changeset'. It's more like pointing to the correct position.
+ *
+ * The changeset could be found on buff pointer. To not duplicate the data I
+ * choose to point every hg_cset_entry field to the right position.
+ * \param cset The pointer where changeset could be found.
+ * \param ce The hg_cset_entry structure where the changeset will be parse.
+ * \retval 0 if successful.
+ * */
+int parse_changeset(char *cset, hg_cset_entry *ce)
+{
+ char *position = cset;
+ /* set pointer for revision position */
+ ce->rev = cset;
+ position = strstr(position, "\n");
+ cset[position - cset] = '\0';
+
+ /* set pointer for node position */
+ ce->node = position + 1;
+ position = strstr(position + 1, "\n");
+ cset[position - cset] = '\0';
+
+ /* set pointer for tag position */
+ ce->tags = position + 1;
+ position = strstr(position + 1, "\n");
+ cset[position - cset] = '\0';
+
+ /* set pointer for branch position */
+ ce->branch = position + 1;
+ position = strstr(position + 1, "\n");
+ cset[position - cset] = '\0';
+
+ /* set pointer for author position */
+ ce->author = position + 1;
+ position = strstr(position + 1, "\n");
+ cset[position - cset] = '\0';
+
+ /* set pointer for data position */
+ ce->date = position + 1;
+ position = strstr(position + 1, "\n");
+ cset[position - cset] = '\0';
+
+ /* set pointer for description position */
+ ce->desc = position + 1;
+ /* */
+ return 0;
+}
/* The cbuf next step. Getting the next changeset. */
int hg_fetch_cset_entry(hg_csetstream_buffer *cbuf, hg_cset_entry *centry)