#!/usr/bin/env bash
# Copyright (c) 2012 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.

TOPLEVEL=$(git rev-parse --show-toplevel)
TOPPERLEVEL=$(dirname $TOPLEVEL)

cat <<EOF
Sorry `whoami`, but the git-submodule flow has been deprecated in order to
simplify the plethora of SCM choices, and to pave the way towards a git-only
chromium development flow.

Please consult https://code.google.com/p/chromium/wiki/UsingGitSubmodules#Convert_from_submodules_to_gclient
for instructions on how to convert your submodule checkout to gclient.

The simplest chromium and/or blink instructions follow for convenience.

1. Make sure the parent directory of this checkout is empty, besides this repo:
$ ls $TOPPERLEVEL
EOF
ls "$TOPPERLEVEL"
if [[ "$(ls "$TOPPERLEVEL")" != 'src' ]]
then
  echo Please move this repo to its own directory before continuing!!!
fi
echo

cat <<EOF
2. Please add a .gclient file to $TOPPERLEVEL/.gclient of the form:
# ======== .gclient begins =========
solutions = [{
  'name': '$(basename "$TOPLEVEL")',
  'url': 'https://chromium.googlesource.com/chromium/src.git',
  'managed': False,
  'deps_file': '.DEPS.git',
  # Uncomment the following if you're doing blink development
  # 'custom_vars': {'webkit_revision': ''},
}]
# ======== .gclient ends =========

3. Run \`gclient sync\` to synchronize dependencies in your checkout instead of $(basename "$0")!
EOF

exit 1
