summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--project.py16
-rw-r--r--subcmds/forall.py11
2 files changed, 18 insertions, 9 deletions
diff --git a/project.py b/project.py
index 023cf732..48fa82b7 100644
--- a/project.py
+++ b/project.py
@@ -1763,15 +1763,15 @@ class Project(object):
1763 cmd.append('--update-head-ok') 1763 cmd.append('--update-head-ok')
1764 cmd.append(name) 1764 cmd.append(name)
1765 1765
1766 # If using depth then we should not get all the tags since they may
1767 # be outside of the depth.
1768 if no_tags or depth:
1769 cmd.append('--no-tags')
1770 else:
1771 cmd.append('--tags')
1772
1766 if not current_branch_only: 1773 if not current_branch_only:
1767 # Fetch whole repo 1774 # Fetch whole repo
1768 # If using depth then we should not get all the tags since they may
1769 # be outside of the depth.
1770 if no_tags or depth:
1771 cmd.append('--no-tags')
1772 else:
1773 cmd.append('--tags')
1774
1775 cmd.append(str((u'+refs/heads/*:') + remote.ToLocal('refs/heads/*'))) 1775 cmd.append(str((u'+refs/heads/*:') + remote.ToLocal('refs/heads/*')))
1776 elif tag_name is not None: 1776 elif tag_name is not None:
1777 cmd.append('tag') 1777 cmd.append('tag')
@@ -1801,7 +1801,7 @@ class Project(object):
1801 # Ensure that some refs exist. Otherwise, we probably aren't looking 1801 # Ensure that some refs exist. Otherwise, we probably aren't looking
1802 # at a real git repository and may have a bad url. 1802 # at a real git repository and may have a bad url.
1803 if not self.bare_ref.all: 1803 if not self.bare_ref.all:
1804 ok = False 1804 ok = False
1805 1805
1806 if alt_dir: 1806 if alt_dir:
1807 if old_packed != '': 1807 if old_packed != '':
diff --git a/subcmds/forall.py b/subcmds/forall.py
index e2a420a9..03ebcb21 100644
--- a/subcmds/forall.py
+++ b/subcmds/forall.py
@@ -87,6 +87,12 @@ revision to a locally executed git command, use REPO_LREV.
87REPO_RREV is the name of the revision from the manifest, exactly 87REPO_RREV is the name of the revision from the manifest, exactly
88as written in the manifest. 88as written in the manifest.
89 89
90REPO_COUNT is the total number of projects being iterated.
91
92REPO_I is the current (1-based) iteration count. Can be used in
93conjunction with REPO_COUNT to add a simple progress indicator to your
94command.
95
90REPO__* are any extra environment variables, specified by the 96REPO__* are any extra environment variables, specified by the
91"annotation" element under any project element. This can be useful 97"annotation" element under any project element. This can be useful
92for differentiating trees based on user-specific criteria, or simply 98for differentiating trees based on user-specific criteria, or simply
@@ -178,7 +184,9 @@ without iterating through the remaining projects.
178 else: 184 else:
179 projects = self.FindProjects(args) 185 projects = self.FindProjects(args)
180 186
181 for project in projects: 187 os.environ['REPO_COUNT'] = str(len(projects))
188
189 for (cnt, project) in enumerate(projects):
182 env = os.environ.copy() 190 env = os.environ.copy()
183 def setenv(name, val): 191 def setenv(name, val):
184 if val is None: 192 if val is None:
@@ -190,6 +198,7 @@ without iterating through the remaining projects.
190 setenv('REPO_REMOTE', project.remote.name) 198 setenv('REPO_REMOTE', project.remote.name)
191 setenv('REPO_LREV', project.GetRevisionId()) 199 setenv('REPO_LREV', project.GetRevisionId())
192 setenv('REPO_RREV', project.revisionExpr) 200 setenv('REPO_RREV', project.revisionExpr)
201 setenv('REPO_I', str(cnt + 1))
193 for a in project.annotations: 202 for a in project.annotations:
194 setenv("REPO__%s" % (a.name), a.value) 203 setenv("REPO__%s" % (a.name), a.value)
195 204