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