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`)"'
This commit is contained in:
Jeff Bailey 2009-01-21 19:05:15 -05:00 committed by Shawn O. Pearce
parent 47c1a63a07
commit be0e8ac232

View File

@ -34,6 +34,17 @@ pwd is the project's working directory.
REPO_PROJECT is set to the unique name of the project. 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 shell positional arguments ($1, $2, .., $#) are set to any arguments
following <command>. following <command>.
@ -70,6 +81,12 @@ not redirected.
for project in self.GetProjects(args): for project in self.GetProjects(args):
env = dict(os.environ.iteritems()) env = dict(os.environ.iteritems())
env['REPO_PROJECT'] = project.name env['REPO_PROJECT'] = project.name
env['REPO_PATH'] = project.relpath
env['REPO_REMOTE'] = project.remote.name
env['REPO_LREV'] = project\
.GetRemote(project.remote.name)\
.ToLocal(project.revision)
env['REPO_RREV'] = project.revision
p = subprocess.Popen(cmd, p = subprocess.Popen(cmd,
cwd = project.worktree, cwd = project.worktree,