Show More
@@ -507,7 +507,7 def renamedirs(dirs, words): | |||
|
507 | 507 | head = rename(head) |
|
508 | 508 | else: |
|
509 | 509 | head = '' |
|
510 |
renamed = os.path.join(head, |
|
|
510 | renamed = os.path.join(head, next(wordgen)) | |
|
511 | 511 | replacements[dirpath] = renamed |
|
512 | 512 | return renamed |
|
513 | 513 | result = [] |
@@ -793,7 +793,7 class Translator(nodes.NodeVisitor): | |||
|
793 | 793 | def visit_list_item(self, node): |
|
794 | 794 | # man 7 man argues to use ".IP" instead of ".TP" |
|
795 | 795 | self.body.append('.IP %s %d\n' % ( |
|
796 |
self._list_char[-1] |
|
|
796 | next(self._list_char[-1]), | |
|
797 | 797 | self._list_char[-1].get_width(),)) |
|
798 | 798 | |
|
799 | 799 | def depart_list_item(self, node): |
@@ -68,7 +68,7 def pygmentize(field, fctx, style, tmpl, | |||
|
68 | 68 | coloriter = (s.encode(encoding.encoding, 'replace') |
|
69 | 69 | for s in colorized.splitlines()) |
|
70 | 70 | |
|
71 |
tmpl.filters['colorize'] = lambda x: |
|
|
71 | tmpl.filters['colorize'] = lambda x: next(coloriter) | |
|
72 | 72 | |
|
73 | 73 | oldl = tmpl.cache[field] |
|
74 | 74 | newl = oldl.replace('line|escape', 'line|colorize') |
@@ -291,7 +291,7 class lazyancestors(object): | |||
|
291 | 291 | def __nonzero__(self): |
|
292 | 292 | """False if the set is empty, True otherwise.""" |
|
293 | 293 | try: |
|
294 |
iter(self) |
|
|
294 | next(iter(self)) | |
|
295 | 295 | return True |
|
296 | 296 | except StopIteration: |
|
297 | 297 | return False |
@@ -1998,7 +1998,7 def _makelogrevset(repo, pats, opts, rev | |||
|
1998 | 1998 | followfirst = 0 |
|
1999 | 1999 | # --follow with FILE behavior depends on revs... |
|
2000 | 2000 | it = iter(revs) |
|
2001 |
startrev = |
|
|
2001 | startrev = next(it) | |
|
2002 | 2002 | followdescendants = startrev < next(it, startrev) |
|
2003 | 2003 | |
|
2004 | 2004 | # branch and only_branch are really aliases and must be handled at |
@@ -484,16 +484,16 def checkcopies(ctx, f, m1, m2, ca, limi | |||
|
484 | 484 | f1r, f2r = f1.linkrev(), f2.linkrev() |
|
485 | 485 | |
|
486 | 486 | if f1r is None: |
|
487 |
f1 = |
|
|
487 | f1 = next(g1) | |
|
488 | 488 | if f2r is None: |
|
489 |
f2 = |
|
|
489 | f2 = next(g2) | |
|
490 | 490 | |
|
491 | 491 | while True: |
|
492 | 492 | f1r, f2r = f1.linkrev(), f2.linkrev() |
|
493 | 493 | if f1r > f2r: |
|
494 |
f1 = |
|
|
494 | f1 = next(g1) | |
|
495 | 495 | elif f2r > f1r: |
|
496 |
f2 = |
|
|
496 | f2 = next(g2) | |
|
497 | 497 | elif f1 == f2: |
|
498 | 498 | return f1 # a match |
|
499 | 499 | elif f1r == f2r or f1r < limit or f2r < limit: |
@@ -139,7 +139,7 def _filerevision(web, req, tmpl, fctx): | |||
|
139 | 139 | yield {"line": t, |
|
140 | 140 | "lineid": "l%d" % (lineno + 1), |
|
141 | 141 | "linenumber": "% 6d" % (lineno + 1), |
|
142 |
"parity": |
|
|
142 | "parity": next(parity)} | |
|
143 | 143 | |
|
144 | 144 | return tmpl("filerevision", |
|
145 | 145 | file=f, |
@@ -278,7 +278,7 def _search(web, req, tmpl): | |||
|
278 | 278 | files = webutil.listfilediffs(tmpl, ctx.files(), n, web.maxfiles) |
|
279 | 279 | |
|
280 | 280 | yield tmpl('searchentry', |
|
281 |
parity= |
|
|
281 | parity=next(parity), | |
|
282 | 282 | changelogtag=showtags, |
|
283 | 283 | files=files, |
|
284 | 284 | **webutil.commonentry(web.repo, ctx)) |
@@ -375,7 +375,7 def changelog(web, req, tmpl, shortlog=F | |||
|
375 | 375 | break |
|
376 | 376 | |
|
377 | 377 | entry = webutil.changelistentry(web, web.repo[rev], tmpl) |
|
378 |
entry['parity'] = |
|
|
378 | entry['parity'] = next(parity) | |
|
379 | 379 | yield entry |
|
380 | 380 | |
|
381 | 381 | if shortlog: |
@@ -527,7 +527,7 def manifest(web, req, tmpl): | |||
|
527 | 527 | |
|
528 | 528 | fctx = ctx.filectx(full) |
|
529 | 529 | yield {"file": full, |
|
530 |
"parity": |
|
|
530 | "parity": next(parity), | |
|
531 | 531 | "basename": f, |
|
532 | 532 | "date": fctx.date(), |
|
533 | 533 | "size": fctx.size(), |
@@ -545,7 +545,7 def manifest(web, req, tmpl): | |||
|
545 | 545 | h = v |
|
546 | 546 | |
|
547 | 547 | path = "%s%s" % (abspath, d) |
|
548 |
yield {"parity": |
|
|
548 | yield {"parity": next(parity), | |
|
549 | 549 | "path": path, |
|
550 | 550 | "emptydirs": "/".join(emptydirs), |
|
551 | 551 | "basename": d} |
@@ -554,7 +554,7 def manifest(web, req, tmpl): | |||
|
554 | 554 | symrev=symrev, |
|
555 | 555 | path=abspath, |
|
556 | 556 | up=webutil.up(abspath), |
|
557 |
upparity= |
|
|
557 | upparity=next(parity), | |
|
558 | 558 | fentries=filelist, |
|
559 | 559 | dentries=dirlist, |
|
560 | 560 | archives=web.archivelist(hex(node)), |
@@ -582,7 +582,7 def tags(web, req, tmpl): | |||
|
582 | 582 | if latestonly: |
|
583 | 583 | t = t[:1] |
|
584 | 584 | for k, n in t: |
|
585 |
yield {"parity": |
|
|
585 | yield {"parity": next(parity), | |
|
586 | 586 | "tag": k, |
|
587 | 587 | "date": web.repo[n].date(), |
|
588 | 588 | "node": hex(n)} |
@@ -615,7 +615,7 def bookmarks(web, req, tmpl): | |||
|
615 | 615 | if latestonly: |
|
616 | 616 | t = i[:1] |
|
617 | 617 | for k, n in t: |
|
618 |
yield {"parity": |
|
|
618 | yield {"parity": next(parity), | |
|
619 | 619 | "bookmark": k, |
|
620 | 620 | "date": web.repo[n].date(), |
|
621 | 621 | "node": hex(n)} |
@@ -677,7 +677,7 def summary(web, req, tmpl): | |||
|
677 | 677 | break |
|
678 | 678 | |
|
679 | 679 | yield tmpl("tagentry", |
|
680 |
parity= |
|
|
680 | parity=next(parity), | |
|
681 | 681 | tag=k, |
|
682 | 682 | node=hex(n), |
|
683 | 683 | date=web.repo[n].date()) |
@@ -688,7 +688,7 def summary(web, req, tmpl): | |||
|
688 | 688 | sortkey = lambda b: (web.repo[b[1]].rev(), b[0]) |
|
689 | 689 | marks = sorted(marks, key=sortkey, reverse=True) |
|
690 | 690 | for k, n in marks[:10]: # limit to 10 bookmarks |
|
691 |
yield {'parity': |
|
|
691 | yield {'parity': next(parity), | |
|
692 | 692 | 'bookmark': k, |
|
693 | 693 | 'date': web.repo[n].date(), |
|
694 | 694 | 'node': hex(n)} |
@@ -704,7 +704,7 def summary(web, req, tmpl): | |||
|
704 | 704 | |
|
705 | 705 | l.append(tmpl( |
|
706 | 706 | 'shortlogentry', |
|
707 |
parity= |
|
|
707 | parity=next(parity), | |
|
708 | 708 | **webutil.commonentry(web.repo, ctx))) |
|
709 | 709 | |
|
710 | 710 | l.reverse() |
@@ -879,7 +879,7 def annotate(web, req, tmpl): | |||
|
879 | 879 | if last != fnode: |
|
880 | 880 | last = fnode |
|
881 | 881 | |
|
882 |
yield {"parity": |
|
|
882 | yield {"parity": next(parity), | |
|
883 | 883 | "node": f.hex(), |
|
884 | 884 | "rev": f.rev(), |
|
885 | 885 | "author": f.user(), |
@@ -963,7 +963,7 def filelog(web, req, tmpl): | |||
|
963 | 963 | iterfctx = fctx.filectx(i) |
|
964 | 964 | |
|
965 | 965 | l.append(dict( |
|
966 |
parity= |
|
|
966 | parity=next(parity), | |
|
967 | 967 | filerev=i, |
|
968 | 968 | file=f, |
|
969 | 969 | rename=webutil.renamelink(iterfctx), |
@@ -75,7 +75,7 class revnav(object): | |||
|
75 | 75 | def _first(self): |
|
76 | 76 | """return the minimum non-filtered changeset or None""" |
|
77 | 77 | try: |
|
78 |
return iter(self._revlog) |
|
|
78 | return next(iter(self._revlog)) | |
|
79 | 79 | except StopIteration: |
|
80 | 80 | return None |
|
81 | 81 | |
@@ -247,7 +247,7 def branchentries(repo, stripecount, lim | |||
|
247 | 247 | else: |
|
248 | 248 | status = 'open' |
|
249 | 249 | yield { |
|
250 |
'parity': |
|
|
250 | 'parity': next(parity), | |
|
251 | 251 | 'branch': ctx.branch(), |
|
252 | 252 | 'status': status, |
|
253 | 253 | 'node': ctx.hex(), |
@@ -369,7 +369,7 def changesetentry(web, req, tmpl, ctx): | |||
|
369 | 369 | template = f in ctx and 'filenodelink' or 'filenolink' |
|
370 | 370 | files.append(tmpl(template, |
|
371 | 371 | node=ctx.hex(), file=f, blockno=blockno + 1, |
|
372 |
parity= |
|
|
372 | parity=next(parity))) | |
|
373 | 373 | |
|
374 | 374 | basectx = basechangectx(web.repo, req) |
|
375 | 375 | if basectx is None: |
@@ -450,15 +450,15 def diffs(repo, tmpl, ctx, basectx, file | |||
|
450 | 450 | block = [] |
|
451 | 451 | for chunk in patch.diff(repo, node1, node2, m, opts=diffopts): |
|
452 | 452 | if chunk.startswith('diff') and block: |
|
453 |
blockno = |
|
|
454 |
yield tmpl('diffblock', parity= |
|
|
453 | blockno = next(blockcount) | |
|
454 | yield tmpl('diffblock', parity=next(parity), blockno=blockno, | |
|
455 | 455 | lines=prettyprintlines(''.join(block), blockno)) |
|
456 | 456 | block = [] |
|
457 | 457 | if chunk.startswith('diff') and style != 'raw': |
|
458 | 458 | chunk = ''.join(chunk.splitlines(True)[1:]) |
|
459 | 459 | block.append(chunk) |
|
460 |
blockno = |
|
|
461 |
yield tmpl('diffblock', parity= |
|
|
460 | blockno = next(blockcount) | |
|
461 | yield tmpl('diffblock', parity=next(parity), blockno=blockno, | |
|
462 | 462 | lines=prettyprintlines(''.join(block), blockno)) |
|
463 | 463 | |
|
464 | 464 | def compare(tmpl, context, leftlines, rightlines): |
@@ -521,14 +521,14 def diffstatgen(ctx, basectx): | |||
|
521 | 521 | def diffsummary(statgen): |
|
522 | 522 | '''Return a short summary of the diff.''' |
|
523 | 523 | |
|
524 |
stats, maxname, maxtotal, addtotal, removetotal, binary = |
|
|
524 | stats, maxname, maxtotal, addtotal, removetotal, binary = next(statgen) | |
|
525 | 525 | return _(' %d files changed, %d insertions(+), %d deletions(-)\n') % ( |
|
526 | 526 | len(stats), addtotal, removetotal) |
|
527 | 527 | |
|
528 | 528 | def diffstat(tmpl, ctx, statgen, parity): |
|
529 | 529 | '''Return a diffstat template for each file in the diff.''' |
|
530 | 530 | |
|
531 |
stats, maxname, maxtotal, addtotal, removetotal, binary = |
|
|
531 | stats, maxname, maxtotal, addtotal, removetotal, binary = next(statgen) | |
|
532 | 532 | files = ctx.files() |
|
533 | 533 | |
|
534 | 534 | def pct(i): |
@@ -543,7 +543,7 def diffstat(tmpl, ctx, statgen, parity) | |||
|
543 | 543 | fileno += 1 |
|
544 | 544 | yield tmpl(template, node=ctx.hex(), file=filename, fileno=fileno, |
|
545 | 545 | total=total, addpct=pct(adds), removepct=pct(removes), |
|
546 |
parity= |
|
|
546 | parity=next(parity)) | |
|
547 | 547 | |
|
548 | 548 | class sessionvars(object): |
|
549 | 549 | def __init__(self, vars, start='?'): |
@@ -373,7 +373,7 class mergestate(object): | |||
|
373 | 373 | """Write current state on disk in a version 1 file""" |
|
374 | 374 | f = self._repo.vfs(self.statepathv1, 'w') |
|
375 | 375 | irecords = iter(records) |
|
376 |
lrecords = |
|
|
376 | lrecords = next(irecords) | |
|
377 | 377 | assert lrecords[0] == 'L' |
|
378 | 378 | f.write(hex(self._local) + '\n') |
|
379 | 379 | for rtype, data in irecords: |
@@ -98,12 +98,12 def batchable(f): | |||
|
98 | 98 | ''' |
|
99 | 99 | def plain(*args, **opts): |
|
100 | 100 | batchable = f(*args, **opts) |
|
101 |
encargsorres, encresref = |
|
|
101 | encargsorres, encresref = next(batchable) | |
|
102 | 102 | if not encresref: |
|
103 | 103 | return encargsorres # a local result in this case |
|
104 | 104 | self = args[0] |
|
105 | 105 | encresref.set(self._submitone(f.func_name, encargsorres)) |
|
106 |
return |
|
|
106 | return next(batchable) | |
|
107 | 107 | setattr(plain, 'batchable', f) |
|
108 | 108 | return plain |
|
109 | 109 |
@@ -2821,9 +2821,9 def _iterordered(ascending, iter1, iter2 | |||
|
2821 | 2821 | # Consume both iterators in an ordered way until one is empty |
|
2822 | 2822 | while True: |
|
2823 | 2823 | if val1 is None: |
|
2824 |
val1 = |
|
|
2824 | val1 = next(iter1) | |
|
2825 | 2825 | if val2 is None: |
|
2826 |
val2 = |
|
|
2826 | val2 = next(iter2) | |
|
2827 | 2827 | n = choice(val1, val2) |
|
2828 | 2828 | yield n |
|
2829 | 2829 | if val1 == n: |
@@ -292,7 +292,7 def _readtagcache(ui, repo): | |||
|
292 | 292 | cachehash = None |
|
293 | 293 | if cachefile: |
|
294 | 294 | try: |
|
295 |
validline = |
|
|
295 | validline = next(cachelines) | |
|
296 | 296 | validline = validline.split() |
|
297 | 297 | cacherev = int(validline[0]) |
|
298 | 298 | cachenode = bin(validline[1]) |
@@ -97,7 +97,7 class remotebatch(peer.batcher): | |||
|
97 | 97 | batchablefn = getattr(mtd, 'batchable', None) |
|
98 | 98 | if batchablefn is not None: |
|
99 | 99 | batchable = batchablefn(mtd.im_self, *args, **opts) |
|
100 |
encargsorres, encresref = |
|
|
100 | encargsorres, encresref = next(batchable) | |
|
101 | 101 | if encresref: |
|
102 | 102 | req.append((name, encargsorres,)) |
|
103 | 103 | rsp.append((batchable, encresref, resref,)) |
@@ -115,7 +115,7 class remotebatch(peer.batcher): | |||
|
115 | 115 | for encres, r in zip(encresults, rsp): |
|
116 | 116 | batchable, encresref, resref = r |
|
117 | 117 | encresref.set(encres) |
|
118 |
resref.set( |
|
|
118 | resref.set(next(batchable)) | |
|
119 | 119 | |
|
120 | 120 | class remoteiterbatcher(peer.iterbatcher): |
|
121 | 121 | def __init__(self, remote): |
@@ -138,7 +138,7 class remoteiterbatcher(peer.iterbatcher | |||
|
138 | 138 | for name, args, opts, resref in self.calls: |
|
139 | 139 | mtd = getattr(self._remote, name) |
|
140 | 140 | batchable = mtd.batchable(mtd.im_self, *args, **opts) |
|
141 |
encargsorres, encresref = |
|
|
141 | encargsorres, encresref = next(batchable) | |
|
142 | 142 | assert encresref |
|
143 | 143 | req.append((name, encargsorres)) |
|
144 | 144 | rsp.append((batchable, encresref)) |
@@ -150,7 +150,7 class remoteiterbatcher(peer.iterbatcher | |||
|
150 | 150 | for (batchable, encresref), encres in itertools.izip( |
|
151 | 151 | self._rsp, self._resultiter): |
|
152 | 152 | encresref.set(encres) |
|
153 |
yield |
|
|
153 | yield next(batchable) | |
|
154 | 154 | |
|
155 | 155 | # Forward a couple of names from peer to make wireproto interactions |
|
156 | 156 | # slightly more sensible. |
General Comments 0
You need to be logged in to leave comments.
Login now