Hi, On Tue, 11 Nov 2008, Ondrej Certik wrote: > But imho if git supported mercurial patches, life would be a lot easier. Mine would not be. BTW I had to be online (which is not always the case when I read email) to access the pastebin, which made it more of a hassle to look at it than I deem necessary. Besides, it is bad because in 3 days, that pastie will be gone. Not nice. So here is it, for the pleasure of others: # HG changeset patch # User Vinzent Steinberg <vinzent.steinberg@xxxxxxxxx> # Date 1226338168 -3600 # Node ID 23efeaf89f7089d94307526ec0536eb6f4382213 # Parent dab6435e04fd083d66bbfa897cbe15ab9660b9e6 <commit subject> <commit body> diff -r <commit name> -r <commit name> <filename> --- a/<filename> <date> --- b/<filename> <date> @@ <line range pair> @@ ... So what I suggest is that you familiarize yourself with builtin-mailsplit.c. Basically you'd need to enhance the is_from_line() function to check this: const char *hg_patch_preamble = "# HG changeset patch\n"; if (len >= strlen(hg_patch_preamble) && !memcmp(line, hg_patch_preamble, strlen(hg_patch_preamble)) return 1; Then you need to familiarize yourself with builtin-mailinfo.c. In function mailinfo(), you'd need to work on this: /* process the email header */ while (read_one_header_line(&line, fin)) check_header(&line, p_hdr_data, 1); I'd suggest to make the function read_one_header_line() into a handle_one_header_line(), and replace the while loop with this: if (!strbuf_getline(&line, fin)) { if (!strcmp(line.buf, "# HG changeset patch\n")) while (handle_one_hg_header_line(&line, p_hdr_data, fin)) strbuf_getline(&line, fin); else while (handle_one_header_line(&line, fin)) { check_header(&line, p_hdr_data, 1); strbuf_getline(&line, fin); } } Implementing handle_one_hg_header_line() should be a breeze: static int handle_one_hg_header_line(struct strbuf *line, struct strbuf *hdr_data[], FILE *in) { if (line.buf[0] != '#') { strbuf_addbuf(hdr_data[1], line); return 0; /* no more headers */ } if (!prefixcmp(line.buf, "# User ")) strbuf_addstr(hdr_data[0], line.buf + 7); else if (!prefixcmp(line.buf, "# Date ")) strbuf_addstr(hdr_data[2], line.buf + 7); return 1; } Okay, this is all utterly untested, and you probably need to trim the newlines from the lines first, and maybe you need to replace the hdr_data[] entries instead of adding to them, but now you have a starting point. Hth, Dscho -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html