Fossil

Changes On Branch ckout-page
Login

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

Changes In Branch ckout-page Excluding Merge-Ins

This is equivalent to a diff from de6f88a6f0 to 5ba44a134d

2024-12-10
12:53
Add the /ckout page. check-in: d35d201840 user: drh tags: trunk
12:52
Update the help message for the /ckout page. Closed-Leaf check-in: 5ba44a134d user: drh tags: ckout-page
12:38
Be sure to call vfile_check_signature() so that edits are detected prior to generating diffs on the /ckout page. check-in: 6affaac979 user: drh tags: ckout-page
06:25
Merge trunk into merge-info-html branch for mergestat improvements. check-in: f0a48c8faa user: stephan tags: merge-info-html
00:36
Begin adding the infrastructure for a /ckout webpage. check-in: c620a8c74c user: drh tags: ckout-page
00:09
Fix an obscure possible bug in "fossil ui DIR" if there are 96 or more additional arguments. check-in: de6f88a6f0 user: drh tags: trunk
2024-12-09
23:03
Update the built-in SQLite to the latests trunk version, which includes fixes found in 3.47.2, plus other enhancements. check-in: 077e53a341 user: drh tags: trunk

Changes to src/info.c.
600
601
602
603
604
605
606











































































































607
608
609
610
611
612
613
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







  blob_append_sql(&sql, " AND event.objid IN ok ORDER BY mtime DESC");
  db_prepare(&q, "%s", blob_sql_text(&sql));
  www_print_timeline(&q, TIMELINE_DISJOINT|TIMELINE_GRAPH|TIMELINE_NOSCROLL,
                     0, 0, 0, rid, 0, 0);
  db_finalize(&q);
  style_finish_page();
}

/*
** WEBPAGE: ckout
**
** Show information about the current checkout.  This page only functions
** if the web server is run on a loopback interface (in other words, was
** started using "fossil ui" or similar) from with on open check-out.
*/
void ckout_page(void){
  const char *zName = P("name");
  int vid;
  char *zHostname;
  char *zCwd;
  int diffType;               /* 0: no diff,  1: unified,  2: side-by-side */
  DiffConfig DCfg,*pCfg;      /* Diff details */
  Stmt q;

  if( zName || !db_open_local(0) || !cgi_is_loopback(g.zIpAddr) ){
    webpage_notfound_error(0 /*works-like:""*/);
    return;
  }
  diffType = preferred_diff_type();
  pCfg = construct_diff_flags(diffType, &DCfg);
  vid = db_lget_int("checkout", 0);
  vfile_check_signature(vid, CKSIG_ENOTFILE);
  style_set_current_feature("vinfo");
  zHostname = fossil_hostname();
  zCwd = file_getcwd(0,0);
  if( zHostname ){
    style_header("Checkout at %s:%s", zHostname, zCwd);
  }else{
    style_header("Checkout at %s", zCwd);
  }
  render_checkin_context(vid, 0, 0, 0);
  db_prepare(&q,
       /*   0         1        2        3       4    5       6 */
    "SELECT pathname, deleted, chnged , rid==0, rid, islink, uuid"
    "  FROM vfile LEFT JOIN blob USING(rid)"
    " WHERE vid=%d"
    "   AND (deleted OR chnged OR rid==0)"
    " ORDER BY pathname /*scan*/",
    vid
  );
  if( pCfg->diffFlags & DIFF_SIDEBYSIDE ){
    pCfg->diffFlags |= DIFF_HTML | DIFF_NOTTOOBIG;
  }else{
    pCfg->diffFlags |= DIFF_LINENO | DIFF_HTML | DIFF_NOTTOOBIG;
  }
  while( db_step(&q)==SQLITE_ROW ){
    const char *zTreename = db_column_text(&q,0);
    int isDeleted = db_column_int(&q, 1);
    int isChnged = db_column_int(&q,2);
    int isNew = db_column_int(&q,3);
    int srcid = db_column_int(&q, 4);
    int isLink = db_column_int(&q, 5);
    const char *zUuid = db_column_text(&q, 6);
    int showDiff = 1;

    pCfg->diffFlags &= (~DIFF_FILE_MASK);
    if( isDeleted ){
      @ <p>DELETED %h(zTreename)</p>
      pCfg->diffFlags |= DIFF_FILE_DELETED;
      showDiff = 0;
    }else if( file_access(zTreename, F_OK) ){
      @ <p>MISSING %h(zTreename)</p>
      showDiff = 0;
    }else if( isNew ){
      @ <p>ADDED %h(zTreename)</p>
      pCfg->diffFlags |= DIFF_FILE_ADDED;
      srcid = 0;
      showDiff = 0;
    }else if( isChnged==3 ){
      @ <p>ADDED_BY_MERGE %h(zTreename)</p>
      pCfg->diffFlags |= DIFF_FILE_ADDED;
      srcid = 0;
      showDiff = 0;
    }else if( isChnged==5 ){
      @ <p>ADDED_BY_INTEGRATE %h(zTreename)</p>
      pCfg->diffFlags |= DIFF_FILE_ADDED;
      srcid = 0;
      showDiff = 0;
    }else{
      @ <p>CHANGED %h(zTreename)</p>
    }
    if( showDiff ){
      Blob old, new;
      if( !isLink != !file_islink(zTreename) ){
        @ %s(DIFF_CANNOT_COMPUTE_SYMLINK)
        continue;
      }
      if( srcid>0 ){
        content_get(srcid, &old);
        pCfg->zLeftHash = zUuid;
      }else{
        blob_zero(&old);
        pCfg->zLeftHash = 0;
      }
      blob_read_from_file(&new, zTreename, ExtFILE);
      text_diff(&old, &new, cgi_output_blob(), pCfg);
      blob_reset(&old);
      blob_reset(&new);
    }
  }
  db_finalize(&q);
  append_diff_javascript(diffType);
  style_finish_page();
}

/*
** WEBPAGE: vinfo
** WEBPAGE: ci
** URL:  /ci/ARTIFACTID
**  OR:  /ci?name=ARTIFACTID
**