Fossil

Changes On Branch artifact-view-links
Login

Changes On Branch artifact-view-links

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

Changes In Branch artifact-view-links Excluding Merge-Ins

This is equivalent to a diff from 282402d82f to ea28708f85

2021-03-01
13:34
Removed BLOB_SEEK_END from the API, per /chat discussion, as it was unused and appeared to have a semantic discrepancy vis-a-vis fseek() and SEEK_END. ... (check-in: 6fc730e0c7 user: stephan tags: trunk)
07:37
Merged trunk changes in. Only needed to track my own rename of branch_of_rid() to branch_of_ckin_rid() ... (Leaf check-in: ea28708f85 user: wyoung tags: artifact-view-links)
07:15
Copied over documentation of 2 recently-added "fossil cgi" control file lines to the www/cgi.wiki doc (redirect and jsmode) and then reordered it all to match the order given in "fossil cgi --help" output to make it easier to maintain these parallel lists in the future. ... (check-in: 282402d82f user: wyoung tags: trunk)
06:47
Fixed "debug" -> "cgi-debug" in the built-in docs for "fossil cgi". ... (check-in: e3dbb7d7d5 user: wyoung tags: trunk)
2020-05-27
16:02
Merged trunk changes in ... (check-in: 32f391f655 user: wyoung tags: artifact-view-links)

Changes to src/branch.c.

38
39
40
41
42
43
44
45
46
47
48
49
50













































