Fossil

Check-in [c27f646f25]
Login

Check-in [c27f646f25]

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

Overview
Comment:The new /artifact View and Tip buttons were always referring to "trunk" because we were passing a file RID to a function that expected a commit RID. Added a new branch_of_file_rid() function to parallel the branch_of_rid() function we were incorrectly calling to fix it. Also squished a memory leak.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | artifact-view-links
Files: files | file ages | folders
SHA3-256: c27f646f2542e4a6275e8819d51071e828b45e61144ce11e569d1effe1dcf6b2
User & Date: wyoung 2020-05-06 08:20:39.155
Context
2020-05-06
08:44
Fixed a typo. ... (check-in: d43afe59f3 user: wyoung tags: artifact-view-links)
08:20
The new /artifact View and Tip buttons were always referring to "trunk" because we were passing a file RID to a function that expected a commit RID. Added a new branch_of_file_rid() function to parallel the branch_of_rid() function we were incorrectly calling to fix it. Also squished a memory leak. ... (check-in: c27f646f25 user: wyoung tags: artifact-view-links)
07:38
Added "Tip" and "View" links to submenu of /artifact pages to get corresponding /file and /doc links to the same file on the same branch, giving different views of this same file data. ... (check-in: a9dda382bf user: wyoung tags: artifact-view-links)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/branch.c.
30
31
32
33
34
35
36


























37
38
39
40
41
42
43
*/
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 ){







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







30
31
32
33
34
35
36
37
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
*/
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 ){
    static char *zMain = 0;
    if( zMain==0 ) zMain = db_get("main-branch",0);
    zBr = fossil_strdup(zMain);
  }
  return zBr;
}

/*
** Same as branch_of_rid() except that it takes a file RID, not a
** check-in RID.
*/
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.
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255

2256
2257
2258
2259
2260
2261
2262
      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_rid(rid);
  if( zBr && zBr[0] ){
    style_submenu_element("View", "%R/doc/%T/%T",
                           zBr, blob_str(&downloadName));
    style_submenu_element("Tip", "%R/file/%%?ci=%T",
                           blob_str(&downloadName), zBr);

  }
  style_submenu_element("Download", "%R/raw/%T?name=%s",
                         blob_str(&downloadName), zUuid);
  if( db_exists("SELECT 1 FROM mlink WHERE fid=%d", rid) ){
    style_submenu_element("Check-ins Using", "%R/timeline?n=200&uf=%s", zUuid);
  }
  zMime = mimetype_from_name(blob_str(&downloadName));







|





>







2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
      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/%%?ci=%T",
                           blob_str(&downloadName), zBr);
    fossil_free((void *)zBr);
  }
  style_submenu_element("Download", "%R/raw/%T?name=%s",
                         blob_str(&downloadName), zUuid);
  if( db_exists("SELECT 1 FROM mlink WHERE fid=%d", rid) ){
    style_submenu_element("Check-ins Using", "%R/timeline?n=200&uf=%s", zUuid);
  }
  zMime = mimetype_from_name(blob_str(&downloadName));