From be0e8ac232de862d287927c4d735cf30f040cf42 Mon Sep 17 00:00:00 2001 From: Jeff Bailey Date: Wed, 21 Jan 2009 19:05:15 -0500 Subject: [PATCH] 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`)"' --- subcmds/forall.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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. 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 . @@ -70,6 +81,12 @@ not redirected. for project in self.GetProjects(args): env = dict(os.environ.iteritems()) 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, cwd = project.worktree,