From 84ac357c791d94012735af54cbb7e38b31191ac9 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 13 Jan 2010 09:09:06 -0800 Subject: [PATCH] codereview: split name list only on commas; some user names have spaces R=r CC=golang-dev https://golang.org/cl/184069 --- lib/codereview/codereview.cfg | 1 + lib/codereview/codereview.py | 31 ++++++++++++++++--------------- 2 files changed, 17 insertions(+), 15 deletions(-) create mode 100644 lib/codereview/codereview.cfg diff --git a/lib/codereview/codereview.cfg b/lib/codereview/codereview.cfg new file mode 100644 index 00000000000..93b55c0a3f6 --- /dev/null +++ b/lib/codereview/codereview.cfg @@ -0,0 +1 @@ +defaultcc: golang-dev@googlegroups.com diff --git a/lib/codereview/codereview.py b/lib/codereview/codereview.py index 440758759b2..b71b67ddc26 100644 --- a/lib/codereview/codereview.py +++ b/lib/codereview/codereview.py @@ -89,10 +89,9 @@ if __name__ == "__main__": print >>sys.stderr, "This is a Mercurial extension and should not be invoked directly." sys.exit(2) - server = "codereview.appspot.com" server_url_base = None -defaultcc = [ "golang-dev@googlegroups.com" ] +defaultcc = None ####################################################################### # Change list parsing. @@ -340,7 +339,10 @@ def ParseCL(text, name): return cl, 0, '' def SplitCommaSpace(s): - return s.replace(",", " ").split() + s = s.strip() + if s == "": + return [] + return re.split(", *", s) def CutDomain(s): i = s.find('@') @@ -1430,11 +1432,6 @@ def DownloadCL(ui, repo, clname): return None, None, "error looking up %s: got info for %s, %s" % (nick, match.group(1), match.group(2)) email = match.group(1) - # Temporary hack until we move to the public code review server. - email1, _ = FindContributor(ui, repo, email, warn=False) - if email1 == "": - email = re.sub("@google.com$", "@golang.org", email) - # Print warning if email is not in CONTRIBUTORS file. FindContributor(ui, repo, email) cl.copied_from = email @@ -1593,7 +1590,16 @@ class opt(object): pass def RietveldSetup(ui, repo): - global upload_options, rpc, server, server_url_base, force_google_account, verbosity + global defaultcc, upload_options, rpc, server, server_url_base, force_google_account, verbosity + + # Read repository-specific options from lib/codereview/codereview.cfg + try: + f = open(repo.root + '/lib/codereview/codereview.cfg') + for line in f: + if line.startswith('defaultcc: '): + defaultcc = SplitCommaSpace(line[10:]) + except: + pass # TODO(rsc): If the repository config has no codereview section, # do not enable the extension. This allows users to @@ -1617,11 +1623,6 @@ def RietveldSetup(ui, repo): if x is not None: email = x - cc = None - x = ui.config("codereview", "cc") - if x is not None: - cc = x - server_url_base = "http://" + server + "/" testing = ui.config("codereview", "testing") @@ -1634,7 +1635,7 @@ def RietveldSetup(ui, repo): upload_options.description = None upload_options.description_file = None upload_options.reviewers = None - upload_options.cc = cc + upload_options.cc = None upload_options.message = None upload_options.issue = None upload_options.download_base = False