Mercurial: diff between a patch and a workspace ?
John Rose
John.Rose at Sun.COM
Fri Sep 12 17:50:50 PDT 2008
On Sep 12, 2008, at 4:07 PM, Rémi Forax wrote:
> So i have a mercurial question :
> How to make a diff between a patch and my current workspace ?
Here's the easiest way to make changes on top of the MLVM patches:
1. Follow the instructions in README.txt to create sources and
patches forests.
2. Pick a source repo. to work, such as "sources/hotspot"; cd to it.
3. Use "hg qpush", "hg qpop" and similar commands to select the MLVM
patch you want to work on.
4. Make new changes!
5. Use "hg st", "hg diff", etc., to examine and review those
differences.
6. To push your new changes into the current patch (whichever it is),
use "hg qrefresh".
This should feel just like normal OpenJDK development, with the extra
goodness of MQ (the hg patch queue).
To think about updating the MLVM patches themselves, you need to
start working with the patches forest.
Because sources/hotspot/.hg/patches is a symlink to patches/hotspot,
your "qref" in step 6 above modified some patch file patches/hotspot/
foo.patch, which itself is under source control.
To work with the patch repo., bounce over to the corresponding patch
directory. (I use pushd/popd in the shell.)
7. Jump over to the patch repo: "pushd ../../patches/hotspot". Note
that foo.patch is newly updated.
8. Use "hg st" to examine the state of this patch repo. Make sure
the right changes are in the right patches.
9. You can use "hg diff" to create a second-order diff. This is less
interesting and useful than the diff made at step 5 above.
10. If all is well, and after review and adjustment, use "hg com -m
'...'" to commit.
If your changes are for several patches, use "hg qpush" and "hg qpop"
in step 3 to spread your changes through different patch layers.
You can also sometimes use the "-X" option to "hg qref" to exclude
changes from an unrelated file that you have changed. But Mercurial
doesn't work this way easily.
Sometimes I will make a bunch of changes without worrying which patch
they apply to. The commands "hg qnew -f temp.patch", "hg qpop", "hg
qdel -k temp.patch" will export my changes as a temporary patch file,
which I can then reapply piecemeal into the right permanent patches.
(XEmacs has a great diff-mode that helps with this!)
Does that help?
-- John
Ref: http://hg.openjdk.java.net/mlvm/mlvm/file/tip/README.txt
More information about the mlvm-dev
mailing list