Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: git_cl.py

Issue 6805007: Don't store rietveld.extracc in git config. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: fix errors Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl.py
diff --git a/git_cl.py b/git_cl.py
index f9a008c889b1eb7f0d6ae9afedd51d034e5d5f0a..f5ecd7fda143ebda919ad3533554db973a556959 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -195,17 +195,6 @@ class Settings(object):
'rietveld.server', error_message=error_message))
return self.default_server
- def GetCCList(self):
- """Return the users cc'd on this CL.
-
- Return is a string suitable for passing to gcl with the --cc flag.
- """
- if self.cc is None:
- base_cc = self._GetConfig('rietveld.cc', error_ok=True)
- more_cc = self._GetConfig('rietveld.extracc', error_ok=True)
- self.cc = ','.join(filter(None, (base_cc, more_cc))) or ''
- return self.cc
-
def GetRoot(self):
if not self.root:
self.root = os.path.abspath(RunGit(['rev-parse', '--show-cdup']).strip())
@@ -295,6 +284,9 @@ class Settings(object):
self.viewvc_url = self._GetConfig('rietveld.viewvc-url', error_ok=True)
return self.viewvc_url
+ def GetDefaultCCList(self):
+ return self._GetConfig('rietveld.cc', error_ok=True)
+
def _GetConfig(self, param, **kwargs):
self.LazyUpdateIfNeeded()
return RunGit(['config', param], **kwargs).strip()
@@ -354,6 +346,25 @@ class Changelist(object):
self.has_patchset = False
self.patchset = None
self._rpc_server = None
+ self.cc = None
+ self.watchers = ()
+
+ def GetCCList(self):
+ """Return the users cc'd on this CL.
+
+ Return is a string suitable for passing to gcl with the --cc flag.
+ """
+ if self.cc is None:
+ base_cc = settings .GetDefaultCCList()
+ more_cc = ','.join(self.watchers)
+ self.cc = ','.join(filter(None, (base_cc, more_cc))) or ''
+ return self.cc
+
+ def SetWatchers(self, watchers):
+ """Set the list of email addresses that should be cc'd based on the changed
+ files in this CL.
+ """
+ self.watchers = watchers
def GetBranch(self):
"""Returns the short branch name, e.g. 'master'."""
@@ -556,7 +567,7 @@ def GetCodereviewSettingsInteractively():
elif new_val and new_val != initial:
RunGit(['config', 'rietveld.' + name, new_val])
- SetProperty(settings.GetCCList(), 'CC list', 'cc')
+ SetProperty(settings.GetDefaultCCList(), 'CC list', 'cc')
SetProperty(settings.GetTreeStatusUrl(error_ok=True), 'Tree status URL',
'tree-status-url')
SetProperty(settings.GetViewVCUrl(), 'ViewVC URL', 'viewvc-url')
@@ -830,9 +841,7 @@ def RunHook(committing, upstream_branch, rietveld_server, tbr, may_prompt):
if not committing:
watchlist = watchlists.Watchlists(change.RepositoryRoot())
files = [f.LocalPath() for f in change.AffectedFiles()]
- watchers = watchlist.GetWatchersForPaths(files)
- RunCommand(['git', 'config', '--replace-all',
- 'rietveld.extracc', ','.join(watchers)])
+ cl.SetWatchers(watchlist.GetWatchersForPaths(files))
output = presubmit_support.DoPresubmitChecks(change, committing,
verbose=False, output_stream=sys.stdout, input_stream=sys.stdin,
@@ -961,7 +970,7 @@ def CMDupload(parser, args):
upload_args.extend(['--description', change_desc.description])
if change_desc.reviewers:
upload_args.extend(['--reviewers', change_desc.reviewers])
- cc = ','.join(filter(None, (settings.GetCCList(), options.cc)))
+ cc = ','.join(filter(None, (cl.GetCCList(), options.cc)))
if cc:
upload_args.extend(['--cc', cc])
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698