Refactor repo_to_repo.py a little bit.

I'm writing a script to do compiler bootstrap, which needs to sync a
user provided gcc directory with chromiumos git repository and submit
all that changes to chromiumos git locally.

The modification includes -
1. added a new repo type - FileRepo, which is literally no-op but set
"_root_dir" to its directory
2. outlined the submit code from PushSources, so that this submit
routine could be called from outside

I also tested that this worked even if the input FileRepo is read-only.

Tested using a test rtr file as below -
{
  "input": [{
    "type": "file",
    "address": "/usr/local/google/home/shenhan/temp2",
  },],
  "output": [{
    "type": "git",
    "address": "file:///usr/local/google/home/shenhan/temp",
    "ignores": [".svn", ".git"],
  },],
}

TEST=run repo_to_repo.py with gcc-4_7-mobile profile.

Change-Id: Ib73be0b4fa8612428801b10a17abdcdc1a2822e3
Reviewed-on: https://gerrit-int.chromium.org/33990
Reviewed-by: asharif <asharif@google.com>
Commit-Queue: Han Shen <shenhan@google.com>
Tested-by: Han Shen <shenhan@google.com>
1 file changed