2 # Copyright 2014 Google Inc.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
7 # Crude script to clone the git skia repo into the current directory, which
8 # must be a CitC client.
11 # ./tools/git_clone_to_google3.sh
13 source gbash.sh || exit
14 DEFINE_string skia_rev "" "Git hash of Skia revision to clone, default LKGR."
18 # To run this script after making edits, run:
19 # g4 revert -k git_clone_to_google3.sh
20 # To get the file back into your CL, run:
21 # g4 edit git_clone_to_google3.sh
22 #g4 opened | grep -q "//depot" && gbash::die "Must run in a clean client."
24 # Checkout LKGR of Skia in a temp location.
25 TMP=$(gbash::make_temp_dir)
27 git clone https://skia.googlesource.com/skia
30 if [ -z "${FLAGS_skia_rev}" ]; then
31 # Retrieve last known good revision.
32 MY_DIR="$(gbash::get_absolute_caller_dir)"
33 FLAGS_skia_rev="$(${MY_DIR}/get_skia_lkgr.sh)"
35 git checkout --detach "${FLAGS_skia_rev}"
37 # Rsync to google3 location.
39 # Use multichange client in case there are too many files for nomultichange. http://b/7292343
40 g4 client --set_option multichange
41 # Use allwrite to simplify opening the correct files after rsync.
42 g4 client --set_option allwrite
43 # Filter directories added to CitC.
52 --exclude=/src/animator \
54 --include=/third_party \
58 --include=/third_party/etc1 \
59 --include=/third_party/ktx \
60 --include=/third_party/libwebp \
61 '--exclude=/third_party/*/' \
65 # Open added/changed files for add/edit.
67 # Revert files that are equivalent to the checked in version.
70 # Tell CitC to ignore .git and .gitignore.
75 -execdir g4 revert -k \{\} \;
77 # Tell Git to ignore README.google and BUILD.
78 echo README.google >> .git/info/exclude
79 echo BUILD >> .git/info/exclude
80 g4 revert README.google
83 # Use google3 version of OWNERS, README.google, and BUILD.
85 \( -name OWNERS -o -name README.google -o -name BUILD \) \
86 -exec git update-index --skip-worktree \{\} \; \
87 -execdir g4 revert \{\} \;
89 # Tell git to ignore files left out of the rsync (i.e. "deleted" files).
90 git status --porcelain | \
93 xargs git update-index --skip-worktree