comparison mercurial/hgweb/webcommands.py @ 36307:a748a5d1d7c3

webcommands: unpack contents of length-1 dict portably ((k,v),) = dict.items() was suggested by some friends, but I feel like that's maybe too clever? Differential Revision: https://phab.mercurial-scm.org/D2304
author Augie Fackler <augie@google.com>
date Sat, 17 Feb 2018 22:38:25 -0500
parents 0ef50a5e3ae1
children 0cacd4df6eb0
comparison
equal deleted inserted replaced
36306:1ec6fd26f841 36307:a748a5d1d7c3
540 for d in sorted(dirs): 540 for d in sorted(dirs):
541 541
542 emptydirs = [] 542 emptydirs = []
543 h = dirs[d] 543 h = dirs[d]
544 while isinstance(h, dict) and len(h) == 1: 544 while isinstance(h, dict) and len(h) == 1:
545 k, v = h.items()[0] 545 k, v = next(iter(h.items()))
546 if v: 546 if v:
547 emptydirs.append(k) 547 emptydirs.append(k)
548 h = v 548 h = v
549 549
550 path = "%s%s" % (abspath, d) 550 path = "%s%s" % (abspath, d)