Merge "Don't try to remove .repo if it doesn't exist"
diff --git a/project.py b/project.py
index 023cf73..48fa82b 100644
--- a/project.py
+++ b/project.py
@@ -1763,15 +1763,15 @@
cmd.append('--update-head-ok')
cmd.append(name)
+ # If using depth then we should not get all the tags since they may
+ # be outside of the depth.
+ if no_tags or depth:
+ cmd.append('--no-tags')
+ else:
+ cmd.append('--tags')
+
if not current_branch_only:
# Fetch whole repo
- # If using depth then we should not get all the tags since they may
- # be outside of the depth.
- if no_tags or depth:
- cmd.append('--no-tags')
- else:
- cmd.append('--tags')
-
cmd.append(str((u'+refs/heads/*:') + remote.ToLocal('refs/heads/*')))
elif tag_name is not None:
cmd.append('tag')
@@ -1801,7 +1801,7 @@
# Ensure that some refs exist. Otherwise, we probably aren't looking
# at a real git repository and may have a bad url.
if not self.bare_ref.all:
- ok = False
+ ok = False
if alt_dir:
if old_packed != '':
diff --git a/subcmds/forall.py b/subcmds/forall.py
index e2a420a..03ebcb2 100644
--- a/subcmds/forall.py
+++ b/subcmds/forall.py
@@ -87,6 +87,12 @@
REPO_RREV is the name of the revision from the manifest, exactly
as written in the manifest.
+REPO_COUNT is the total number of projects being iterated.
+
+REPO_I is the current (1-based) iteration count. Can be used in
+conjunction with REPO_COUNT to add a simple progress indicator to your
+command.
+
REPO__* are any extra environment variables, specified by the
"annotation" element under any project element. This can be useful
for differentiating trees based on user-specific criteria, or simply
@@ -178,7 +184,9 @@
else:
projects = self.FindProjects(args)
- for project in projects:
+ os.environ['REPO_COUNT'] = str(len(projects))
+
+ for (cnt, project) in enumerate(projects):
env = os.environ.copy()
def setenv(name, val):
if val is None:
@@ -190,6 +198,7 @@
setenv('REPO_REMOTE', project.remote.name)
setenv('REPO_LREV', project.GetRevisionId())
setenv('REPO_RREV', project.revisionExpr)
+ setenv('REPO_I', str(cnt + 1))
for a in project.annotations:
setenv("REPO__%s" % (a.name), a.value)