51
52
53
54
55
56
57
/*
** If RID refers to a check-in, return the name of the branch for that
** check-in.
**
** Space to hold the returned value is obtained from fossil_malloc()
** and should be freed by the caller.
*/
char *branch_of_rid(int rid){
  char *zBr = 0;
  static Stmt q;
  db_static_prepare(&q,
      "SELECT value FROM tagxref"
      " WHERE rid=$rid AND tagid=%d"













































      " AND tagtype>0", TAG_BRANCH);
  db_bind_int(&q, "$rid", rid);
  if( db_step(&q)==SQLITE_ROW ){
    zBr = fossil_strdup(db_column_text(&q,0));
  }
  db_reset(&q);
  if( zBr==0 ){







|





>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*
** If RID refers to a check-in, return the name of the branch for that
** check-in.
**
** Space to hold the returned value is obtained from fossil_malloc()
** and should be freed by the caller.
*/
char *branch_of_ckin_rid(int rid){
  char *zBr = 0;
  static Stmt q;
  db_static_prepare(&q,
      "SELECT value FROM tagxref"
      " WHERE rid=$rid AND tagid=%d"
      " AND tagtype>0", TAG_BRANCH);
  db_bind_int(&q, "$rid", rid);
  if( db_step(&q)==SQLITE_ROW ){
    zBr = fossil_strdup(db_column_text(&q,0));
  }
  db_reset(&q);
  if( zBr==0 ){
    static char *zMain = 0;
    if( zMain==0 ) zMain = db_get("main-branch",0);
    zBr = fossil_strdup(zMain);
  }
  return zBr;
}

/*
** If RID refers to a file, return the name of one of the branches in which
** the file is used.  If the RID file is used in more than one branch, then
** the branch name returned is selected arbitrarily from the available
** choices.
**
** Space to hold the returned value is obtained from fossil_malloc()
** and should be freed by the caller.
**
** TODO:
** Should the "arbitrary" choice of branch be made deterministic?
** Perhaps the algorithm should be:
**    1.  Use "trunk" if it is available
**    2.  Use select the branch in which the file was first used
**        if it is never used in trunk.
** That algorithm can be implemented (I think) by adding:
**
**     ... ORDER BY value<>'trunk', tagxref.mtime LIMIT 1
**
** Maybe step 2 of the algorithm should be the most recent use of
** the file rather than the first use?  That can be achieved by 
** putting a DESC on the second term of the ORDER BY.
*/
char *branch_of_file_rid(int rid){
  char *zBr = 0;
  static Stmt q;
  db_static_prepare(&q,
      "SELECT value FROM tagxref, mlink"
      " WHERE rid=mlink.mid"
      " AND mlink.fid=$rid"
      " AND tagid=%d"
      " AND tagtype>0", TAG_BRANCH);
  db_bind_int(&q, "$rid", rid);
  if( db_step(&q)==SQLITE_ROW ){
    zBr = fossil_strdup(db_column_text(&q,0));
  }
  db_reset(&q);
  if( zBr==0 ){

Changes to src/info.c.

653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
     "SELECT uuid, datetime(mtime,toLocal()), user, comment,"
     "       datetime(omtime,toLocal()), mtime"
     "  FROM blob, event"
     " WHERE blob.rid=%d"
     "   AND event.objid=%d",
     rid, rid
  );
  zBrName = branch_of_rid(rid);
  
  cookie_link_parameter("diff","diff","2");
  diffType = atoi(PD("diff","2"));
  if( db_step(&q1)==SQLITE_ROW ){
    const char *zUuid = db_column_text(&q1, 0);
    int nUuid = db_column_bytes(&q1, 0);
    char *zEUser, *zEComment;







|







653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
     "SELECT uuid, datetime(mtime,toLocal()), user, comment,"
     "       datetime(omtime,toLocal()), mtime"
     "  FROM blob, event"
     " WHERE blob.rid=%d"
     "   AND event.objid=%d",
     rid, rid
  );
  zBrName = branch_of_ckin_rid(rid);
  
  cookie_link_parameter("diff","diff","2");
  diffType = atoi(PD("diff","2"));
  if( db_step(&q1)==SQLITE_ROW ){
    const char *zUuid = db_column_text(&q1, 0);
    int nUuid = db_column_bytes(&q1, 0);
    char *zEUser, *zEComment;
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
  if( zBranch ){
    style_header("Changes On Branch %h", zBranch);
  }else{
    style_header("Check-in Differences");
  }
  if( P("nohdr")==0 ){
    if( zBranch ){
      char *zRealBranch = branch_of_rid(ridTo);
      char *zToUuid = rid_to_uuid(ridTo);
      char *zFromUuid = rid_to_uuid(ridFrom);
      @ <h2>Changes In Branch \
      @ %z(href("%R/timeline?r=%T",zRealBranch))%h(zRealBranch)</a>
      if( ridTo != symbolic_name_to_rid(zRealBranch,"ci") ){
        @ Through %z(href("%R/info/%!S",zToUuid))[%S(zToUuid)]</a>
      }







|







1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
  if( zBranch ){
    style_header("Changes On Branch %h", zBranch);
  }else{
    style_header("Check-in Differences");
  }
  if( P("nohdr")==0 ){
    if( zBranch ){
      char *zRealBranch = branch_of_ckin_rid(ridTo);
      char *zToUuid = rid_to_uuid(ridTo);
      char *zFromUuid = rid_to_uuid(ridFrom);
      @ <h2>Changes In Branch \
      @ %z(href("%R/timeline?r=%T",zRealBranch))%h(zRealBranch)</a>
      if( ridTo != symbolic_name_to_rid(zRealBranch,"ci") ){
        @ Through %z(href("%R/info/%!S",zToUuid))[%S(zToUuid)]</a>
      }
2248
2249
2250
2251
2252
2253
2254

2255
2256
2257
2258
2259
2260
2261
  Blob downloadName;
  int renderAsWiki = 0;
  int renderAsHtml = 0;
  int renderAsSvg = 0;
  int objType;
  int asText;
  const char *zUuid = 0;

  u32 objdescFlags = OBJDESC_BASE;
  int descOnly = fossil_strcmp(g.zPath,"whatis")==0;
  int isFile = fossil_strcmp(g.zPath,"file")==0;
  const char *zLn = P("ln");
  const char *zName = P("name");
  const char *zCI = P("ci");
  HQuery url;







>







2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
  Blob downloadName;
  int renderAsWiki = 0;
  int renderAsHtml = 0;
  int renderAsSvg = 0;
  int objType;
  int asText;
  const char *zUuid = 0;
  const char *zBr;
  u32 objdescFlags = OBJDESC_BASE;
  int descOnly = fossil_strcmp(g.zPath,"whatis")==0;
  int isFile = fossil_strcmp(g.zPath,"file")==0;
  const char *zLn = P("ln");
  const char *zName = P("name");
  const char *zCI = P("ci");
  HQuery url;
2460
2461
2462
2463
2464
2465
2466








2467
2468
2469
2470
2471
2472
2473
    while( db_step(&q)==SQLITE_ROW ){
      const char *zUser = db_column_text(&q,0);
      const char *zDate = db_column_text(&q,1);
      const char *zIp = db_column_text(&q,2);
      @ <p>Received on %s(zDate) from %h(zUser) at %h(zIp).</p>
    }
    db_finalize(&q);








  }
  style_submenu_element("Download", "%R/raw/%s?at=%T", zUuid, file_tail(zName));
  if( db_exists("SELECT 1 FROM mlink WHERE fid=%d", rid) ){
    style_submenu_element("Check-ins Using", "%R/timeline?uf=%s", zUuid);
  }
  if( zMime ){
    if( fossil_strcmp(zMime, "text/html")==0 ){







>
>
>
>
>
>
>
>







2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
    while( db_step(&q)==SQLITE_ROW ){
      const char *zUser = db_column_text(&q,0);
      const char *zDate = db_column_text(&q,1);
      const char *zIp = db_column_text(&q,2);
      @ <p>Received on %s(zDate) from %h(zUser) at %h(zIp).</p>
    }
    db_finalize(&q);
  }
  zBr = branch_of_file_rid(rid);
  if( zBr && zBr[0] ){
    style_submenu_element("View", "%R/doc/%T/%T",
                           zBr, blob_str(&downloadName));
    style_submenu_element("Tip", "%R/file/%T?ci=%T",
                           blob_str(&downloadName), zBr);
    fossil_free((void *)zBr);
  }
  style_submenu_element("Download", "%R/raw/%s?at=%T", zUuid, file_tail(zName));
  if( db_exists("SELECT 1 FROM mlink WHERE fid=%d", rid) ){
    style_submenu_element("Check-ins Using", "%R/timeline?uf=%s", zUuid);
  }
  if( zMime ){
    if( fossil_strcmp(zMime, "text/html")==0 ){

Changes to src/name.c.

153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
**    eType==2    The youngest ancestor of RID that is on the branch
**                from which the branch containing RID diverged.
*/
int start_of_branch(int rid, int eType){
  Stmt q;
  int rc;
  int ans = rid;
  char *zBr = branch_of_rid(rid);
  db_prepare(&q,
    "SELECT pid, EXISTS(SELECT 1 FROM tagxref"
                       " WHERE tagid=%d AND tagtype>0"
                       "   AND value=%Q AND rid=plink.pid)"
    "  FROM plink"
    " WHERE cid=:cid AND isprim",
    TAG_BRANCH, zBr
  );
  fossil_free(zBr);
  do{
    db_reset(&q);
    db_bind_int(&q, ":cid", ans);
    rc = db_step(&q);
    if( rc!=SQLITE_ROW ) break;
    if( eType==1 && db_column_int(&q,1)==0 ) break;
    ans = db_column_int(&q, 0);
  }while( db_column_int(&q, 1)==1 && ans>0 );
  db_finalize(&q);
  if( eType==2 && ans>0 ){
    zBr = branch_of_rid(ans);
    ans = compute_youngest_ancestor_in_branch(rid, zBr);
    fossil_free(zBr);
  }
  return ans;
}

/*







|



















|







153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
**    eType==2    The youngest ancestor of RID that is on the branch
**                from which the branch containing RID diverged.
*/
int start_of_branch(int rid, int eType){
  Stmt q;
  int rc;
  int ans = rid;
  char *zBr = branch_of_ckin_rid(rid);
  db_prepare(&q,
    "SELECT pid, EXISTS(SELECT 1 FROM tagxref"
                       " WHERE tagid=%d AND tagtype>0"
                       "   AND value=%Q AND rid=plink.pid)"
    "  FROM plink"
    " WHERE cid=:cid AND isprim",
    TAG_BRANCH, zBr
  );
  fossil_free(zBr);
  do{
    db_reset(&q);
    db_bind_int(&q, ":cid", ans);
    rc = db_step(&q);
    if( rc!=SQLITE_ROW ) break;
    if( eType==1 && db_column_int(&q,1)==0 ) break;
    ans = db_column_int(&q, 0);
  }while( db_column_int(&q, 1)==1 && ans>0 );
  db_finalize(&q);
  if( eType==2 && ans>0 ){
    zBr = branch_of_ckin_rid(ans);
    ans = compute_youngest_ancestor_in_branch(rid, zBr);
    fossil_free(zBr);
  }
  return ans;
}

/*