Add --private option to git_cl.py

TEST=tests/git_cl_test.py

Review URL: https://chromiumcodereview.appspot.com/15650014

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@202865 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/git_cl.py b/git_cl.py
index 7803217..198eb36 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -367,6 +367,9 @@
   def GetDefaultCCList(self):
     return self._GetConfig('rietveld.cc', error_ok=True)
 
+  def GetDefaultPrivateFlag(self):
+    return self._GetConfig('rietveld.private', error_ok=True)
+
   def GetIsGerrit(self):
     """Return true if this repo is assosiated with gerrit code review system."""
     if self.is_gerrit is None:
@@ -807,6 +810,8 @@
         RunGit(['config', 'rietveld.' + name, new_val])
 
   SetProperty(settings.GetDefaultCCList(), 'CC list', 'cc', False)
+  SetProperty(settings.GetDefaultPrivateFlag(),
+              'Private flag (rietveld only)', 'private', False)
   SetProperty(settings.GetTreeStatusUrl(error_ok=True), 'Tree status URL',
               'tree-status-url', False)
   SetProperty(settings.GetViewVCUrl(), 'ViewVC URL', 'viewvc-url', True)
@@ -944,6 +949,7 @@
   # Only server setting is required. Other settings can be absent.
   # In that case, we ignore errors raised during option deletion attempt.
   SetProperty('cc', 'CC_LIST', unset_error_ok=True)
+  SetProperty('private', 'PRIVATE', unset_error_ok=True)
   SetProperty('tree-status-url', 'STATUS', unset_error_ok=True)
   SetProperty('viewvc-url', 'VIEW_VC', unset_error_ok=True)
 
@@ -1268,6 +1274,9 @@
     if cc:
       upload_args.extend(['--cc', cc])
 
+  if options.private or settings.GetDefaultPrivateFlag() == "True":
+    upload_args.append('--private')
+
   upload_args.extend(['--git_similarity', str(options.similarity)])
   if not options.find_copies:
     upload_args.extend(['--git_no_find_copies'])
@@ -1350,6 +1359,8 @@
                     help="Emulate Subversion's auto properties feature.")
   parser.add_option('-c', '--use-commit-queue', action='store_true',
                     help='tell the commit queue to commit this patchset')
+  parser.add_option('--private', action='store_true',
+                    help='set the review private (rietveld only)')
   parser.add_option('--target_branch',
                     help='When uploading to gerrit, remote branch to '
                          'use for CL.  Default: master')