2 # Copyright 2011 The Go Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style
4 # license that can be found in the LICENSE file.
6 # Test the code review plugin.
7 # Assumes a local Rietveld is running using the App Engine SDK
8 # at http://localhost:7777/
10 # dev_appserver.py --port 7777 $HOME/pub/rietveld
12 codereview_script=$(pwd)/codereview.py
39 hg pending | sed 1q | tr -d ':'
43 status Create repositories.
44 rm -rf $master $clone1 $clone2
48 echo Initial state >file
50 must hg ci -m 'first commit' file
51 must hg clone $master $clone1
52 must hg clone $master $clone2
56 username=Grace R Emlin <gre@golang.org>
58 codereview=$codereview_script
63 cp $clone1/.hg/hgrc $clone2/.hg/hgrc
65 status Codereview should be disabled.
70 status Enabling code review.
71 must mkdir lib lib/codereview
72 must touch lib/codereview/codereview.cfg
74 status Code review should work even without CONTRIBUTORS.
77 status Add CONTRIBUTORS.
78 echo 'Grace R Emlin <gre@golang.org>' >CONTRIBUTORS
79 must hg add lib/codereview/codereview.cfg CONTRIBUTORS
82 must hg submit --tbr gre@golang.org -m codereview \
83 lib/codereview/codereview.cfg CONTRIBUTORS
85 status Should see change in other client.
88 must test -f lib/codereview/codereview.cfg
89 must test -f CONTRIBUTORS
92 # The email address must be test@example.com to match
93 # the test code review server's default user.
97 # dev_appserver.py used to crash with UTF-8 input.
100 name="Grácè T Emlïn <test@example.com>"
103 name="Grace T Emlin <test@example.com>"
105 echo "$name" >>CONTRIBUTORS
106 cat .hg/hgrc | sed "s/Grace.*/$name/" >/tmp/x && mv /tmp/x .hg/hgrc
108 Reviewer: gre@golang.org
110 CONTRIBUTORS: add $name
113 " | must hg change -i
114 num=$(hg pending | sed 1q | tr -d :)
119 must [ "$num" = "$(firstcl)" ]
120 must hg submit --tbr gre@golang.org $num
122 status Issue should be open with no reviewers.
123 must curl http://$server/api/$num >/tmp/x
124 must not grep '"closed":true' /tmp/x
125 must grep '"reviewers":\[\]' /tmp/x
127 status Sync should close issue.
130 must curl http://$server/api/$num >/tmp/x
131 must grep '"closed":true' /tmp/x
132 must grep '"reviewers":\[\]' /tmp/x
133 must [ "$(firstcl)" = "" ]
137 status Submit without reviewer should fail.
146 ' | must hg change -i
148 must not hg submit $num
151 must hg change -d $num
155 status Linearity of changes.
160 Reviewer: gre@golang.org
163 ' | must hg change -i
164 must hg submit --tbr gre@golang.org $(firstcl)
170 Reviewer: gre@golang.org
173 ' | must hg change -i
174 must not hg submit --tbr gre@golang.org $(firstcl)
176 must hg submit --tbr gre@golang.org $(firstcl)
180 status Cannot use hg ci.
184 must not hg ci -m commit file1a
186 must hg revert file1a
188 status Cannot use hg rollback.
191 status Cannot use hg backout
192 must not hg backout -r -1
199 status ALL TESTS PASSED.