Differences between revisions 2 and 3
Revision 2 as of 2005-10-03 12:43:43
Size: 3271
Editor: ChrisMason
Comment:
Revision 3 as of 2005-11-17 15:53:18
Size: 3273
Editor: ChrisMason
Comment:
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:
Andrew Morton originally developed a set of scripts for maintaining kernel patches outside of any SCM tool. Others extend these into a suite called [http://savannah.nongnu.org/projects/quilt quilt]. The basic idea behind quilt is to maintain patches instead of maintaining source files. Patches can be added, removed or reordered, and they can be refreshed as you fix bugs or update to a new base revision. quilt is very powerful, but it is not integrated with the underlying SCM tools. This make is difficult to visualize your changes. Andrew Morton originally developed a set of scripts for maintaining kernel patches outside of any SCM tool. Others extended these into a suite called [http://savannah.nongnu.org/projects/quilt quilt]. The basic idea behind quilt is to maintain patches instead of maintaining source files. Patches can be added, removed or reordered, and they can be refreshed as you fix bugs or update to a new base revision. quilt is very powerful, but it is not integrated with the underlying SCM tools. This make is difficult to visualize your changes.

Introduction

In a distributed development model, changesets are traditionally immutable. Once a commit is done, it lives in the project history forever. This can make it difficult to develop a set of individual changes for submission to a project maintainer. Over time, the development repository will contain a number of merges, and a long line of changes as the code matures. This history is important for the individual developer, but when the changes are sent upstream they will be very difficult to review.

Andrew Morton originally developed a set of scripts for maintaining kernel patches outside of any SCM tool. Others extended these into a suite called [http://savannah.nongnu.org/projects/quilt quilt]. The basic idea behind quilt is to maintain patches instead of maintaining source files. Patches can be added, removed or reordered, and they can be refreshed as you fix bugs or update to a new base revision. quilt is very powerful, but it is not integrated with the underlying SCM tools. This make is difficult to visualize your changes.

The patch queue extension integrates quilt functionality into Mercurial. Changes are maintained as patches which are committed into Mercurial. Commits can be removed or reordered, and the underlying patch can be refreshed based on changes made in the working directory. The patch directory can also be placed under revision control, so you can have a separate history of changes made to your patches.

Download

The queue extension is pullable from [http://hg.serpentine.com/mercurial/mq]

Using Mercurial Queues

The first step is to enable the mq extension. In the Mercurial source directory, hgext/mq.py is the extension source file. Copy this to a suitable location, and enable the mq extension as described in the ExtensionHowto

After the extension is properly installed, hg help will include the mq commands. These all start with q, and try to mimic commands under quilt. The patch queue lives in a directory named .hg/patches. You can edit the patch files themselves to change the comments used in the Mercurial commit messages. .hg/patches/series lists the patches in the order they will be applied. You can change the patch order simply by moving them around in the series file. Make sure to only change entries in the series file for patches that are not currently applied.

Here are some example commands:

cd some_existing_hg_repository

# setup the patch queue directory
hg qinit

# create a new patch named firstpatch
hg qnew firstpatch

# edit some files
vi filename

# update the patch to contain your changes
hg qrefresh

# vi .hg/patches/firstpatch to see the result
# print the current patch to the screen
hg qdiff

# make some more changes
vi filename

# see the differences not yet stored in the patch
hg diff

# update the patch
hg qrefresh

# create another patch
hg qnew secondpatch

# Make more changes, and update the new patch
vi filename
hg qrefresh

# Look at the patches you have applied
# Look at all the patches in the queue
hg qapplied
hg qseries

# remove the top patch
hg qpop

# apply the patch again
hg qpush

# remove all patches
hg qpop -a

# apply all patches
hg qpush -a

MqExtension (last edited 2018-01-22 15:10:28 by MarioCastelánCastro)