Show More
@@ -880,9 +880,14 b' def annotate(web, req, tmpl):' | |||
|
880 | 880 | lines = fctx.annotate(follow=True, linenumber=True, |
|
881 | 881 | diffopts=diffopts) |
|
882 | 882 | previousrev = None |
|
883 | blockparitygen = paritygen(1) | |
|
883 | 884 | for lineno, ((f, targetline), l) in enumerate(lines): |
|
884 | 885 | rev = f.rev() |
|
885 |
|
|
|
886 | if rev != previousrev: | |
|
887 | blockhead = True | |
|
888 | blockparity = next(blockparitygen) | |
|
889 | else: | |
|
890 | blockhead = None | |
|
886 | 891 | previousrev = rev |
|
887 | 892 | yield {"parity": next(parity), |
|
888 | 893 | "node": f.hex(), |
@@ -893,6 +898,7 b' def annotate(web, req, tmpl):' | |||
|
893 | 898 | "extra": f.extra(), |
|
894 | 899 | "file": f.path(), |
|
895 | 900 | "blockhead": blockhead, |
|
901 | "blockparity": blockparity, | |
|
896 | 902 | "targetline": targetline, |
|
897 | 903 | "line": l, |
|
898 | 904 | "lineno": lineno + 1, |
@@ -77,7 +77,7 b' filelogentry = filelogentry.tmpl' | |||
|
77 | 77 | |
|
78 | 78 | annotateline = ' |
|
79 | 79 | <tr id="{lineid}"{ifeq(node, originalnode, ' class="thisrev"')}> |
|
80 | <td class="annotate"> | |
|
80 | <td class="annotate parity{blockparity}"> | |
|
81 | 81 | {if(blockhead, |
|
82 | 82 | '<a href="{url|urlescape}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}#l{targetline}"> |
|
83 | 83 | {rev} |
@@ -289,7 +289,7 b' hgweb fileannotate, html' | |||
|
289 | 289 | <tbody class="stripes2"> |
|
290 | 290 | |
|
291 | 291 | <tr id="l1" class="thisrev"> |
|
292 | <td class="annotate"> | |
|
292 | <td class="annotate parity0"> | |
|
293 | 293 | <a href="/annotate/06824edf55d0/primes.py#l1"> |
|
294 | 294 | 0 |
|
295 | 295 | </a> |
@@ -308,7 +308,7 b' hgweb fileannotate, html' | |||
|
308 | 308 | <td class="source"><a href="#l1"> 1</a> <span class="c">#!/usr/bin/env python</span></td> |
|
309 | 309 | </tr> |
|
310 | 310 | <tr id="l2" class="thisrev"> |
|
311 | <td class="annotate"> | |
|
311 | <td class="annotate parity0"> | |
|
312 | 312 | |
|
313 | 313 | <div class="annotate-info"> |
|
314 | 314 | <div> |
@@ -325,7 +325,7 b' hgweb fileannotate, html' | |||
|
325 | 325 | <td class="source"><a href="#l2"> 2</a> </td> |
|
326 | 326 | </tr> |
|
327 | 327 | <tr id="l3" class="thisrev"> |
|
328 | <td class="annotate"> | |
|
328 | <td class="annotate parity0"> | |
|
329 | 329 | |
|
330 | 330 | <div class="annotate-info"> |
|
331 | 331 | <div> |
@@ -342,7 +342,7 b' hgweb fileannotate, html' | |||
|
342 | 342 | <td class="source"><a href="#l3"> 3</a> <span class="sd">"""Fun with generators. Corresponding Haskell implementation:</span></td> |
|
343 | 343 | </tr> |
|
344 | 344 | <tr id="l4" class="thisrev"> |
|
345 | <td class="annotate"> | |
|
345 | <td class="annotate parity0"> | |
|
346 | 346 | |
|
347 | 347 | <div class="annotate-info"> |
|
348 | 348 | <div> |
@@ -359,7 +359,7 b' hgweb fileannotate, html' | |||
|
359 | 359 | <td class="source"><a href="#l4"> 4</a> </td> |
|
360 | 360 | </tr> |
|
361 | 361 | <tr id="l5" class="thisrev"> |
|
362 | <td class="annotate"> | |
|
362 | <td class="annotate parity0"> | |
|
363 | 363 | |
|
364 | 364 | <div class="annotate-info"> |
|
365 | 365 | <div> |
@@ -376,7 +376,7 b' hgweb fileannotate, html' | |||
|
376 | 376 | <td class="source"><a href="#l5"> 5</a> <span class="sd">primes = 2 : sieve [3, 5..]</span></td> |
|
377 | 377 | </tr> |
|
378 | 378 | <tr id="l6" class="thisrev"> |
|
379 | <td class="annotate"> | |
|
379 | <td class="annotate parity0"> | |
|
380 | 380 | |
|
381 | 381 | <div class="annotate-info"> |
|
382 | 382 | <div> |
@@ -393,7 +393,7 b' hgweb fileannotate, html' | |||
|
393 | 393 | <td class="source"><a href="#l6"> 6</a> <span class="sd"> where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]</span></td> |
|
394 | 394 | </tr> |
|
395 | 395 | <tr id="l7" class="thisrev"> |
|
396 | <td class="annotate"> | |
|
396 | <td class="annotate parity0"> | |
|
397 | 397 | |
|
398 | 398 | <div class="annotate-info"> |
|
399 | 399 | <div> |
@@ -410,7 +410,7 b' hgweb fileannotate, html' | |||
|
410 | 410 | <td class="source"><a href="#l7"> 7</a> <span class="sd">"""</span></td> |
|
411 | 411 | </tr> |
|
412 | 412 | <tr id="l8" class="thisrev"> |
|
413 | <td class="annotate"> | |
|
413 | <td class="annotate parity0"> | |
|
414 | 414 | |
|
415 | 415 | <div class="annotate-info"> |
|
416 | 416 | <div> |
@@ -427,7 +427,7 b' hgweb fileannotate, html' | |||
|
427 | 427 | <td class="source"><a href="#l8"> 8</a> </td> |
|
428 | 428 | </tr> |
|
429 | 429 | <tr id="l9" class="thisrev"> |
|
430 | <td class="annotate"> | |
|
430 | <td class="annotate parity0"> | |
|
431 | 431 | |
|
432 | 432 | <div class="annotate-info"> |
|
433 | 433 | <div> |
@@ -444,7 +444,7 b' hgweb fileannotate, html' | |||
|
444 | 444 | <td class="source"><a href="#l9"> 9</a> <span class="kn">from</span> <span class="nn">itertools</span> <span class="kn">import</span> <span class="n">dropwhile</span><span class="p">,</span> <span class="n">ifilter</span><span class="p">,</span> <span class="n">islice</span><span class="p">,</span> <span class="n">count</span><span class="p">,</span> <span class="n">chain</span></td> |
|
445 | 445 | </tr> |
|
446 | 446 | <tr id="l10" class="thisrev"> |
|
447 | <td class="annotate"> | |
|
447 | <td class="annotate parity0"> | |
|
448 | 448 | |
|
449 | 449 | <div class="annotate-info"> |
|
450 | 450 | <div> |
@@ -461,7 +461,7 b' hgweb fileannotate, html' | |||
|
461 | 461 | <td class="source"><a href="#l10"> 10</a> </td> |
|
462 | 462 | </tr> |
|
463 | 463 | <tr id="l11" class="thisrev"> |
|
464 | <td class="annotate"> | |
|
464 | <td class="annotate parity0"> | |
|
465 | 465 | |
|
466 | 466 | <div class="annotate-info"> |
|
467 | 467 | <div> |
@@ -478,7 +478,7 b' hgweb fileannotate, html' | |||
|
478 | 478 | <td class="source"><a href="#l11"> 11</a> <span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></td> |
|
479 | 479 | </tr> |
|
480 | 480 | <tr id="l12" class="thisrev"> |
|
481 | <td class="annotate"> | |
|
481 | <td class="annotate parity0"> | |
|
482 | 482 | |
|
483 | 483 | <div class="annotate-info"> |
|
484 | 484 | <div> |
@@ -495,7 +495,7 b' hgweb fileannotate, html' | |||
|
495 | 495 | <td class="source"><a href="#l12"> 12</a> <span class="sd">"""Generate all primes."""</span></td> |
|
496 | 496 | </tr> |
|
497 | 497 | <tr id="l13" class="thisrev"> |
|
498 | <td class="annotate"> | |
|
498 | <td class="annotate parity0"> | |
|
499 | 499 | |
|
500 | 500 | <div class="annotate-info"> |
|
501 | 501 | <div> |
@@ -512,7 +512,7 b' hgweb fileannotate, html' | |||
|
512 | 512 | <td class="source"><a href="#l13"> 13</a> <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td> |
|
513 | 513 | </tr> |
|
514 | 514 | <tr id="l14" class="thisrev"> |
|
515 | <td class="annotate"> | |
|
515 | <td class="annotate parity0"> | |
|
516 | 516 | |
|
517 | 517 | <div class="annotate-info"> |
|
518 | 518 | <div> |
@@ -529,7 +529,7 b' hgweb fileannotate, html' | |||
|
529 | 529 | <td class="source"><a href="#l14"> 14</a> <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></td> |
|
530 | 530 | </tr> |
|
531 | 531 | <tr id="l15" class="thisrev"> |
|
532 | <td class="annotate"> | |
|
532 | <td class="annotate parity0"> | |
|
533 | 533 | |
|
534 | 534 | <div class="annotate-info"> |
|
535 | 535 | <div> |
@@ -546,7 +546,7 b' hgweb fileannotate, html' | |||
|
546 | 546 | <td class="source"><a href="#l15"> 15</a> <span class="c"># It is important to yield *here* in order to stop the</span></td> |
|
547 | 547 | </tr> |
|
548 | 548 | <tr id="l16" class="thisrev"> |
|
549 | <td class="annotate"> | |
|
549 | <td class="annotate parity0"> | |
|
550 | 550 | |
|
551 | 551 | <div class="annotate-info"> |
|
552 | 552 | <div> |
@@ -563,7 +563,7 b' hgweb fileannotate, html' | |||
|
563 | 563 | <td class="source"><a href="#l16"> 16</a> <span class="c"># infinite recursion.</span></td> |
|
564 | 564 | </tr> |
|
565 | 565 | <tr id="l17" class="thisrev"> |
|
566 | <td class="annotate"> | |
|
566 | <td class="annotate parity0"> | |
|
567 | 567 | |
|
568 | 568 | <div class="annotate-info"> |
|
569 | 569 | <div> |
@@ -580,7 +580,7 b' hgweb fileannotate, html' | |||
|
580 | 580 | <td class="source"><a href="#l17"> 17</a> <span class="kn">yield</span> <span class="n">p</span></td> |
|
581 | 581 | </tr> |
|
582 | 582 | <tr id="l18" class="thisrev"> |
|
583 | <td class="annotate"> | |
|
583 | <td class="annotate parity0"> | |
|
584 | 584 | |
|
585 | 585 | <div class="annotate-info"> |
|
586 | 586 | <div> |
@@ -597,7 +597,7 b' hgweb fileannotate, html' | |||
|
597 | 597 | <td class="source"><a href="#l18"> 18</a> <span class="n">ns</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o">%</span> <span class="n">p</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">,</span> <span class="n">ns</span><span class="p">)</span></td> |
|
598 | 598 | </tr> |
|
599 | 599 | <tr id="l19" class="thisrev"> |
|
600 | <td class="annotate"> | |
|
600 | <td class="annotate parity0"> | |
|
601 | 601 | |
|
602 | 602 | <div class="annotate-info"> |
|
603 | 603 | <div> |
@@ -614,7 +614,7 b' hgweb fileannotate, html' | |||
|
614 | 614 | <td class="source"><a href="#l19"> 19</a> <span class="kn">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="n">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td> |
|
615 | 615 | </tr> |
|
616 | 616 | <tr id="l20" class="thisrev"> |
|
617 | <td class="annotate"> | |
|
617 | <td class="annotate parity0"> | |
|
618 | 618 | |
|
619 | 619 | <div class="annotate-info"> |
|
620 | 620 | <div> |
@@ -631,7 +631,7 b' hgweb fileannotate, html' | |||
|
631 | 631 | <td class="source"><a href="#l20"> 20</a> <span class="kn">yield</span> <span class="n">n</span></td> |
|
632 | 632 | </tr> |
|
633 | 633 | <tr id="l21" class="thisrev"> |
|
634 | <td class="annotate"> | |
|
634 | <td class="annotate parity0"> | |
|
635 | 635 | |
|
636 | 636 | <div class="annotate-info"> |
|
637 | 637 | <div> |
@@ -648,7 +648,7 b' hgweb fileannotate, html' | |||
|
648 | 648 | <td class="source"><a href="#l21"> 21</a> </td> |
|
649 | 649 | </tr> |
|
650 | 650 | <tr id="l22" class="thisrev"> |
|
651 | <td class="annotate"> | |
|
651 | <td class="annotate parity0"> | |
|
652 | 652 | |
|
653 | 653 | <div class="annotate-info"> |
|
654 | 654 | <div> |
@@ -665,7 +665,7 b' hgweb fileannotate, html' | |||
|
665 | 665 | <td class="source"><a href="#l22"> 22</a> <span class="n">odds</span> <span class="o">=</span> <span class="n">ifilter</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">i</span><span class="p">:</span> <span class="n">i</span> <span class="o">%</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">1</span><span class="p">,</span> <span class="n">count</span><span class="p">())</span></td> |
|
666 | 666 | </tr> |
|
667 | 667 | <tr id="l23" class="thisrev"> |
|
668 | <td class="annotate"> | |
|
668 | <td class="annotate parity0"> | |
|
669 | 669 | |
|
670 | 670 | <div class="annotate-info"> |
|
671 | 671 | <div> |
@@ -682,7 +682,7 b' hgweb fileannotate, html' | |||
|
682 | 682 | <td class="source"><a href="#l23"> 23</a> <span class="kn">return</span> <span class="n">chain</span><span class="p">([</span><span class="mi">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o"><</span> <span class="mi">3</span><span class="p">,</span> <span class="n">odds</span><span class="p">)))</span></td> |
|
683 | 683 | </tr> |
|
684 | 684 | <tr id="l24" class="thisrev"> |
|
685 | <td class="annotate"> | |
|
685 | <td class="annotate parity0"> | |
|
686 | 686 | |
|
687 | 687 | <div class="annotate-info"> |
|
688 | 688 | <div> |
@@ -699,7 +699,7 b' hgweb fileannotate, html' | |||
|
699 | 699 | <td class="source"><a href="#l24"> 24</a> </td> |
|
700 | 700 | </tr> |
|
701 | 701 | <tr id="l25" class="thisrev"> |
|
702 | <td class="annotate"> | |
|
702 | <td class="annotate parity0"> | |
|
703 | 703 | |
|
704 | 704 | <div class="annotate-info"> |
|
705 | 705 | <div> |
@@ -716,7 +716,7 b' hgweb fileannotate, html' | |||
|
716 | 716 | <td class="source"><a href="#l25"> 25</a> <span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">"__main__"</span><span class="p">:</span></td> |
|
717 | 717 | </tr> |
|
718 | 718 | <tr id="l26" class="thisrev"> |
|
719 | <td class="annotate"> | |
|
719 | <td class="annotate parity0"> | |
|
720 | 720 | |
|
721 | 721 | <div class="annotate-info"> |
|
722 | 722 | <div> |
@@ -733,7 +733,7 b' hgweb fileannotate, html' | |||
|
733 | 733 | <td class="source"><a href="#l26"> 26</a> <span class="kn">import</span> <span class="nn">sys</span></td> |
|
734 | 734 | </tr> |
|
735 | 735 | <tr id="l27" class="thisrev"> |
|
736 | <td class="annotate"> | |
|
736 | <td class="annotate parity0"> | |
|
737 | 737 | |
|
738 | 738 | <div class="annotate-info"> |
|
739 | 739 | <div> |
@@ -750,7 +750,7 b' hgweb fileannotate, html' | |||
|
750 | 750 | <td class="source"><a href="#l27"> 27</a> <span class="kn">try</span><span class="p">:</span></td> |
|
751 | 751 | </tr> |
|
752 | 752 | <tr id="l28" class="thisrev"> |
|
753 | <td class="annotate"> | |
|
753 | <td class="annotate parity0"> | |
|
754 | 754 | |
|
755 | 755 | <div class="annotate-info"> |
|
756 | 756 | <div> |
@@ -767,7 +767,7 b' hgweb fileannotate, html' | |||
|
767 | 767 | <td class="source"><a href="#l28"> 28</a> <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span></td> |
|
768 | 768 | </tr> |
|
769 | 769 | <tr id="l29" class="thisrev"> |
|
770 | <td class="annotate"> | |
|
770 | <td class="annotate parity0"> | |
|
771 | 771 | |
|
772 | 772 | <div class="annotate-info"> |
|
773 | 773 | <div> |
@@ -784,7 +784,7 b' hgweb fileannotate, html' | |||
|
784 | 784 | <td class="source"><a href="#l29"> 29</a> <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></td> |
|
785 | 785 | </tr> |
|
786 | 786 | <tr id="l30" class="thisrev"> |
|
787 | <td class="annotate"> | |
|
787 | <td class="annotate parity0"> | |
|
788 | 788 | |
|
789 | 789 | <div class="annotate-info"> |
|
790 | 790 | <div> |
@@ -801,7 +801,7 b' hgweb fileannotate, html' | |||
|
801 | 801 | <td class="source"><a href="#l30"> 30</a> <span class="n">n</span> <span class="o">=</span> <span class="mi">10</span></td> |
|
802 | 802 | </tr> |
|
803 | 803 | <tr id="l31" class="thisrev"> |
|
804 | <td class="annotate"> | |
|
804 | <td class="annotate parity0"> | |
|
805 | 805 | |
|
806 | 806 | <div class="annotate-info"> |
|
807 | 807 | <div> |
@@ -818,7 +818,7 b' hgweb fileannotate, html' | |||
|
818 | 818 | <td class="source"><a href="#l31"> 31</a> <span class="n">p</span> <span class="o">=</span> <span class="n">primes</span><span class="p">()</span></td> |
|
819 | 819 | </tr> |
|
820 | 820 | <tr id="l32" class="thisrev"> |
|
821 | <td class="annotate"> | |
|
821 | <td class="annotate parity0"> | |
|
822 | 822 | |
|
823 | 823 | <div class="annotate-info"> |
|
824 | 824 | <div> |
@@ -835,7 +835,7 b' hgweb fileannotate, html' | |||
|
835 | 835 | <td class="source"><a href="#l32"> 32</a> <span class="kn">print</span> <span class="s">"The first </span><span class="si">%d</span><span class="s"> primes: </span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">n</span><span class="p">,</span> <span class="nb">list</span><span class="p">(</span><span class="n">islice</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">n</span><span class="p">)))</span></td> |
|
836 | 836 | </tr> |
|
837 | 837 | <tr id="l33" class="thisrev"> |
|
838 | <td class="annotate"> | |
|
838 | <td class="annotate parity0"> | |
|
839 | 839 | |
|
840 | 840 | <div class="annotate-info"> |
|
841 | 841 | <div> |
General Comments 0
You need to be logged in to leave comments.
Login now