Commit 69c2e2b9 authored by Russ Cox's avatar Russ Cox

codereview: enable work and code reviews in development branches

This is an experiment. See mail on golang-dev
(subject: "an experiment: development branches").

LGTM=minux
R=minux
CC=golang-codereviews
https://golang.org/cl/117660043
parent e5e547c7
...@@ -323,6 +323,11 @@ class CL(object): ...@@ -323,6 +323,11 @@ class CL(object):
CheckFormat(ui, repo, self.files, just_warn=gofmt_just_warn) CheckFormat(ui, repo, self.files, just_warn=gofmt_just_warn)
set_status("uploading CL metadata + diffs") set_status("uploading CL metadata + diffs")
os.chdir(repo.root) os.chdir(repo.root)
branchPrefix = ""
branch = repo[None].branch()
if branch.startswith("dev."):
branchPrefix = "[" + branch + "] "
form_fields = [ form_fields = [
("content_upload", "1"), ("content_upload", "1"),
("reviewers", JoinComma(self.reviewer)), ("reviewers", JoinComma(self.reviewer)),
...@@ -358,7 +363,7 @@ class CL(object): ...@@ -358,7 +363,7 @@ class CL(object):
form_fields.append(("subject", "diff -r " + vcs.base_rev + " " + ui.expandpath("default"))) form_fields.append(("subject", "diff -r " + vcs.base_rev + " " + ui.expandpath("default")))
else: else:
# First upload sets the subject for the CL itself. # First upload sets the subject for the CL itself.
form_fields.append(("subject", self.Subject())) form_fields.append(("subject", branchPrefix+self.Subject()))
ctype, body = EncodeMultipartFormData(form_fields, uploaded_diff_file) ctype, body = EncodeMultipartFormData(form_fields, uploaded_diff_file)
response_body = MySend("/upload", body, content_type=ctype) response_body = MySend("/upload", body, content_type=ctype)
patchset = None patchset = None
...@@ -403,7 +408,11 @@ class CL(object): ...@@ -403,7 +408,11 @@ class CL(object):
pmsg += "\n" pmsg += "\n"
repourl = ui.expandpath("default") repourl = ui.expandpath("default")
if not self.mailed: if not self.mailed:
pmsg += "I'd like you to review this change to\n" + repourl + "\n" pmsg += "I'd like you to review this change to"
branch = repo[None].branch()
if branch.startswith("dev."):
pmsg += " the " + branch + " branch of"
pmsg += "\n" + repourl + "\n"
else: else:
pmsg += "Please take another look.\n" pmsg += "Please take another look.\n"
typecheck(pmsg, str) typecheck(pmsg, str)
...@@ -1333,7 +1342,7 @@ def change(ui, repo, *pats, **opts): ...@@ -1333,7 +1342,7 @@ def change(ui, repo, *pats, **opts):
else: else:
name = "new" name = "new"
cl = CL("new") cl = CL("new")
if repo[None].branch() != "default": if not workbranch(repo[None].branch()):
raise hg_util.Abort("cannot create CL outside default branch; switch with 'hg update default'") raise hg_util.Abort("cannot create CL outside default branch; switch with 'hg update default'")
dirty[cl] = True dirty[cl] = True
files = ChangedFiles(ui, repo, pats, taken=Taken(ui, repo)) files = ChangedFiles(ui, repo, pats, taken=Taken(ui, repo))
...@@ -1434,7 +1443,7 @@ def clpatch(ui, repo, clname, **opts): ...@@ -1434,7 +1443,7 @@ def clpatch(ui, repo, clname, **opts):
Submitting an imported patch will keep the original author's Submitting an imported patch will keep the original author's
name as the Author: line but add your own name to a Committer: line. name as the Author: line but add your own name to a Committer: line.
""" """
if repo[None].branch() != "default": if not workbranch(repo[None].branch()):
raise hg_util.Abort("cannot run hg clpatch outside default branch") raise hg_util.Abort("cannot run hg clpatch outside default branch")
err = clpatch_or_undo(ui, repo, clname, opts, mode="clpatch") err = clpatch_or_undo(ui, repo, clname, opts, mode="clpatch")
if err: if err:
...@@ -1448,7 +1457,7 @@ def undo(ui, repo, clname, **opts): ...@@ -1448,7 +1457,7 @@ def undo(ui, repo, clname, **opts):
After creating the CL, opens the CL text for editing so that After creating the CL, opens the CL text for editing so that
you can add the reason for the undo to the description. you can add the reason for the undo to the description.
""" """
if repo[None].branch() != "default": if not workbranch(repo[None].branch()):
raise hg_util.Abort("cannot run hg undo outside default branch") raise hg_util.Abort("cannot run hg undo outside default branch")
err = clpatch_or_undo(ui, repo, clname, opts, mode="undo") err = clpatch_or_undo(ui, repo, clname, opts, mode="undo")
if err: if err:
...@@ -2700,6 +2709,9 @@ def RietveldSetup(ui, repo): ...@@ -2700,6 +2709,9 @@ def RietveldSetup(ui, repo):
if t.startswith('release-branch.go'): if t.startswith('release-branch.go'):
releaseBranch = t releaseBranch = t
def workbranch(name):
return name == "default" or name.startswith('dev.')
####################################################################### #######################################################################
# http://codereview.appspot.com/static/upload.py, heavily edited. # http://codereview.appspot.com/static/upload.py, heavily edited.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment