Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- echo "Cleaning up..."
- rm -rf sync
- rm -rf components/sync
- rm components/sync.gyp
- git reset --hard origin/master
- echo "Moving files within sync..."
- cd sync/internal_api
- # Move cc files back next to their headers.
- git mv activation_context.cc base_node.cc base_transaction.cc change_record.cc delete_journal.cc http_bridge.cc http_bridge_network_resources.cc http_bridge_unittest.cc internal_components_factory_impl.cc model_type_connector.cc model_type_store_backend.cc model_type_store_backend_unittest.cc model_type_store_impl.cc model_type_store_impl_unittest.cc processor_entity_tracker.cc processor_entity_tracker_unittest.cc read_node.cc read_transaction.cc shared_model_type_processor.cc shared_model_type_processor_unittest.cc sync_db_util.cc sync_manager_factory.cc user_share.cc write_node.cc write_transaction.cc public
- git mv events/* public/events
- cd ..
- git mv engine engine_impl
- git mv sessions sessions_impl
- git rm util/DEPS
- git mv util/* base
- git rm internal_api/public/base/DEPS
- git mv internal_api/public/base/* base
- git mv internal_api/public/util/* base
- git mv internal_api/public/engine engine
- git mv internal_api/public/sessions sessions
- git mv internal_api/public/events engine/
- git mv internal_api/public core
- git mv internal_api core_impl
- mkdir android/java/src/org/chromium/components
- mkdir android/javatests/src/org/chromium/components
- mkdir test/android/javatests/src/org/chromium/components
- git mv android/java/src/org/chromium/sync android/java/src/org/chromium/components/sync
- git mv android/javatests/src/org/chromium/sync android/javatests/src/org/chromium/components/sync
- git mv test/android/javatests/src/org/chromium/sync test/android/javatests/src/org/chromium/components/sync
- # replace performs a string replacement for all files in the repo under the
- # current folder and is defined as:
- #
- # git grep -l "$1" | xargs sed -i "s/$1/$2/g"
- echo "Updating sync build files..."
- replace "\"engine\/" "\"engine_impl\/"
- replace "'engine\/" "'engine_impl\/"
- replace "\"sessions\/" "\"sessions_impl\/"
- replace "'sessions\/" "'sessions_impl\/"
- replace "\"util\/" "\"base\/"
- replace "'util\/" "'base\/"
- # Fixes for the specifically moved cc files.
- replace "internal_api\/activation_context.cc" "internal_api\/public\/activation_context.cc"
- replace "internal_api\/base_node.cc" "internal_api\/public\/base_node.cc"
- replace "internal_api\/base_transaction.cc" "internal_api\/public\/base_transaction.cc"
- replace "internal_api\/change_record.cc" "internal_api\/public\/change_record.cc"
- replace "internal_api\/delete_journal.cc" "internal_api\/public\/delete_journal.cc"
- replace "internal_api\/events\/" "internal_api\/public\/events\/"
- replace "internal_api\/http_bridge.cc" "internal_api\/public\/http_bridge.cc"
- replace "internal_api\/http_bridge_network_resources.cc" "internal_api\/public\/http_bridge_network_resources.cc"
- replace "internal_api\/http_bridge_unittest.cc" "internal_api\/public\/http_bridge_unittest.cc"
- replace "internal_api\/internal_components_factory_impl.cc" "internal_api\/public\/internal_components_factory_impl.cc"
- replace "internal_api\/model_type_connector.cc" "internal_api\/public\/model_type_connector.cc"
- replace "internal_api\/model_type_store_backend.cc" "internal_api\/public\/model_type_store_backend.cc"
- replace "internal_api\/model_type_store_backend_unittest.cc" "internal_api\/public\/model_type_store_backend_unittest.cc"
- replace "internal_api\/model_type_store_impl.cc" "internal_api\/public\/model_type_store_impl.cc"
- replace "internal_api\/model_type_store_impl_unittest.cc" "internal_api\/public\/model_type_store_impl_unittest.cc"
- replace "internal_api\/processor_entity_tracker.cc" "internal_api\/public\/processor_entity_tracker.cc"
- replace "internal_api\/processor_entity_tracker_unittest.cc" "internal_api\/public\/processor_entity_tracker_unittest.cc"
- replace "internal_api\/read_node.cc" "internal_api\/public\/read_node.cc"
- replace "internal_api\/read_transaction.cc" "internal_api\/public\/read_transaction.cc"
- replace "internal_api\/shared_model_type_processor.cc" "internal_api\/public\/shared_model_type_processor.cc"
- replace "internal_api\/shared_model_type_processor_unittest.cc" "internal_api\/public\/shared_model_type_processor_unittest.cc"
- replace "internal_api\/sync_db_util.cc" "internal_api\/public\/sync_db_util.cc"
- replace "internal_api\/sync_manager_factory.cc" "internal_api\/public\/sync_manager_factory.cc"
- replace "internal_api\/user_share.cc" "internal_api\/public\/user_share.cc"
- replace "internal_api\/write_node.cc" "internal_api\/public\/write_node.cc"
- replace "internal_api\/write_transaction.cc" "internal_api\/public\/write_transaction.cc"
- cd ..
- echo "Moving sync to components..."
- git mv sync components
- git mv components/sync/sync.gyp components/sync.gyp
- echo "Fixing strings repo-wide..."
- # The moved sync.gyp file.
- replace "sync\/sync\.gyp" "components\/sync\.gyp"
- # Other sync references in gyp.
- replace "\.\.\/sync\/" "\.\.\/components\/sync\/"
- # All includes.
- replace "include \"sync\/" "include \"components\/sync\/"
- # DEPS files.
- replace "\"+sync" "\"+components\/sync"
- # Reorganized folders.
- replace "components\/sync\/engine" "components\/sync\/engine_impl"
- replace "components\/sync\/sessions" "components\/sync\/sessions_impl"
- replace "components\/sync\/util" "components\/sync\/base"
- replace "internal_api\/public\/base\/" "base\/"
- replace "internal_api\/public\/engine" "engine"
- replace "internal_api\/public\/events" "engine\/events"
- replace "internal_api\/public\/sessions" "sessions"
- replace "internal_api\/public\/util" "base"
- replace "internal_api\/public" "core"
- # Fix a couple things just within the sync folder.
- cd components/sync
- # gyp file fixes.
- replace "'\.\.\/" "'\.\.\/\.\.\/"
- # Any occurences of internal_api left must be core_impl, not core.
- replace "internal_api" "core_impl"
- cd ../..
- # BUILD.gn fixes.
- replace "\"\/\/sync" "\"\/\/components\/sync"
- replace " \/\/sync" " \/\/components\/sync"
- # Other misc stray references to things.
- replace "test_support_sync_internal_api" "test_support_sync_core_impl"
- replace "\/\/sync\/protocol" "\/\/components\/sync\/protocol"
- replace "\"sync\/protocol" "\"components\/sync\/protocol"
- replace "\"sync\/base" "\"components\/sync\/base"
- replace "sync\/internal_api" "sync\/core_impl"
- # Java fixes.
- replace "org\.chromium\.sync" "org\.chromium\.components\.sync"
- replace "org\/chromium\/sync" "org\/chromium\/components\/sync"
- # This file should not be modified.
- git co .git-blame-ignore-revs
- echo "Fixing include guards..."
- cd components/sync/core
- replace "_INTERNAL_API_" "_CORE_"
- replace "_PUBLIC_" "_"
- cd ..
- replace "SYNC_ENGINE_" "SYNC_ENGINE_IMPL_"
- replace "SYNC_SESSIONS_" "SYNC_SESSIONS_IMPL_"
- replace "SYNC_UTIL_" "SYNC_BASE_"
- replace "INTERNAL_API_PUBLIC_BASE" "BASE"
- replace "INTERNAL_API_PUBLIC_ENGINE" "ENGINE"
- replace "INTERNAL_API_PUBLIC_EVENTS" "ENGINE_EVENTS"
- replace "INTERNAL_API_PUBLIC_SESSIONS" "SESSIONS"
- replace "INTERNAL_API_PUBLIC_UTIL" "BASE"
- replace "_INTERNAL_API_" "_CORE_IMPL_"
- replace "ifndef SYNC_" "ifndef COMPONENTS_SYNC_"
- replace "define SYNC_" "define COMPONENTS_SYNC_"
- replace "endif \/\/ SYNC_" "endif \/\/ COMPONENTS_SYNC_"
- # Fix some macros that the above few lines mess up.
- replace "COMPONENTS_SYNC_DATA_TYPE_HISTOGRAM" "SYNC_DATA_TYPE_HISTOGRAM"
- replace "COMPONENTS_SYNC_FREQ_HISTOGRAM" "SYNC_FREQ_HISTOGRAM"
- replace "COMPONENTS_SYNC_EXPORT" "SYNC_EXPORT"
- replace "COMPONENTS_SYNC_PROTO_EXPORT" "SYNC_PROTO_EXPORT"
- cd ../..
- # sort_includes is a hacked version of cpplint/nitpick.py that sorts Java
- # imports in addition to C++ includes. It mostly just sorts within blocks of
- # includes, but can also insert newlines to create new blocks if it detects
- # different types of include (e.g. C++ vs C system headers).
- echo "Sorting includes..."
- git diff --name-only --diff-filter=ACMR origin/master | xargs sort_includes --quiet
- echo "Formatting..."
- git cl format
- # These two files get seriously messed up by git cl format.
- git co components/sync/syncable/directory_backing_store.cc
- git co components/sync/syncable/directory_backing_store_unittest.cc
- git commit --all -m "Automated changes." > /dev/null
- echo "Cherry-picking manual changes..."
- # This commit contains DEP file fixes and the changes for the two above files.
- git cherry-pick 39077d05
- echo "Building..."
- build_chrome
- echo "Running presubmit checks..."
- git cl presubmit
Advertisement
Add Comment
Please, Sign In to add comment