blob: 8e9b3782c71f188f2d0ade9747fafcdf148d57e1 [file] [log] [blame]
# Copyright (c) 2011 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.
# mass-rename: update source files (gyp lists, #includes) to reflect
# a rename. Expects "git diff --cached -M" to list a bunch of renames.
# To use:
# 1) git mv foo1 bar1; git mv foo2 bar2; etc.
# 2) *without committing*, ./tools/git/
# 3) look at git diff (without --cached) to see what the damage is
# 4) commit, then use tools/ to fix #include ordering:
# for f in $(git diff --name-only origin); do ./tools/ $f; done
DIR="$( cd "$( dirname "$0" )" && pwd )"
# Make the 'read' used in the while loop split only on tabs/newlines.
git diff --cached --raw -M | while read attrs from to; do
type=$(echo "$attrs" | cut -d' ' -f5)
if echo "$type" | grep -q "^R"; then
python $DIR/ --already-moved "$from" "$to"
echo "Skipping: $from -- not a rename?"