1

So, there is a project that I forked, and then I worked on it in my own branch, and pushed to my own fork. So let's say the last/tip of the original project was revision 5000; when I started working in my branch I made revision 5001, and now at the end, my branch tip is at revision 5050.

Now, if I use

hg export 5001:5050

... I get all the changesets in a single patch, which is however signed. This is great, but it makes reading for review difficult.

If i use:

hg diff -r 5000:5050

... or just hg diff -r 5000, I get all of the changes from all the changesets "collapsed" or "compressed" into a single changeset - this is great for reading for review, but does not include any signing, as in:

# HG changeset patch
# User username <user@e.mail>
# Date 1545633736 -3600
#      Mon Dec 24 07:42:16 2018 +0100
...

... and does not include binary files, like hg export --git does.

So, is it possible to get an output like hg export --git R1+1:R2 (which includes signatures and binary files) - however, where all changes are collapsed like in hg diff -r R1:R2?

Note that I just want to generate a patch file, I do not want to mess with the history neither in my local copy of the fork, nor with the fork on the server - I mention this because I've seen With Mercurial, how can I "compress" a series of changesets into one before pushing?, and a lot of answers there talk about history rewriting and such...


EDIT: sort of got this with running these two commands in bash:

hg export | head -9 > ../mybranch.5050.patch
hg diff --git -r 5000 >> ../mybranch.5050.patch

... however, clearly the hg export header will be wrong, so I'd bet hg import will refuse it... So it would still be nice to know, if there is a way to get something like this, that hg import would accept...

sdaau
  • 36,975
  • 46
  • 198
  • 278
  • 1
    There isn't, because the point of exporting is to make it possible to re-create the original commits, and to do that, Mercurial needs, for each commit to import, all the commit information *plus* the *specific* change-set. Meanwhile the point of `hg diff` is to compare *two specific revisions*, which gives you a change-set, but that change-set only matches any one particular commit *if* the two specific revisions have a direct parent/child relationship. But your workaround is fine if you just want to use it for review purposes. – torek Jan 07 '19 at 07:38
  • 1
    `hg bundle` + `hg unbundle` on target ?! – Lazy Badger Jan 07 '19 at 08:40

0 Answers0