-import git_utils
-import misc_utils
-
-
-DEFAULT_REVIEWERS = ','.join([
- 'rmistry@google.com',
- 'reed@google.com',
- 'bsalomon@google.com',
- 'robertphillips@google.com',
- ])
-
-
-DEFAULT_CC_LIST = ','.join([
- 'skia-team@google.com',
- ])
-
-
-def add_codereview_message(codereview_url, message, checkout_path,
- skip_cl_upload, verbose, reviewers, cclist):
- """Add a message to a given codereview.
-
- Args:
- codereview_url: (string) we will extract the issue number from
- this url, or this could simply be the issue number.
- message: (string) will be passed to `git cl upload -m $MESSAGE`
- checkout_path: (string) location of the git
- repository checkout to be used.
- skip_cl_upload: (boolean) if true, don't actually
- add the message and keep the temporary branch around.
- verbose: (boolean) print out details useful for debugging.
- reviewers: (string) comma-separated list of reviewers
- cclist: (string) comma-separated list of addresses to be
- carbon-copied
- """
- # pylint: disable=I0011,R0913
- git = git_utils.git_executable()
- issue = codereview_url.strip('/').split('/')[-1]
- vsp = misc_utils.VerboseSubprocess(verbose)
- if skip_cl_upload:
- branch_name = 'issue_%s' % issue
- else:
- branch_name = None
- upstream = 'origin/master'
-
- with misc_utils.ChangeDir(checkout_path, verbose):
- vsp.check_call([git, 'fetch', '-q', 'origin'])
-
- with git_utils.ChangeGitBranch(branch_name, upstream, verbose):
- vsp.check_call([git, 'cl', 'patch', issue])
-
- git_upload = [
- git, 'cl', 'upload', '-t', 'bot report', '-m', message]
- if cclist:
- git_upload.append('--cc=' + cclist)
- if reviewers:
- git_upload.append('--reviewers=' + reviewers)
-
- if skip_cl_upload:
- branch_name = git_utils.git_branch_name(verbose)
- space = ' '
- print 'You should call:'
- misc_utils.print_subprocess_args(space, ['cd', os.getcwd()])
- misc_utils.print_subprocess_args(
- space, [git, 'checkout', branch_name])
- misc_utils.print_subprocess_args(space, git_upload)
- else:
- vsp.check_call(git_upload)
- print vsp.check_output([git, 'cl', 'issue'])
+import fix_pythonpath # pylint: disable=W0611
+from common.py.utils import find_depot_tools # pylint: disable=W0611
+import rietveld
+
+
+RIETVELD_URL = 'https://codereview.chromium.org'
+
+
+def add_codereview_message(issue, message):
+ """Add a message to a given codereview.
+
+ Args:
+ codereview_url: (string) we will extract the issue number from
+ this url, or this could simply be the issue number.
+ message: (string) message to add.
+ """
+ # Passing None for the email and password will result in a prompt or
+ # reuse of existing cached credentials.
+ my_rietveld = rietveld.Rietveld(RIETVELD_URL, email=None, password=None)
+
+ my_rietveld.add_comment(issue, message)