comparison mercurial/commands.py @ 7622:4dd7b28003d2

use dict.iteritems() rather than dict.items() This should be faster and more future-proof. Calls where the result is to be sorted using util.sort() have been left unchanged. Calls to .items() on configparser objects have been left as-is, too.
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Mon, 12 Jan 2009 09:16:03 +0100
parents 26adfaccdf73
children 9c6ae2e09e11
comparison
equal deleted inserted replaced
7621:6d891df43a5f 7622:4dd7b28003d2
786 786
787 def debugstate(ui, repo, nodates=None): 787 def debugstate(ui, repo, nodates=None):
788 """show the contents of the current dirstate""" 788 """show the contents of the current dirstate"""
789 timestr = "" 789 timestr = ""
790 showdate = not nodates 790 showdate = not nodates
791 for file_, ent in util.sort(repo.dirstate._map.items()): 791 for file_, ent in util.sort(repo.dirstate._map.iteritems()):
792 if showdate: 792 if showdate:
793 if ent[3] == -1: 793 if ent[3] == -1:
794 # Pad or slice to locale representation 794 # Pad or slice to locale representation
795 locale_len = len(time.strftime("%Y-%m-%d %H:%M:%S ", time.localtime(0))) 795 locale_len = len(time.strftime("%Y-%m-%d %H:%M:%S ", time.localtime(0)))
796 timestr = 'unset' 796 timestr = 'unset'
1346 addglobalopts(False) 1346 addglobalopts(False)
1347 1347
1348 def helplist(header, select=None): 1348 def helplist(header, select=None):
1349 h = {} 1349 h = {}
1350 cmds = {} 1350 cmds = {}
1351 for c, e in table.items(): 1351 for c, e in table.iteritems():
1352 f = c.split("|", 1)[0] 1352 f = c.split("|", 1)[0]
1353 if select and not select(f): 1353 if select and not select(f):
1354 continue 1354 continue
1355 if (not select and name != 'shortlist' and 1355 if (not select and name != 'shortlist' and
1356 e[0].__module__ != __name__): 1356 e[0].__module__ != __name__):
2744 ctx2 = repo[node2] 2744 ctx2 = repo[node2]
2745 added = stat[1] 2745 added = stat[1]
2746 if node2 is None: 2746 if node2 is None:
2747 added = stat[0] + stat[1] # merged? 2747 added = stat[0] + stat[1] # merged?
2748 2748
2749 for k, v in copies.copies(repo, ctx1, ctx2, ctxn)[0].items(): 2749 for k, v in copies.copies(repo, ctx1, ctx2, ctxn)[0].iteritems():
2750 if k in added: 2750 if k in added:
2751 copy[k] = v 2751 copy[k] = v
2752 elif v in added: 2752 elif v in added:
2753 copy[v] = k 2753 copy[v] = k
2754 2754