[Nix-dev] a small introduciton to top-git

Marc Weber marco-oweber at gmx.de
Sat Mar 7 18:42:00 CET 2009


I've talked with pierron and civodul about how to integrate the
fix-style branch into trunk piecwise.

I'd like to tell you about top git because it is a nice tool handling
such use cases. top git is a set of shell scripts on top of git.
In contrast to quilt or stgit or such (which are a pain to use IMHO) it
is designed to be used in a distributed way. Thus you don't rebase
commits, you always 'merge' to make it possible for others to follow
changes

t/A = topic branch A
t/B = topic branch B

a - b - c - d trunk
    | - x      t/B
    ` - y      t/A
       ` - z   t/A/z (topic branch depending on another topic branch)

So whats' special about top git?

You can make one topic branch depend on multiple other branches. Top git
keeps a special file called .topdeps so it always knows on which other
branches the topic branch depends on.

Example

branch t/A depends on t/D1 and t/D2

top git then merges t/D1 and t/D2 to a base.
This base is another branch which is controlled by top git.
eg 

- t/D1 -- .
           \
             base -> hack -> hack -> hack
- t/D2 -- ~


Now consider someone adding a commit to t/D1. (shown as -- [X])
tg will tell you that you'll need to update your topic branch
It will merge the base commit and -- [X] to get a new base.


- t/D1 -- . ( -- [X]) - (new base)  ------- (topic branch has been updated)
           \          /                   /
             base -> hack -> hack -> hack 
- t/D2 -- ~

Your topic branch is merged with that new base and you're done.

If you export the patch  all those "hack" commits will be squashed.
So if you want different commits the default way is adding another
"topic branch"..

Some tg info output could look like this:
(C depends on B  depending on master)

D > C > B > master (D depends on C depending on B depeding on master)
      > master     (C also depends on master itself)

Subject: [PATCH] D <<<<  topic branch headline
Base: 8a2e721      <<<< current base
Depends: C         <<<< dependencies. C isn't up to date and requires
                        updates from its dependencies itself
Needs update from:
        master (<= B <= C) (2/2 commits, git log D..master )
        B (<= C) (1/1 commit, git log D..B )
        master (<= C) (2/2 commits, git log D..master )

To do all this merging shown above simply type tg update.
This could be used to prepare and review patches and keeping them up to
date. I still have to experiment with this all. But its probably worth looking
at.

Of course you can install top-git by    nix-nev -i -A gitAndTools.topGit
However the README isn't installed proberly yet. it contains a small
introduction.

That's why you maybe want to clone from
git://repo.or.cz/topgit.git (original author, has no time left)
get://git.pengutronix.de/git/ukl/topgit.git (current maintainer Klaus Uwe Koenig)

This could be a collaborative way to enhance patches before they are
comitted to trunk. This project could be worth beeing beeing watched.

Marc Weber



More information about the nix-dev mailing list