Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Unified Diff: tools/git/mass-rename.sh

Issue 11358216: Consolidate mass-rename.sh and move_source_file.py (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to review comments. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/git/move_source_file.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/git/mass-rename.sh
diff --git a/tools/git/mass-rename.sh b/tools/git/mass-rename.sh
index bc184bed91476cb3616e91c9e595fd372a9b44ef..8e9b3782c71f188f2d0ade9747fafcdf148d57e1 100755
--- a/tools/git/mass-rename.sh
+++ b/tools/git/mass-rename.sh
@@ -13,34 +13,7 @@
# 4) commit, then use tools/sort-headers.py to fix #include ordering:
# for f in $(git diff --name-only origin); do ./tools/sort-headers.py $f; done
-# rename:
-# update all uses of |from| (first argument) to |to| (second argument).
-rename() {
- from="$1"
- to="$2"
-
- # Fix references to the files in headers/gyp files.
- echo "Processing: $from -> $to"
- git grep -l "$from" -- '*.cc' '*.h' '*.m' '*.mm' '*.gyp*' | \
- xargs sed -i -e "s|$from|$to|"
-
- # Fix header guards.
- if [ "${from##*.}" = "h" ]; then
- hfrom=$(echo "$from" | tr 'a-z/' 'A-Z_' | sed -e 's|\..*$||')
- hto=$(echo "$to" | tr 'a-z/' 'A-Z_' | sed -e 's|\..*$||')
- echo "Processing: $hfrom -> $hto"
- git grep -l "$hfrom" -- '*.cc' '*.h' '*.m' '*.mm' | \
- xargs sed -i -e "s|$hfrom|$hto|"
- fi
-
- # Try again, stripping the first directory component -- helps with
- # gyp files that rely on paths from the directory they're in.
- from=$(echo "$from" | sed -e 's|^[^/]*/||')
- to=$(echo "$to" | sed -e 's|^[^/]*/||')
- echo "Processing: $from -> $to"
- git grep -l "$from" -- '*.cc' '*.h' '*.m' '*.mm' '*.gyp*' | \
- xargs sed -i -e "s|$from|$to|"
-}
+DIR="$( cd "$( dirname "$0" )" && pwd )"
# Make the 'read' used in the while loop split only on tabs/newlines.
IFS=$'\t\n'
@@ -48,10 +21,8 @@ IFS=$'\t\n'
git diff --cached --raw -M | while read attrs from to; do
type=$(echo "$attrs" | cut -d' ' -f5)
if echo "$type" | grep -q "^R"; then
- # It's a rename.
- rename "$from" "$to"
+ python $DIR/move_source_file.py --already-moved "$from" "$to"
else
echo "Skipping: $from -- not a rename?"
fi
done
-
« no previous file with comments | « no previous file | tools/git/move_source_file.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698