1#!/bin/bash
2# Brings local repository to a remote head state.
3
4# set -ex
5
6function finalize_revert_local_changes_main() {
7    local top="$(dirname "$0")"/../../../..
8    local m="$top/build/soong/soong_ui.bash --make-mode TARGET_PRODUCT=aosp_arm64 TARGET_BUILD_VARIANT=userdebug"
9
10    # remove the out folder
11    $m clobber
12
13    repo selfupdate
14
15    repo forall -c '\
16        git checkout . ; git revert --abort ; git clean -fdx ;\
17        git checkout @ --detach ; git branch fina-step1 -D ; git reset --hard; \
18        repo start fina-step1 ; git checkout @ --detach ; git b fina-step1 -D ;'
19}
20
21finalize_revert_local_changes_main
22