Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: docs/shift_based_development.md

Issue 1309473002: WIP: Migrate Wiki content over to src/docs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Introduction
2
3 Kai Wang (kaiwang@) and I (Jói Sigurðsson, joi@) experimented with something we called “shift-based development” in the first half of Q1 2013 as a way to work c losely together on a componentization that was hard to do in parallel.
4
5 I work from Iceland, which is 7 or 8 hours ahead of Kai’s location (Mountain Vie w, California), depending on the time of year (daylight savings time is not obse rved in Iceland). Kai and I were working on componentizing the Prefs subsystem o f Chromium, and it was obvious early on that if we tried to develop in parallel, we would step on each others’ toes very regularly and be forced to do often dif ficult merges (due to e.g. moving files, renaming things, and so on). The idea c ame up, since my normal work day ends right around the time Kai’s starts, why no t do the development in serial instead. Although I often work an extra hour or t wo later in the evening, that’s normally for responding to code review requests and email and not so much for coding, so this way we’d be completely free of get ting in each others’ way.
6
7 The way we implemented this was we set up a bare git repository, and at the end of the day, we would push whatever we were working on to this repository, and le t the other know the status of things. This could be a single working branch, or (more often) a pipeline of branches, plus a branch representing the SVN revisio n we were based off of. To make this work, we were both using the unmanaged git workflow.
8
9 The idea was, the next “shift” would pull down the pipeline of branches and cont inue where the last left off, doing development on the last change in the pipeli ne if it was incomplete, landing whatever changes could be landed, or starting a new change in the pipeline if all of them were ready for review or ready to lan d.
10
11 One limitation we ran into was that only the owner of an issue in Rietveld could upload a new patch set. To work around this limitation, I added a feature to Ri etveld where you can add a COLLABORATOR=xyz@chromium.org line to your change des cription, which will allow that person to also upload patches and edit the chang e description (see [Rietveld patch](https://code.google.com/p/rietveld/source/de tail?r=a37a6b2495b43e5fdd38292602d933714b7e8ddd)).
12
13 In my opinion this was moderately successful. We were probably less productive t han we would have been if each of us had been working on completely unrelated th ings, but certainly more productive than if we had tried to work together on com ponentizing Prefs in parallel.
14
15 With more practice, I think this way of working together could be quite successf ul. It was also challenging and fun and could be a worthwhile thing to try for f olks separated by close to a full working day or more. See details below if you' d like to try.
16
17 # Details
18
19 The following instructions assume Linux is being used, but should be easily adap table to other OSes. If you find mistakes in the instructions, please feel free to correct and clarify this Wiki page.
20
21 ## Setup
22
23 On one of our Linux boxes, we set up a bare git repository using [these instruct ions](http://git-scm.com/book/en/Git-on-the-Server-Setting-Up-the-Server). I'm s ure you could also use an existing git service such as github.
24
25 Let's assume the IP address of the Linux box hosting the bare
26 repository is `12.34.56.78`, the Linux user that provides access to the
27 bare repository is named `gitshift`, and the repository is located at
28 `/home/gitshift/git/gitshift.git`.
29
30 Each developer participating in the shift-based development provides
31 their RSA public key (e.g. `~/.ssh/id_rsa.pub`) and we add it to
32 `/home/gitshift/.ssh/authorized_keys`; that way as long as you are using
33 `ssh-agent` and have run `ssh-add`, you won't need to type in a password
34 every time you issue a git command that affects the repository.
35
36 Issue these commands to add a remote for this repository to your local
37 git repo, and to mirror its initial state. You can call it whatever
38 you like, shiftrepo is just an example.
39
40 ```
41 $ git remote add shiftrepo gitshift@12.34.56.78:/home/gitshift/git/gitshift.git
42 $ git fetch shiftrepo
43 ```
44
45 You should now be able to do a `git push` of some dummy branch; try
46 it out, e.g.
47
48 ```
49 $ git checkout -b shifttest master
50 $ echo boo > boo.txt
51 $ git add boo.txt && git commit -m .
52 $ git push shiftrepo
53 ```
54
55 The shared repository is just a place where you share your branches;
56 it is not a place where you do actual work. The actual work should be
57 done in your separate local repositories, and you still use e.g. git
58 pull (which in our git svn repositories behind the scenes does a `git svn fetch` etc.
59
60 Shift-based collaboration won't work well (at least not with a
61 pipeline of branches) unless you are using an "unmanaged" git checkout
62 (search for "unmanaged" on
63 [this page](https://code.google.com/p/chromium/wiki/UsingNewGit)).
64
65 ## Example Working Rules
66
67 For the branches we collaborated on, we set up some working
68 rules. This may be a good starting set and it worked well enough for us,
69 but others could adapt these rules:
70
71 a) We had a naming convention for pipelines of branches. E.g. you
72 might have branches named shiftrepo/p0-movemore and shiftrepo/p1-sync,
73 where p1-sync's upstream branch is p0-movemore, and p0-movemore's
74 upstream branch is an SVN revision, generally a version that was LKGR
75 at some point. You can find the git commit hash of this revision by
76 running
77
78 ```
79 git log -1 --grep=src@ | head -1 | cut -d " " -f2
80 ```
81
82 and the SVN revision number by running
83
84 ```
85 git log -1 --grep=src@ | grep git-svn-id | cut -d@ -f2 | cut -d " " -f1
86 ```
87
88 We followed a naming convention of one or two alphabetic characters
89 followed by the sequence number of the branch, followed by a dash and
90 a descriptive name for what's going on in that particular branch. The
91 one or two alphabetic characters indicated the rough over-arching
92 topic (e.g. p for Prefs), and the stuff after the dash can be more
93 descriptive.
94
95 b) When pushing a pipeline of branches to shiftrepo (where branch A
96 depends on branch B and so forth) we made sure to first git pull in
97 each dependent branch in sequence, so that each branch in shiftrepo is
98 building straight on top of the previous branch.
99
100 c) At the end of our shift, we did `git push shiftrepo branchname`
101 for each branch.
102
103 d) At the start of our shift, we did `git fetch shiftrepo` and then
104 for each branch we were collaborating on we did `git checkout branchname && git merge shiftrepo/branchname`. Note that the first command checks
105 out the local branch, and the second merges the shiftrepo/ branch into
106 it. This does not make the shiftrepo/ branch a parent of the local
107 branch.
108
109 e) Also at the start of each shift, we updated the local upstream
110 branches for each branch to match the upstream relationships that the
111 person ending their shift had on his end. One case is if the oldest
112 branch in the pipeline has been merged to a new LKGR, then we did this:
113
114 ```
115 git branch --set-upstream oldestBranchName `git log -1 --grep=src@ oldestBranchN ame | head -1 | cut -d " " -f2`
116 ```
117
118 and the other case is if new branches were created during the last shift, e.g. p 4-foo was added, then for each we need to do like this:
119
120 ```
121 git branch --set-upstream p4-foo p3-bar
122 ```
123
124 f) For managing old branches, we removed the oldest branch in a
125 pipeline when several conditions were met:
126
127 > i) The old branch has been checked in.
128
129 > ii) The SVN revision of the check-in of the old branch is equal to
130 > or older than LKGR, i.e. that change in SVN is included when you
131 > sync to LKGR.
132
133 > iii) That LKGR has been merged into the old branch, and we've done
134 > `git pull` in the next branch after it.
135
136 g) We only used the CQ to commit stuff. The fear was (and this hasn't
137 really been validated as true or false) that there might be some
138 gotchas if we used `git cl dcommit` instead.
139
140 h) At the end of our shift, we communicated by email/IM/Hangout to let
141 the other know the status of the work, next steps remaining for any
142 currently-open branches, and to discuss what might make sense for the
143 next branches to work on.
144
145 ## Random Commands
146
147 To push a local branch to shiftrepo: `git push shiftrepo localbranchname`
148
149 To push all "matching" branches (i.e. push the latest copy of
150 any local branch that has previously been pushed to shiftrepo): `git push shiftr epo`
151
152 To delete a branch from shiftrepo, it's weird: `git push shiftrepo :branchname`
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698