用 repo help forall 就會列出:
Environment ----------- pwd is the project's working directory. If the current client is a mirror client, then pwd is the Git repository. REPO_PROJECT is set to the unique name of the project. REPO_PATH is the path relative the the root of the client. REPO_REMOTE is the name of the remote system from the manifest. REPO_LREV is the name of the revision from the manifest, translated to a local tracking branch. If you need to pass the manifest revision to a locally executed git command, use REPO_LREV. REPO_RREV is the name of the revision from the manifest, exactly as written in the manifest. shell positional arguments ($1, $2, .., $#) are set to any arguments following <command>. Unless -p is used, stdin, stdout, stderr are inherited from the terminal and are not redirected.
所以要在 android project 中,把所有 project 都加入一個 remote target ,可以用
repo forall -c 'git remote add mynb ssh://checkonb/home/checko/androidcode/$REPO_PATH'
這是把nb 上的 android source 加到自己的 remote 中。要使用 repo 內建環境變數, forall -c 後面的 command,要用小字串符號括起來 ' ',這樣 repo 才會正確轉換 $NAME 為變數內容。
可以用
repo forall -c 'echo $REPO_PROJECT $REPO_PATH'
看一下變數的內容REPO_LREV : local revision (commit) REPO_RREV : remote revision/branch因為 repo sync 只會 checkout revision 出來,不會順變 checkout -b branchname,所以可以用
repo forall -c 'git checkout -b $REPO_RREV'然後用 repo status 就可以看每個 project 的 branch name ..
沒有留言:
張貼留言