[RFC] mercurial patch queues (quilt)
Chris Mason
mason at suse.com
Mon Jul 11 18:17:21 UTC 2005
Hello everyone,
Over the weekend, I started some code that adds basic quilt like features on
top of mercurial. quilt is wonderful, but it can't:
1) do revision control on the patches themselves
2) integrate file history with an underlying SCM
3) work without adding each file you want to diff (quilt add)
#1 isn't part of my current code, I wanted to get the basic features working
first.
For #2, I'd like to be able to run one command, and see which changes are made
by past revisions in the underlying SCM and which changes are made by patches
applied in the queue. This does work with my code.
#3 comes for free, since hg tracks everything for me.
You can download the current patches from:
ftp://ftp.suse.com/pub/people/mason/mercurial/
There is a group of small hg changes needed to make thing work. The patch
named mq adds the mq command to the contrib directory.
mq help gives you a list of the basic operations.
Patches live in .hg/patches, where things work much like quilt. When you
apply a patch, mq commits it into hg. popping a patch uses a revised version
of the undo code I posted last week (moved into the mq command).
One big difference from quilt is the applied patches are recorded
in .hg/patches/status. This is because my end goal is to have the patch dir
more integrated, so I don't want to keep the status in some external file.
Sample usage:
hg init
touch foo
hg add foo
hg commit -t first
mq init
mq new first_patch
echo contents > foo
mq refresh
mq pop
mq push
You can also edit the series file by hand and copy patches into .hg/patches as
you would have with quilt.
This is all very early work and needs to be cleaned up, but I wanted to post
here for testers and comments. The pop command does muck around in the
repository quite a bit, so I wouldn't use this on critical data.
-chris
More information about the Mercurial
mailing list