Merge remote-tracking branch 'upstream/master'
diff --git a/README.ninja b/README.ninja
new file mode 100644
index 0000000..1a8e92d
--- /dev/null
+++ b/README.ninja
@@ -0,0 +1,26 @@
+Ninja for Windows and Linux are custom built binaries that contain Steel
+specific modifications.
+
+ninja.exe built with MSVC 2012
+from
+https://github.com/rjogrady/ninja/commit/2feb1180afe21bbc6453dd7a95fe53c2e25fbb55
+
+ninja_linux64 built with gcc
+from
+https://github.com/rjogrady/ninja/commit/613d89893e56acc8c3670a66a33fcd2caf7d9050
+
+For Windows, we provide a simple_echo.exe for ninja to use when building with SN-DBS.
+Code is as follows:
+
+#include <stdio.h>
+int main(int argc, char** argv) {
+  int i;
+  for (i = 1; i < argc; ++i) {
+    if (i != 1) {
+      putc(' ', stdout);
+    }
+    fputs(argv[i], stdout);
+  }
+  putc('\n', stdout);
+}
+
diff --git a/WATCHLISTS b/WATCHLISTS
old mode 100755
new mode 100644
index 47ee79e..247ed98
--- a/WATCHLISTS
+++ b/WATCHLISTS
@@ -18,10 +18,7 @@
 
   'WATCHLISTS': {
     'this_file': [],
-    'depot_tools': [
-      'dpranke+depot_tools@chromium.org',
-      'iannucci+depot_tools@chromium.org',
-    ],
+    'depot_tools': [],
   },
 
 }
diff --git a/bootstrap/win/win_tools.bat b/bootstrap/win/win_tools.bat
index 278376f..a804bdb 100644
--- a/bootstrap/win/win_tools.bat
+++ b/bootstrap/win/win_tools.bat
@@ -115,8 +115,8 @@
 call copy /y "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\ssh-keygen.bat" "%WIN_TOOLS_ROOT_DIR%\ssh-keygen.bat" 1>nul

 

 :: Ensure autocrlf and filemode are set correctly.

-call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.autocrlf false

-call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.filemode false

+call "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\cmd\git.cmd" config --system core.autocrlf false

+call "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%\cmd\git.cmd" config --system core.filemode false

 goto :SVN_CHECK

 

 

diff --git a/breakpad.py b/breakpad.py
index 2248e35..46a5ecd 100644
--- a/breakpad.py
+++ b/breakpad.py
@@ -40,6 +40,12 @@
     _HOST_NAME.endswith(('.google.com', '.chromium.org')))
 
 
+# TODO(uzhilinsky): Disable breakpad to avoid spamming the Chromium team.
+# Eventually this should be re-enabled and the exceptions should be forwarded
+# to our own server.
+IS_ENABLED = False
+
+
 def post(url, params):
   """HTTP POST with timeout when it's supported."""
   if not IS_ENABLED:
diff --git a/codereview.settings b/codereview.settings
index ae258f8..a4b341a 100644
--- a/codereview.settings
+++ b/codereview.settings
@@ -1,7 +1,4 @@
 # This file is used by gcl to get repository specific information.
-CODE_REVIEW_SERVER: codereview.chromium.org
-CC_LIST: chromium-reviews@chromium.org
-VIEW_VC: http://src.chromium.org/viewvc/chrome?view=rev&revision=
-GITCL_PREUPLOAD: http://src.chromium.org/viewvc/chrome/trunk/tools/depot_tools/git-cl-upload-hook?revision=HEAD
-GITCL_PREDCOMMIT: http://src.chromium.org/viewvc/chrome/trunk/tools/depot_tools/git-cl-upload-hook?revision=HEAD
-PROJECT: depot_tools
+GERRIT_HOST: lbshell-internal-review.googlesource.com
+GERRIT_AUTODETECT_BRANCH: true
+CODE_REVIEW_SERVER: lbshell-internal-review.googlesource.com
diff --git a/git-lg b/git-lg
new file mode 100755
index 0000000..10c6e66
--- /dev/null
+++ b/git-lg
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# Copyright 2014 Google Inc. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This will print a pretty git commit history graph.
+
+git log --graph --all \
+    --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(bold white) - %an%C(reset)%C(bold yellow)%d%C(reset)'  \
+    --abbrev-commit --date=relative $*
diff --git a/git_cl.py b/git_cl.py
index 68d4339..8b474a1 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -411,6 +411,7 @@
     self.viewvc_url = None
     self.updated = False
     self.is_gerrit = None
+    self.is_gerrit_autodetect_branch = None
     self.git_editor = None
     self.project = None
     self.force_https_commit_url = None
