quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Quilt-dev] Idea: Tree instead of Stack?


From: Hans Fugal
Subject: [Quilt-dev] Idea: Tree instead of Stack?
Date: Fri, 16 Nov 2007 09:54:12 -0700
User-agent: Mutt/1.5.13 (2006-08-11)

First of all, quilt is a great tool, many thanks!

I feel somewhat claustrophobic with just a linear series of patches.
It's useful to sometimes deal with independent stacks of patches, which
can be accomplished using symlinks of the QUILT_PATCHES and QUILT_PC
variables. But sometimes you might like to have several stacks depend on
another stack. I would love to be able to work with a tree of patches
instead. An example use case for this would be fixing compilation errors
of project X on the trunk (maybe it's old and doesn't compile cleanly
with modern gcc, or maybe you're on a different architecture), then
having two or more independent patch stacks that depend on the
compilation fixes.

A tree (instead of an arbitrary DAG) is a good abstraction because
people are used to working with trees (directory structure) and all the
tools for manipulating and visualizing the tree are there (if the tree
structure is represented using the directory structure). I envision a
patches tree something like this:

    work/ -+- ...
    |- patches/ -+- series
                 |- patch2.diff
                 |- patch1.diff
                 |- ...
                 +- branch1/ -+-
                 |            |- series
                 |            |- patch3.diff
                 |            |- patch4.diff
                 |            |- ...
                 |            +- branch2/ -+-
                 |                         |- series
                 |                         |- ...
                 +- branch3/ -+-
                              |- series
                              |- foo.diff


Each branch would have a series of patches. Switching to a branch would
be done by providing the path to the branch to switch to, which would
pop off or push on patches such that all the patches are applied in the
path compenents leading up to the indicated branch or patch.

For example, suppose the following stack of patches is applied:

  patch2.diff
  patch1.diff
  ...
  branch1/patch3.diff
  branch1/patch4.diff

Now, suppose I request that branch3/foo.diff be the top of the stack.
branch1/patch4.diff and branch1/patch3.diff would be popped, then
branch3/foo.diff would be pushed. Another example, if patch1.diff was
the only patch applied and I requested branch3/foo.diff, then the
remaining patches in the root series would be applied before descending
into branch3.

Do you feel that this is a possible place for quilt to go in the future? 

I think it can be done with quilt as-is using some external scripts, by
keeping the tree in another directory (patchtree perhaps) and symlinking
the branch to patches (or utilizing QUILT_PATCHES), and likewise for the
.pc directory. The script would take care of dependencies and leave you
with quilt looking at only the branch in question. quilt would not tell
the whole story about which patches are applied, but the wrapper script
could. It's not the cleanest approach, but it could be done, if you feel
that this isn't a direction to take quilt itself in.

If it was done in quilt, I think it could be done without breaking
compatibility. Although the user would hopefully choose to use
subdirectories only for the tree representation, quilt could certainly
still allow subdirectories in series files, where another series file is
not in the subdirectory. So people using subdirectories for organizing
their linear stack would have unchanged behavior. People not wanting to
mess with trees would have nothing new to learn (a stack is simply a
tree with no branches). Nothing in .pc would need to change, only the
logic in pushing and popping across branches and in creating new
branches.

I might also note that guards could be used, since any tree can be
linearized. Guards are actually more general, but using them is more
manual than laying the tree on top of the filesystem. Again, a wrapper
script could do the housekeeping.

I look forward to your feedback.

-- 
Hans Fugal ; http://hans.fugal.net
 
There's nothing remarkable about it. All one has to do is hit the 
right keys at the right time and the instrument plays itself.
    -- Johann Sebastian Bach

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]