summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Bailey <jeffbailey@google.com>2009-01-21 19:05:15 -0500
committerShawn O. Pearce <sop@google.com>2009-03-02 19:32:28 -0800
commitbe0e8ac232de862d287927c4d735cf30f040cf42 (patch)
treebd967fd652ed0da2cd967a66fe5f239780d61120
parent47c1a63a07ebd67efac00ca9e0d877633aea5881 (diff)
downloadgit-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`)"'
-rw-r--r--subcmds/forall.py17
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
35REPO_PROJECT is set to the unique name of the project. 35REPO_PROJECT is set to the unique name of the project.
36 36
37REPO_PATH is the path relative the the root of the client.
38
39REPO_REMOTE is the name of the remote system from the manifest.
40
41REPO_LREV is the name of the revision from the manifest, translated
42to a local tracking branch. If you need to pass the manifest
43revision to a locally executed git command, use REPO_LREV.
44
45REPO_RREV is the name of the revision from the manifest, exactly
46as written in the manifest.
47
37shell positional arguments ($1, $2, .., $#) are set to any arguments 48shell positional arguments ($1, $2, .., $#) are set to any arguments
38following <command>. 49following <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,