@@ -576,6 +577,13 @@
       self.is_gerrit = self._GetConfig('gerrit.host', error_ok=True)
     return self.is_gerrit
 
+  def GetIsGerritAutoDetectBranch(self):
+    """Return true if the remote branch should be auto-detected."""
+    if self.is_gerrit_autodetect_branch is None:
+      self.is_gerrit_autodetect_branch = self._GetConfig(
+          'gerrit.autodetect-branch', error_ok=True)
+    return self.is_gerrit_autodetect_branch
+
   def GetGitEditor(self):
     """Return the editor specified in the git config, or None if none is."""
     if self.git_editor is None:
@@ -1364,6 +1372,10 @@
   if 'GERRIT_HOST' in keyvals:
     RunGit(['config', 'gerrit.host', keyvals['GERRIT_HOST']])
 
+  if 'GERRIT_AUTODETECT_BRANCH' in keyvals:
+    RunGit(['config', 'gerrit.autodetect-branch',
+            keyvals['GERRIT_AUTODETECT_BRANCH']])
+
   if 'PUSH_URL_CONFIG' in keyvals and 'ORIGIN_URL_CONFIG' in keyvals:
     #should be of the form
     #PUSH_URL_CONFIG: url.ssh://gitrw.chromium.org.pushinsteadof
@@ -1451,6 +1463,7 @@
   return 0
 
 
+@subcommand.hidden
 def CMDbaseurl(parser, args):
   """Gets or sets base-url for this branch."""
   branchref = RunGit(['symbolic-ref', 'HEAD']).strip()
@@ -1624,6 +1637,7 @@
   return 0
 
 
+@subcommand.hidden
 def CMDstatus(parser, args):
   """Show status of changelists.
 
@@ -1732,6 +1746,7 @@
   CMDstatus.__doc__ = '\n'.join(colorize_line(l) for l in lines)
 
 
+@subcommand.hidden
 @subcommand.usage('[issue_number]')
 def CMDissue(parser, args):
   """Sets or displays the current code review issue number.
@@ -1773,6 +1788,7 @@
   return 0
 
 
