diff options
| author | Jeff Bailey <jeffbailey@google.com> | 2009-01-21 19:05:15 -0500 |
|---|---|---|
| committer | Shawn O. Pearce <sop@google.com> | 2009-03-02 19:32:28 -0800 |
| commit | be0e8ac232de862d287927c4d735cf30f040cf42 (patch) | |
| tree | bd967fd652ed0da2cd967a66fe5f239780d61120 /subcmds/forall.py | |
| parent | 47c1a63a07ebd67efac00ca9e0d877633aea5881 (diff) | |
| download | git-repo-be0e8ac232de862d287927c4d735cf30f040cf42.tar.gz | |
Export additional environment variables to repo forall:
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, but
translated to something the local repository knows.
REPO_RREV is the name of the revision from the manifest.
This allows us to do commands like:
repo forall -c 'echo "(cd $REPO_PATH && git checkout `git rev-parse HEAD`)"'
Diffstat (limited to 'subcmds/forall.py')
| -rw-r--r-- | subcmds/forall.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/subcmds/forall.py b/subcmds/forall.py index b22e22a1..acbf18bc 100644 --- a/subcmds/forall.py +++ b/subcmds/forall.py | |||
| @@ -34,6 +34,17 @@ pwd is the project's working directory. | |||
| 34 | 34 | ||
| 35 | REPO_PROJECT is set to the unique name of the project. | 35 | REPO_PROJECT is set to the unique name of the project. |
| 36 | 36 | ||
| 37 | REPO_PATH is the path relative the the root of the client. | ||
| 38 | |||
| 39 | REPO_REMOTE is the name of the remote system from the manifest. | ||
| 40 | |||
| 41 | REPO_LREV is the name of the revision from the manifest, translated | ||
| 42 | to a local tracking branch. If you need to pass the manifest | ||
| 43 | revision to a locally executed git command, use REPO_LREV. | ||
| 44 | |||
| 45 | REPO_RREV is the name of the revision from the manifest, exactly | ||
| 46 | as written in the manifest. | ||
| 47 | |||
| 37 | shell positional arguments ($1, $2, .., $#) are set to any arguments | 48 | shell positional arguments ($1, $2, .., $#) are set to any arguments |
| 38 | following <command>. | 49 | following <command>. |
| 39 | 50 | ||
| @@ -70,6 +81,12 @@ not redirected. | |||
| 70 | for project in self.GetProjects(args): | 81 | for project in self.GetProjects(args): |
| 71 | env = dict(os.environ.iteritems()) | 82 | env = dict(os.environ.iteritems()) |
| 72 | env['REPO_PROJECT'] = project.name | 83 | env['REPO_PROJECT'] = project.name |
| 84 | env['REPO_PATH'] = project.relpath | ||
| 85 | env['REPO_REMOTE'] = project.remote.name | ||
| 86 | env['REPO_LREV'] = project\ | ||
| 87 | .GetRemote(project.remote.name)\ | ||
| 88 | .ToLocal(project.revision) | ||
| 89 | env['REPO_RREV'] = project.revision | ||
| 73 | 90 | ||
| 74 | p = subprocess.Popen(cmd, | 91 | p = subprocess.Popen(cmd, |
| 75 | cwd = project.worktree, | 92 | cwd = project.worktree, |
