##// END OF EJS Templates
keyword: improve use of dicts...
Christian Ebert -
r5946:ee0dc0f3 default
parent child Browse files
Show More
@@ -310,7 +310,7 b' def demo(ui, repo, *args, **opts):'
310 kwmaps = kwtemplater.templates
310 kwmaps = kwtemplater.templates
311 if ui.configitems('keywordmaps'):
311 if ui.configitems('keywordmaps'):
312 # override maps from optional rcfile
312 # override maps from optional rcfile
313 for k, v in kwmaps.items():
313 for k, v in kwmaps.iteritems():
314 ui.setconfig('keywordmaps', k, v)
314 ui.setconfig('keywordmaps', k, v)
315 elif args:
315 elif args:
316 # simulate hgrc parsing
316 # simulate hgrc parsing
@@ -329,7 +329,7 b' def demo(ui, repo, *args, **opts):'
329 demostatus('config using %s keyword template maps' % kwstatus)
329 demostatus('config using %s keyword template maps' % kwstatus)
330 ui.write('[extensions]\n%s\n' % extension)
330 ui.write('[extensions]\n%s\n' % extension)
331 demoitems('keyword', ui.configitems('keyword'))
331 demoitems('keyword', ui.configitems('keyword'))
332 demoitems('keywordmaps', kwmaps.items())
332 demoitems('keywordmaps', kwmaps.iteritems())
333 keywords = '$' + '$\n$'.join(kwmaps.keys()) + '$\n'
333 keywords = '$' + '$\n$'.join(kwmaps.keys()) + '$\n'
334 repo.wopener(fn, 'w').write(keywords)
334 repo.wopener(fn, 'w').write(keywords)
335 repo.add([fn])
335 repo.add([fn])
@@ -464,10 +464,10 b' def reposetup(ui, repo):'
464 wlock = self.wlock()
464 wlock = self.wlock()
465 lock = self.lock()
465 lock = self.lock()
466 # store and postpone commit hooks
466 # store and postpone commit hooks
467 commithooks = []
467 commithooks = {}
468 for name, cmd in ui.configitems('hooks'):
468 for name, cmd in ui.configitems('hooks'):
469 if name.split('.', 1)[0] == 'commit':
469 if name.split('.', 1)[0] == 'commit':
470 commithooks.append((name, cmd))
470 commithooks[name] = cmd
471 ui.setconfig('hooks', name, None)
471 ui.setconfig('hooks', name, None)
472 if commithooks:
472 if commithooks:
473 # store parents for commit hook environment
473 # store parents for commit hook environment
@@ -488,7 +488,7 b' def reposetup(ui, repo):'
488 p1=p1, p2=p2, extra=extra)
488 p1=p1, p2=p2, extra=extra)
489
489
490 # restore commit hooks
490 # restore commit hooks
491 for name, cmd in commithooks:
491 for name, cmd in commithooks.iteritems():
492 ui.setconfig('hooks', name, cmd)
492 ui.setconfig('hooks', name, cmd)
493 if node is not None:
493 if node is not None:
494 _overwrite(ui, self, node=node)
494 _overwrite(ui, self, node=node)
General Comments 0
You need to be logged in to leave comments. Login now