##// END OF EJS Templates
scmutil: factor out building of transaction summary callback...
Denis Laxalde -
r34621:b799f116 default
parent child Browse files
Show More
@@ -1206,13 +1206,23 b' def registersummarycallback(repo, otr, t'
1206 def txmatch(sources):
1206 def txmatch(sources):
1207 return any(txnname.startswith(source) for source in sources)
1207 return any(txnname.startswith(source) for source in sources)
1208
1208
1209 if txmatch(_reportobsoletedsource):
1209 categories = []
1210
1211 def reportsummary(func):
1212 """decorator for report callbacks."""
1210 reporef = weakref.ref(repo)
1213 reporef = weakref.ref(repo)
1211 def reportsummary(tr):
1214 def wrapped(tr):
1212 """the actual callback reporting the summary"""
1213 repo = reporef()
1215 repo = reporef()
1216 func(repo, tr)
1217 newcat = '%2i-txnreport' % len(categories)
1218 otr.addpostclose(newcat, wrapped)
1219 categories.append(newcat)
1220 return wrapped
1221
1222 if txmatch(_reportobsoletedsource):
1223 @reportsummary
1224 def reportobsoleted(repo, tr):
1214 obsoleted = obsutil.getobsoleted(repo, tr)
1225 obsoleted = obsutil.getobsoleted(repo, tr)
1215 if obsoleted:
1226 if obsoleted:
1216 repo.ui.status(_('obsoleted %i changesets\n')
1227 repo.ui.status(_('obsoleted %i changesets\n')
1217 % len(obsoleted))
1228 % len(obsoleted))
1218 otr.addpostclose('00-txnreport', reportsummary)
General Comments 0
You need to be logged in to leave comments. Login now