CVSTrac Legacy Code

Check-in [864223dd4b]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:(#39) diff coloring using DIVs and stylesheets classes =diffx= where =x= is *h*eader, *c*hunk, *t*ext, *a*dded, *r*emoved
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:864223dd4be338b04ec2e06b2cfd39675e83e7a7
User & Date: ono 2009-05-15 21:59:44
Context
2009-06-04
16:42
(#800) end transaction when no GIT repo defined check-in: 0991d26569 user: cpb tags: trunk
2009-05-15
21:59
(#39) diff coloring using DIVs and stylesheets classes =diffx= where =x= is *h*eader, *c*hunk, *t*ext, *a*dded, *r*emoved check-in: 864223dd4b user: ono tags: trunk
13:55
(#797) make sure we get latest change date relative to specified directory check-in: 1bdc8232d2 user: ono tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to cvstrac.css.

290
291
292
293
294
295
296







            border: 2px #a0b5f4 solid;
            text-align: right;
            right: 1em;
            position: absolute;
            padding: 2px;
            margin: 0px;
           }














>
>
>
>
>
>
>
290
291
292
293
294
295
296
297
298
299
300
301
302
303
            border: 2px #a0b5f4 solid;
            text-align: right;
            right: 1em;
            position: absolute;
            padding: 2px;
            margin: 0px;
           }

/* diff colors */
.diffh {background-color: #ddd;}
.diffc {color: #66f;}
.difft {background-color: #fff;}
.diffa {background-color: #bfb;}
.diffr {background-color: #fbb;}

Changes to history.c.

442
443
444
445
446
447
448
449
450





451
452
453
454
455
456
457

458
459
460
461
462
463










464
465
466
467

468
469
470
471
472
473
474
  ** character is "<" then assume the command is giving us HTML.  In
  ** that case, do no translation.  If the first non-whitespace character
  ** is anything other than "<" then assume the output is plain text.
  ** Convert this text into HTML.
  */
  char zLine[2000];
  char *zFormat = 0;
  int i, n=0;
  while( fgets(zLine, sizeof(zLine), in) ){





    n += strlen(zLine);
    for(i=0; isspace(zLine[i]); i++){}
    if( zLine[i]==0 ) continue;
    if( zLine[i]=='<' && bForce==0 ){
      zFormat = "%s";
    }else{
      @ <pre>

      zFormat = "%h";
    }
    cgi_printf(zFormat, zLine);
    break;
  }
  while( fgets(zLine, sizeof(zLine), in) ){










    n += strlen(zLine);
    cgi_printf(zFormat, zLine);
  }
  if( zFormat && zFormat[1]=='h' ){

    @ </pre>
  }
  return n;
}

/*
** Implementas a common file filtering logic. The caller provides the command to







|

>
>
>
>
>







>






>
>
>
>
>
>
>
>
>
>




>







442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
  ** character is "<" then assume the command is giving us HTML.  In
  ** that case, do no translation.  If the first non-whitespace character
  ** is anything other than "<" then assume the output is plain text.
  ** Convert this text into HTML.
  */
  char zLine[2000];
  char *zFormat = 0;
  int i, n=0, diff=0;
  while( fgets(zLine, sizeof(zLine), in) ){
    if( /* CVS */ !strncmp(zLine, "+++ ", 4) ||
        /* SVN */ !strncmp(zLine, "Added: ", 7) ||
        /* SVN */ !strncmp(zLine, "Deleted: ", 9) ||
        /* SVN */ !strncmp(zLine, "Modified: ", 10) ||
        /* GIT */ !strncmp(zLine, "diff ", 5) ){ diff = 'h'; }
    n += strlen(zLine);
    for(i=0; isspace(zLine[i]); i++){}
    if( zLine[i]==0 ) continue;
    if( zLine[i]=='<' && bForce==0 ){
      zFormat = "%s";
    }else{
      @ <pre>
      if( diff ){ cgi_printf("<div class=\"diffh\">"); }
      zFormat = "%h";
    }
    cgi_printf(zFormat, zLine);
    break;
  }
  while( fgets(zLine, sizeof(zLine), in) ){
    int ndiff = ( zLine[0]=='@' ) ? 'c' :
                ( zLine[0]==' ' ) ? 't' :
                ( zLine[0]=='+' && diff!='h' ) ? 'a' :
                ( zLine[0]=='-' && diff!='h' ) ? 'r' :
                ( zLine[0]!='\n' && zLine[0]!='\r' ) ? 'h' :
                diff;
    if( diff && ndiff != diff ){
      diff = ndiff;
      cgi_printf("</div><div class=\"diff%c\">", diff);
    }
    n += strlen(zLine);
    cgi_printf(zFormat, zLine);
  }
  if( zFormat && zFormat[1]=='h' ){
    if( diff ){ cgi_printf("</div>"); }
    @ </pre>
  }
  return n;
}

/*
** Implementas a common file filtering logic. The caller provides the command to