releaseBranch = None
server = "codereview.appspot.com"
server_url_base = None
+testing = None
#######################################################################
# Normally I would split this into multiple files, but it simplifies
codereview_init = False
+def uisetup(ui):
+ global testing
+ testing = ui.config("codereview", "testing")
+
def reposetup(ui, repo):
global codereview_disabled
global defaultcc
return
remote = ui.config("paths", "default", "")
- if remote.find("://") < 0:
+ if remote.find("://") < 0 and not testing:
raise hg_util.Abort("codereview: default path '%s' is not a URL" % (remote,))
InstallMatch(ui, repo)
return False
for msg in dict.get("messages", []):
text = msg.get("text", "")
- m = re.match('\*\*\* Submitted as [^*]*?r=([0-9a-f]+)[^ ]* \*\*\*', text)
+ regex = '\*\*\* Submitted as [^*]*?r=([0-9a-f]+)[^ ]* \*\*\*'
+ if testing:
+ regex = '\*\*\* Submitted as ([0-9a-f]+) \*\*\*'
+ m = re.match(regex, text)
if m is not None and len(m.group(1)) >= 8 and hex.startswith(m.group(1)):
return True
return False
tries += 1
args = dict(kwargs)
url = "https://%s%s" % (self.host, request_path)
+ if testing:
+ url = url.replace("https://", "http://")
if args:
url += "?" + urllib.urlencode(args)
req = self._CreateRequest(url=url, data=payload)
email = x
server_url_base = "https://" + server + "/"
+ if testing:
+ server_url_base = server_url_base.replace("https://", "http://")
- testing = ui.config("codereview", "testing")
force_google_account = ui.configbool("codereview", "force_google_account", False)
upload_options = opt()
# This is a dummy value to allow us to identify when we're successful.
continue_location = "http://localhost/"
args = {"continue": continue_location, "auth": auth_token}
- req = self._CreateRequest("https://%s/_ah/login?%s" % (self.host, urllib.urlencode(args)))
+ reqUrl = "https://%s/_ah/login?%s" % (self.host, urllib.urlencode(args))
+ if testing:
+ reqUrl = reqUrl.replace("https://", "http://")
+ req = self._CreateRequest(reqUrl)
try:
response = self.opener.open(req)
except urllib2.HTTPError, e:
tries += 1
args = dict(kwargs)
url = "https://%s%s" % (self.host, request_path)
+ if testing:
+ url = url.replace("https://", "http://")
if args:
url += "?" + urllib.urlencode(args)
req = self._CreateRequest(url=url, data=payload)
# Assumes a local Rietveld is running using the App Engine SDK
# at http://localhost:7777/
#
-# dev_appserver.py -p 7777 $HOME/pub/rietveld
+# dev_appserver.py --port 7777 $HOME/pub/rietveld
codereview_script=$(pwd)/codereview.py
server=localhost:7777
[extensions]
codereview=$codereview_script
[codereview]
+testing=true
server=$server
" >>$clone1/.hg/hgrc
cp $clone1/.hg/hgrc $clone2/.hg/hgrc
must hg add lib/codereview/codereview.cfg CONTRIBUTORS
status First submit.
-must hg submit -r gre@golang.org -m codereview \
+must hg submit --tbr gre@golang.org -m codereview \
lib/codereview/codereview.cfg CONTRIBUTORS
status Should see change in other client.
# Clpatch will check.
cd $clone1
- # Tried to use UTF-8 here to test that, but dev_appserver.py crashes. Ha ha.
- if false; then
+ # dev_appserver.py used to crash with UTF-8 input.
+ if true; then
status Using UTF-8.
name="Grácè T Emlïn <test@example.com>"
else
fi
echo "$name" >>CONTRIBUTORS
cat .hg/hgrc | sed "s/Grace.*/$name/" >/tmp/x && mv /tmp/x .hg/hgrc
- echo '
+ echo "
Reviewer: gre@golang.org
Description:
CONTRIBUTORS: add $name
Files:
CONTRIBUTORS
-' | must hg change -i
+" | must hg change -i
num=$(hg pending | sed 1q | tr -d :)
status Patch CL.
cd $clone2
must hg clpatch $num
must [ "$num" = "$(firstcl)" ]
- must hg submit $num
+ must hg submit --tbr gre@golang.org $num
status Issue should be open with no reviewers.
must curl http://$server/api/$num >/tmp/x
Description: file1
Files: file1
' | must hg change -i
- must hg submit $(firstcl)
+ must hg submit --tbr gre@golang.org $(firstcl)
cd $clone2
echo file2 >file2
Description: file2
Files: file2
' | must hg change -i
- must not hg submit $(firstcl)
+ must not hg submit --tbr gre@golang.org $(firstcl)
must hg sync
- must hg submit $(firstcl)
+ must hg submit --tbr gre@golang.org $(firstcl)
}
test_restrict() {