]> git.proxmox.com Git - mirror_zfs-debian.git/blob - GIT
Add CDDL license file
[mirror_zfs-debian.git] / GIT
1 =========================== WHY USE GIT+TOPGIT? ==========================
2
3 Three major concerns were on our mind when setting up this project.
4
5 o First we needed to structure the project in such a way that it would be
6 easy to rebase all of our changes on the latest official ZFS release
7 from Sun. We absolutely need to be able to benefit from the upstream
8 improvements and not get locked in to an old version of the code base.
9
10 o Secondly, we wanted to be able to easily manage our changes in terms
11 of a patch stack or graph. This allows us to easily isolate specific
12 changes and push them upstream for inclusion. It also allows us to
13 easily update or drop specific changes based on what occurs upstream.
14
15 o Thirdly we needed our DVCS to be integrated with the management of this
16 patch stack or graph. We have tried other methods in the past such as
17 SVN+Quilt but have found managing the patch stack becomes cumbersome.
18 By using Git+TopGit to more tightly integrate our patches in to the repo
19 we expect several benefits. One of the most important will be the
20 ability to easily work on the patch's with a distributed development
21 team, additionally the repo can track patch history, and we can utilize
22 Git to merge patches and resolve conflicts.
23
24 TopGit is designed to specifically address these concerns by providing
25 tools to simplify the handling of large numbers of interdependent topic
26 branches. When using a TopGit aware repo every topic branch represents
27 a 'patch' and that branch references its dependent branches. The union
28 of all these branches is your final source base.
29
30 ========================= SETTING UP GIT+TOPGIT ==========================
31
32 First off you need to install a Git package on your system. For my
33 purposes I have been working on a RHEL5 system with git version 1.5.4.5
34 installed and it has been working well. You will also need to go get
35 the latest version of TopGit which likely is not packaged nicely so you
36 will need to build it from source. You can use Git to clone TopGit
37 from the official site here and your all set:
38
39 > git clone git://repo.or.cz/w/topgit.git
40 > make
41 > make install # Default installs to $(HOME)
42
43 ========================== TOPGIT AND ZFS ================================
44
45 One you have Git and TopGit installed you will want to clone a copy of
46 the Linux ZFS repo. While this project does not yet have a public home
47 it hopefully will some day. In the meanwhile if you have VPN access to
48 LLNL you can clone the latest official repo here. Cloning a TopGit
49 controlled repo is very similar to cloning a normal Git repo, but you
50 need to remember to use 'tg remote' to populate all topic branches.
51
52 > git clone http://eris.llnl.gov/git/zfs.git zfs
53 > cd zfs
54 > tg remote --populate origin
55
56 Now that you have the Linux ZFS repo the first thing you will probably
57 want to do is have a look at all the topic branches. TopGit provides
58 a summary command which shows all the branches and a brief summary for
59 each branch obtained from the .topmsg files.
60
61 > tg summary
62 0 feature-branch [PATCH] feature-branch
63 feature-commit-cb [PATCH] feature commit cb
64 feature-zap-cursor-to-key [PATCH] feature zap cursor to key
65 ...
66
67 By convention all TopGit branches are usually prefixed with 't/', however
68 I have chosen not to do this for simplicity. A different convention I have
69 adopted is to tag the top most TopGit branch as 'top' for easy reference.
70 This provides a consistent label to be used when you need to reference the
71 branch which contains the union of all topic branches.
72
73 One thing you may also notice about the 'tg summary' command is it does
74 not show the branches in dependent order. This is done because TopGit allows
75 each branch to express multiple dependencies as a DAC. Initially this seemed
76 like an added complication which I planned to avoid by just implementing a
77 stack using the graph. However, this ended up being problematic because
78 with a stack when a change was made to a branch near the base, it was a
79 very expensive operation to merge the change up to the top of the stack.
80 By defining the dependencies as a graph it is possible to keep the depth
81 much shallower thus minimizing the merging. It has also proved insightful
82 as to each patches actual dependencies.
83
84 To see the dependencies you will need to use the --graphviz option and pipe
85 the result to dot for display. The following command works fairly well for
86 me. Longer term it would be nice to update this option to use a preferred
87 config options stored in the repo.
88
89 > tg summary --graphviz | dot -Txlib -Nfontsize=8
90
91 ========================= UPDATING A TOPIC BRANCH ========================
92
93 Updating a topic branch in TopGit is a pretty straight forward but there
94 are a few rules you need to be aware of. The basic process involves
95 checking out the relevant topic branch where the changes need to be made,
96 making the changes, committing the changes to the branch and then merging
97 those changes in to dependent branches. TopGit provides some tools to make
98 this pretty easy, although it may be a little sluggish depending on how many
99 dependent branches are impacted by the change. Here is an example:
100
101 > git checkout modify-topic-branch # Checkout the proper branch
102 > ...update branch... # Update the branch
103 > git commit -a # Commit your changes
104 > git checkout top # Checkout the top branch
105 > tg update # Recursively merge in new branch
106
107 Assuming you change does not introduce any conflicts your done. All branches
108 were dependent on your change will have had the changed merged in. If your
109 change introduced a conflict you will need to resolve the conflict and then
110 continue on with the update.
111
112 ========================== ADDING A TOPIC BRANCH =========================
113
114 Adding a topic branch in TopGit can be pretty straight forward. If your
115 adding a non-conflicting patch in parallel with other patches of the same
116 type, then things are pretty easy and TopGit does all the work.
117
118 > git co existing-topic-branch # Checkout the branch to add after
119 > tg create new-topic-branch # Create a new topic branch
120 > ...update .topmsg... # Update the branch message
121 > ...create patch... # Update with your changes
122 > git commit -a # Commit your changes
123 > git co dependent-topic-branch # Checkout dependent branch
124 > tg depend add new-topic-branch # Update dependencies
125 > git checkout top # Checkout the top branch
126 > tg update # Recursively merge in new branch
127
128 If you need to add your patch in series with another change things are
129 a little more complicated. In this case TopGit does not yet support removing
130 dependencies so you will need to do it by hand, as follows.
131
132 > git co existing-topic-branch # Checkout the branch to add after
133 > tg create new-topic-branch # Create a new topic branch
134 > ...update .topmsg... # Update the branch message
135 > ...create patch... # Update with your changes
136 > git commit -a # Commit your changes
137 > git co dependent-topic-branch # Checkout dependent branch
138 > ...update .topdeps... # Manually update dependencies
139 > git commit -a # Commit your changes
140 > tg update # TopGit update
141 > git checkout top # Checkout the top branch
142 > tg update # Recursively merge in new branch
143
144 Once your done, I find it is a good idea view the repo using the
145 'tg summary --graphviz' command and verify the updated dependency graph.
146
147 ========================= REMOVING A TOPIC BRANCH ========================
148
149 Removing a topic branch in TopGit is also currently not very easy. To remove
150 a dependent branch the basic process is to commit a patch which reverts all
151 changes on the branch. Then that reversion must be merged in to all dependent
152 branches, the dependencies manually updated and finally the branch removed.
153 If the branch is not empty you will not be able to remove it.
154
155 > git co delete-topic-branch # Checkout the branch to delete
156 > tg patch | patch -R -p1 # Revert all branch changes
157 > git commit -a # Commit your changes
158 > git checkout top # Checkout the top branch
159 > tg update # Recursively merge revert
160 > git co dependent-topic-branch # Checkout dependent branch
161 > ...update .topdeps... # Manually update dependencies
162 > git commit -a # Commit your changes
163 > tg delete delete-topic-branch # Delete empty topic branch
164
165 Once your done, I find it is a good idea view the repo using the
166 'tg summary --graphviz' command and verify the updated dependency graph.
167
168 ============================ TOPGIT TODO =================================
169
170 TopGit is still a young package which seems to be under active development
171 by its author. It provides the minimum set of commands needed but there
172 are clearly areas which simply have not yet been implemented. My short
173 list of features includes:
174
175 o 'tg summary --deps', option to display a text version of the topic
176 branch dependency DAC.
177
178 o 'tg depend list', list all topic branch dependencies.
179
180 o 'tg depend delete', cleanly remove a topic branch dependency.
181
182 o 'tg create', cleanly insert a topic branch in the middle
183 of the graph and properly take care updating all dependencies.
184
185 o 'tg delete', cleanly delete a topic branch in the middle
186 of the graph and properly take care updating all dependencies.