+@subcommand.hidden
 def CMDcomments(parser, args):
   """Shows or posts review comments for any changelist."""
   parser.add_option('-a', '--add-comment', dest='comment',
@@ -1814,6 +1830,7 @@
   return 0
 
 
+@subcommand.hidden
 def CMDdescription(parser, args):
   """Brings up the editor for the current CL's description."""
   parser.add_option('-d', '--display', action='store_true',
@@ -1905,8 +1922,8 @@
 
 def CMDpresubmit(parser, args):
   """Runs presubmit tests on the current changelist."""
-  parser.add_option('-u', '--upload', action='store_true',
-                    help='Run upload hook instead of the push/dcommit hook')
+  parser.add_option('-c', '--commit', action='store_true',
+                    help='Run commit hook instead of the upload hook')
   parser.add_option('-f', '--force', action='store_true',
                     help='Run checks even if tree is dirty')
   auth.add_auth_options(parser)
@@ -1925,7 +1942,7 @@
     base_branch = cl.GetCommonAncestorWithUpstream()
 
   cl.RunHook(
-      committing=not options.upload,
+      committing=options.commit,
       may_prompt=False,
       verbose=options.verbose,
       change=cl.GetChange(base_branch, None))
@@ -1950,11 +1967,18 @@
   """upload the current branch to gerrit."""
   # We assume the remote called "origin" is the one we want.
   # It is probably not worthwhile to support different workflows.
-  gerrit_remote = 'origin'
+  remote = 'origin'
+  branch = 'master'
 
-  remote, remote_branch = cl.GetRemoteBranch()
-  branch = GetTargetRef(remote, remote_branch, options.target_branch,
-                        pending_prefix='')
+  if options.target_branch:
+    remote = 'origin'
+    branch = options.target_branch
+  elif settings.GetIsGerritAutoDetectBranch() == 'true':
+    retcode, result = RunGitWithCode(['rev-parse', '--abbrev-ref', '@{u}'])
+    if retcode != 0:
+      print('Unable to auto-detect remote branch.')
+      return 1
+    remote, branch = result.strip().split('/')
 
   change_desc = ChangeDescription(
       options.message or CreateDescriptionFromLog(args))
@@ -2028,7 +2052,8 @@
     print('git log %s..%s' % (parent, ref_to_push))
     print('You can also use `git squash-branch` to squash these into a single '
           'commit.')
-    ask_for_data('About to upload; enter to confirm.')
+    if ask_for_data('About to upload; continue (y/N)? ').lower() != 'y':
+      return 0
 
   if options.reviewers or options.tbr_owners:
     change_desc.update_reviewers(options.reviewers, options.tbr_owners, change)
@@ -2817,6 +2842,7 @@
   return '(prohibited by Gerrit)' in push_stdout
 
 
+@subcommand.hidden
 @subcommand.usage('[upstream branch to apply against]')
 def CMDdcommit(parser, args):
   """Commits the current changelist via git-svn."""
@@ -2840,6 +2866,7 @@
   return SendUpstream(parser, args, 'dcommit')
 
 
+@subcommand.hidden
 @subcommand.usage('[upstream branch to apply against]')
 def CMDland(parser, args):
   """Commits the current changelist via git."""
@@ -2851,6 +2878,7 @@
   return SendUpstream(parser, args, 'land')
 
 
+@subcommand.hidden
 @subcommand.usage('<patch url or issue id>')
 def CMDpatch(parser, args):
   """Patches in a code review."""
@@ -2967,6 +2995,7 @@
   return 0
 
 
+@subcommand.hidden
 def CMDrebase(parser, args):
   """Rebases current branch on top of svn repo."""
   # Provide a wrapper for git svn rebase to help avoid accidental
@@ -3033,6 +3062,7 @@
   return result_master, None
 
 
+@subcommand.hidden
 def CMDtree(parser, args):
   """Shows the status of the tree."""
   _, args = parser.parse_args(args)
@@ -3049,6 +3079,7 @@
   return 0
 
 
+@subcommand.hidden
 def CMDtry(parser, args):
   """Triggers a try job through Rietveld."""
   group = optparse.OptionGroup(parser, "Try job options")
@@ -3231,6 +3262,7 @@
   return 0
 
 
+@subcommand.hidden
 def CMDweb(parser, args):
   """Opens the current CL in the web browser."""
   _, args = parser.parse_args(args)
@@ -3246,6 +3278,7 @@
   return 0
 
 
+@subcommand.hidden
 def CMDset_commit(parser, args):
   """Sets the commit bit to trigger the Commit Queue."""
   auth.add_auth_options(parser)
@@ -3261,6 +3294,7 @@
   return 0
 
 
+@subcommand.hidden
 def CMDset_close(parser, args):
   """Closes the issue."""
   auth.add_auth_options(parser)
@@ -3275,6 +3309,7 @@
   return 0
 
 
+@subcommand.hidden
 def CMDdiff(parser, args):
   """Shows differences between local tree and last upload."""
   auth.add_auth_options(parser)
@@ -3505,11 +3540,21 @@
 
 def CMDlol(parser, args):
   # This command is intentionally undocumented.
-  print zlib.decompress(base64.b64decode(
-      'eNptkLEOwyAMRHe+wupCIqW57v0Vq84WqWtXyrcXnCBsmgMJ+/SSAxMZgRB6NzE'
-      'E2ObgCKJooYdu4uAQVffUEoE1sRQLxAcqzd7uK2gmStrll1ucV3uZyaY5sXyDd9'
-      'JAnN+lAXsOMJ90GANAi43mq5/VeeacylKVgi8o6F1SC63FxnagHfJUTfUYdCR/W'
-      'Ofe+0dHL7PicpytKP750Fh1q2qnLVof4w8OZWNY'))
+  print('\n'.join((
+      ' _______        _             _        ',
+      '(_______)      | |           | |   _   ',
+      ' _        ___  | |__   _____ | | _| |_ ',
+      '| |      / _ \ |  _ \ (____ || |(_   _)',
+      '| |_____| |_| || |_) )/ ___ || |  | |_ ',
+      ' \______)\___/ |____/ \_____| \_)  \__)',
+      '                                       ',
+      '                                                ',
+      '                                      _         ',
+      '  ___    ____  _   _   ____  _____  _| |_   ___ ',
+      ' / _ \  / _  || | | | / ___)| ___ |(_   _) /___)',
+      '| |_| |( (_| || |_| || |    | ____|  | |_ |___ |',
+      ' \___/  \___ ||____/ |_|    |_____)   \__)(___/ ',
+      '       (_____|                                  ')))
   return 0
 
 
@@ -3540,6 +3585,10 @@
   global settings
   settings = Settings()
 
+  # All Rietveld only commands are marked as hidden. Unhide them if not using
+  # Gerrit, to restore the default behavior.
+  subcommand.SHOW_HIDDEN_COMMANDS = not settings.GetIsGerrit()
+
   colorize_CMDstatus_doc()
   dispatcher = subcommand.CommandDispatcher(__name__)
   try:
diff --git a/ninja-linux64 b/ninja-linux64
index e4a6202..6ef086d 100755
--- a/ninja-linux64
+++ b/ninja-linux64
Binary files differ
diff --git a/ninja.exe b/ninja.exe
index 40f662e..c240d73 100755
--- a/ninja.exe
+++ b/ninja.exe
Binary files differ
diff --git a/perl.bat b/perl.bat
new file mode 100644
index 0000000..ad5c90a
--- /dev/null
+++ b/perl.bat
@@ -0,0 +1,5 @@
+@echo off

+

+setlocal

+set PERL5LIB=/lib/perl5

+"%~dp0git-1.9.0.chromium.6_bin\bin\perl.exe" %*

diff --git a/recipes/cobalt.py b/recipes/cobalt.py
new file mode 100644
index 0000000..5f77e7a
--- /dev/null
+++ b/recipes/cobalt.py
@@ -0,0 +1,46 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import sys
+
+import recipe_util  # pylint: disable=F0401
+
+
+# This class doesn't need an __init__ method, so we disable the warning
+# pylint: disable=W0232
+class Cobalt(recipe_util.Recipe):
+  """Basic Recipe class for Cobalt."""
+
+  @staticmethod
+  def fetch_spec(props):
+    ref = 'remotes/origin/COBALT'
+    url = 'https://lbshell-internal.googlesource.com/chromium.git@%s' % ref
+    solution = { 'name'   :'src',
+                 'url'    : url,
+                 'deps_file': 'DEPS',
+                 'managed'   : True,
+                 'custom_deps': {},
+                 'safesync_url': '',
+    }
+    spec = {
+      'solutions': [solution],
+    }
+    checkout_type = 'gclient_git'
+    spec_type = '%s_spec' % checkout_type
+    return {
+      'type': checkout_type,
+      spec_type: spec,
+    }
+
+  @staticmethod
+  def expected_root(_props):
+    return 'src'
+
+
+def main(argv=None):
+  return Cobalt().handle_args(argv)
+
+
+if __name__ == '__main__':
+  sys.exit(main(sys.argv))
diff --git a/simple_echo.exe b/simple_echo.exe
new file mode 100644
index 0000000..612e33a
--- /dev/null
+++ b/simple_echo.exe
Binary files differ
diff --git a/subcommand.py b/subcommand.py
index a9ebae0..9262a4c 100644
--- a/subcommand.py
+++ b/subcommand.py
@@ -45,6 +45,16 @@
 import textwrap
 
 
+# If set to true, will show hidden commands in help.
+SHOW_HIDDEN_COMMANDS = False
+
+
+def hidden(cmd):
+  """Decorator that hides a CMD function from being shown in help."""
+  cmd.hidden = True
+  return cmd
+
+
 def usage(more):
   """Adds a 'usage_more' property to a CMD function."""
   def hook(fn):
@@ -158,6 +168,10 @@
   def _gen_commands_list(self):
     """Generates the short list of supported commands."""
     commands = self.enumerate_commands()
+    if not SHOW_HIDDEN_COMMANDS:
+      commands = dict(
+        (name, handler) for name, handler in commands.iteritems()
+        if not getattr(handler, 'hidden', None))
     docs = sorted(
         (cmd_name, self._create_command_summary(cmd_name, handler))
         for cmd_name, handler in commands.iteritems())
diff --git a/update_depot_tools b/update_depot_tools
index bd20609..81d9979 100755
--- a/update_depot_tools
+++ b/update_depot_tools
@@ -32,7 +32,7 @@
   cmd /c `cygpath -w "$base_dir/bootstrap/win/win_tools.bat"`
 fi
 
-CANONICAL_GIT_URL="https://chromium.googlesource.com/chromium/tools/depot_tools.git"
+CANONICAL_GIT_URL="https://lbshell-internal.googlesource.com/depot_tools.git"
 
 SVN="svn"
 if [ -d "$base_dir/svn_bin" -a $MINGW = 0 ]; then
@@ -41,7 +41,11 @@
 
 GIT="git"
 if [ -e "$base_dir/git.bat" -a $MINGW = 0 ]; then
-  GIT="cmd.exe //c \"$base_dir\\git.bat\""
+  GIT="cmd.exe //c git.bat"
+fi
+
+if [ -e "$base_dir/git.bat" -a $CYGWIN = 0 ]; then
+  GIT="cmd.exe /C git.bat"
 fi
 
 # Test git and git --version.
diff --git a/update_depot_tools.bat b/update_depot_tools.bat
index 983a29e..9b2439c 100644
--- a/update_depot_tools.bat
+++ b/update_depot_tools.bat
@@ -19,7 +19,7 @@
 set DEPOT_TOOLS_DIR=%1

 SHIFT

 

-set GIT_URL=https://chromium.googlesource.com/chromium/tools/depot_tools.git

+set GIT_URL=https://lbshell-internal.googlesource.com/depot_tools.git

 

 :: Will download git, svn and python.

 call "%DEPOT_TOOLS_DIR%bootstrap\win\win_tools.bat"