summaryrefslogtreecommitdiff
path: root/lorry
diff options
context:
space:
mode:
Diffstat (limited to 'lorry')
-rwxr-xr-xlorry8
1 files changed, 6 insertions, 2 deletions
diff --git a/lorry b/lorry
index c2019d4..9a10045 100755
--- a/lorry
+++ b/lorry
@@ -743,6 +743,7 @@ class Lorry(cliapp.Application):
mark_re = re.compile(r':(\S+) ([0-9a-f]{40,})\n')
marks_temp_fd, marks_temp_name = \
tempfile.mkstemp(dir=os.path.dirname(marks_name))
+ n_pruned = 0
try:
with open(marks_temp_fd, 'w') as marks_out, \
open(marks_name, 'r') as marks_in:
@@ -759,11 +760,14 @@ class Lorry(cliapp.Application):
elif match.group(2) in reachable:
marks_out.write(line)
else:
- self.progress('%s: pruning unreachable commit %s'
- % (marks_name, match.group(2)))
+ n_pruned += 1
# On success, replace marks file with temporary file
os.rename(marks_temp_name, marks_name)
+
+ if n_pruned:
+ self.progress('%s: pruned %d unreachable commit(s)'
+ % (marks_name, n_pruned))
except:
# On failure, delete temporary file
os.unlink(marks_temp_name)