I have played with the rdiff extension but it doesn't quite do what I want. In
particular, say I have a repo in which I have already fetched some remote
changes, and also have some locally made commits, and I am ready to push. hg out
-p shows:
$ hg out -p
comparing with /tmp/hgtest-synch/server/dev
searching for changes
changeset: 26:35678ff13c83
user: Jesse Glick <jesse.glick@sun.com>
date: Tue Feb 12 14:59:29 2008 -0500
summary: m
diff -r 299b796ec2a9 -r 35678ff13c83 m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/m Tue Feb 12 14:59:29 2008 -0500
@@ -0,0 +1,1 @@
+m
changeset: 31:e4d334f03d11
tag: tip
parent: 26:35678ff13c83
parent: 30:02ba71c3c120
user: Jesse Glick <jesse.glick@sun.com>
date: Tue Feb 12 15:01:08 2008 -0500
summary: Automated merge with file:/tmp/hgtest-synch/server/dev
diff -r 35678ff13c83 -r e4d334f03d11 i
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/i Tue Feb 12 15:01:08 2008 -0500
@@ -0,0 +1,1 @@
+i
diff -r 35678ff13c83 -r e4d334f03d11 l
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/l Tue Feb 12 15:01:08 2008 -0500
@@ -0,0 +1,1 @@
+l
OK, obviously (1) this shows multiple diffs whereas I wanted just one, (2) the
merge diff is meaningless. hg out -pM partially solves the second problem, but
there is no way to verify that the diff did what I expected, so if I messed up
the merge somehow -M will hide that error from me, which is not comforting.
rdiff almost gives me what I want:
$ hg di ../../server/dev
comparing with ../../server/dev
searching for changes
diff -r e4d334f03d11 -r 02ba71c3c120 m
--- a/m Tue Feb 12 15:01:08 2008 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-m
Here it is showing me the change I will actually cause in the server, between
the current head and the proposed new head. Unfortunately it shows the diff in
reverse, which is hard to read! And I cannot figure out any way to get rdiff to
give me the patch in correct order, other than adding '| interdiff /dev/stdin
/dev/null'.
If you are willing to spend the time to look at hg tip after the fetch
$ hg tip
changeset: 31:e4d334f03d11
tag: tip
parent: 26:35678ff13c83
parent: 30:02ba71c3c120
user: Jesse Glick <jesse.glick@sun.com>
date: Tue Feb 12 15:01:08 2008 -0500
summary: Automated merge with file:/tmp/hgtest-synch/server/dev
and you have had some coffee recently, then you may be able to guess to run
$ hg di -r30:31
diff -r 02ba71c3c120 -r e4d334f03d11 m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/m Tue Feb 12 15:01:08 2008 -0500
@@ -0,0 +1,1 @@
+m
which is I wanted to see. But this is subtle enough that I should not have to
figure it out.
'hg --config extensions.parentrevspec= di -rtip^2:tip' works if you have just
run 'hg fetch' and it did a merge. But if you then make another commit in your
local repo before pushing, you will have to use different version numbers.
Since generally I will have already pulled and merged (or fetched) from the
destination repository to make sure I am able to push without creating a new
remote head, what I usually want is a command that looks back from tip for the
last merge changeset, then diffs from the second merge parent to tip. Assuming I
have only one head in my local repo and will not be passing -f to push, this
should give me a summary of what changes I am about to make to the remote repo,
including the final result of any merges I had to perform in the process.
Unfortunately this trick only works if you have merged from the remote repo and
this was your most recent merge. So in general the command would need to examine
the remote repo for its heads, aborting if more than one is found; examine the
local repo for its heads, again aborting if more than one is found; ensure that
the local head is a descendant of the remote head, aborting if not with the
suggestion that you first fetch; and then run a regular local diff from the
remote head's revision to tip.
I might suggest 'hg out --summary' for this purpose.
|