OLD | NEW |
| (Empty) |
1 #!/bin/bash | |
2 # Copyright 2014 Google Inc. | |
3 # | |
4 # Use of this source code is governed by a BSD-style license that can be | |
5 # found in the LICENSE file. | |
6 | |
7 # Crude script to clone the git skia repo into the current directory, which | |
8 # must be a CitC client. | |
9 # | |
10 # Usage: | |
11 # ./tools/git_clone_to_google3.sh | |
12 | |
13 prodcertstatus -q || (echo "Please run prodaccess." 1>&2; exit 1) | |
14 source gbash.sh || exit 2 | |
15 | |
16 DEFINE_string skia_rev "" "Git hash of Skia revision to clone, default latest." | |
17 gbash::init_google "$@" | |
18 | |
19 set -e | |
20 | |
21 # Checkout specified revision of Skia in a temp location. | |
22 TMP=$(gbash::make_temp_dir) | |
23 pushd "${TMP}" | |
24 git clone https://skia.googlesource.com/skia | |
25 cd skia | |
26 git fetch | |
27 if [[ -z "${FLAGS_skia_rev}" ]]; then | |
28 # Retrieve latest revision. | |
29 FLAGS_skia_rev="$(git show --format=%H --no-patch origin/master)" | |
30 fi | |
31 git checkout --detach "${FLAGS_skia_rev}" | |
32 | |
33 # Rsync to google3 location. | |
34 popd | |
35 # Use multichange client in case there are too many files for nomultichange. htt
p://b/7292343 | |
36 g4 client --set_option multichange | |
37 # Use allwrite to simplify opening the correct files after rsync. | |
38 g4 client --set_option allwrite | |
39 # Filter directories added to CitC. | |
40 rsync -avzJ \ | |
41 --delete \ | |
42 --delete-excluded \ | |
43 --include=/bench \ | |
44 --include=/dm \ | |
45 --include=/gm \ | |
46 --include=/include \ | |
47 --include=/resources \ | |
48 --exclude=/src/animator \ | |
49 --include=/src \ | |
50 --include=/tests \ | |
51 --include=/third_party \ | |
52 --include=/tools \ | |
53 --include=/.git \ | |
54 '--exclude=/*/' \ | |
55 --include=/third_party/etc1 \ | |
56 --include=/third_party/ktx \ | |
57 --include=/third_party/libwebp \ | |
58 '--exclude=/third_party/*/' \ | |
59 "${TMP}/skia/" \ | |
60 "./" | |
61 | |
62 # Open added/changed files for add/edit. | |
63 g4 reopen | |
64 # Revert files that are equivalent to the checked in version. | |
65 g4 revert -a | |
66 | |
67 # Tell CitC to ignore .git and .gitignore. | |
68 find . \ | |
69 \( -name .git \ | |
70 -o -name .gitignore \ | |
71 \) \ | |
72 -execdir g4 revert -k \{\} \; | |
73 | |
74 # Tell Git to ignore README.google and BUILD. | |
75 echo README.google >> .git/info/exclude | |
76 echo BUILD >> .git/info/exclude | |
77 g4 revert README.google | |
78 g4 revert BUILD | |
79 | |
80 # Use google3 version of OWNERS. | |
81 find . \ | |
82 -name OWNERS \ | |
83 -exec git update-index --skip-worktree \{\} \; \ | |
84 -execdir g4 revert \{\} \; | |
85 | |
86 # Tell git to ignore these files that have Windows line endings, because Piper | |
87 # will always change them to Unix line endings. | |
88 git update-index --skip-worktree make.bat | |
89 git update-index --skip-worktree make.py | |
90 | |
91 # Tell git to ignore files left out of the rsync (i.e. "deleted" files). | |
92 git status --porcelain | \ | |
93 grep -e "^ D" | \ | |
94 cut -c 4- | \ | |
95 xargs git update-index --skip-worktree | |
96 | |
OLD | NEW |