Fossil

Changes On Branch viric_flavour
Login

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

Changes In Branch viric_flavour Excluding Merge-Ins

This is equivalent to a diff from 042ec2b9c3 to b31afcc2ca

2015-02-09
12:18
Add mime-types for openoffice documents. Cherry-picked from [/timeline?r=viric_flavour|viric_flavour] branch. Thanks! check-in: 04e6a82ed7 user: jan.nijtmans tags: trunk
11:00
viric's flavour of fossil, which includes the cherry-picked changes out of trunk: [d0b1b1114] [39e165afb] [dad37196f] [f309130a8]. This outdates the branch annotate_links ([f14798e0e3]), which has some extra changes, some hard to port. This lets the browser pick the right program to open them straight. Leaf check-in: b31afcc2ca user: viriketo tags: viric_flavour
10:56
Add a link in the checkin page to show the changes in the branch in respect to the parent branch. It finds the last merge from parent to the current branch for the comparison. check-in: f309130a8b user: viriketo tags: viric_pbranch
10:39
Fixing parentheses closing in the finfo page. check-in: 042ec2b9c3 user: viriketo tags: trunk
10:37
Show the branch in the checkin description (artifact and file diff pages). Leaf check-in: dad37196fb user: viriketo tags: viric_showbranch
10:30
New way to calculate the automatic branch colours. It's a matter of taste, but I prefer this way; the colours often become more different. Leaf check-in: 39e165afb3 user: viriketo tags: viric_newcolours
10:15
Add mime types for common opendocuments. This lets the browser pick the right program to open them straight. <strong>Update:</strong>Jan picked this change from viric_flavour, instead of merging this branch. So I close this, as we can consider this integrated. Closed-Leaf check-in: d0b1b1114e user: viriketo tags: viric_mimeopendocument
10:13
Omit unused c= parameters from hyperlinks in the /timeline. check-in: 65b729ac31 user: drh tags: trunk

Changes to src/doc.c.

180
181
182
183
184
185
186



187
188
189
190
191
192
193
  { "mpeg",       4, "video/mpeg"                        },
  { "mpg",        3, "video/mpeg"                        },
  { "mpga",       4, "audio/mpeg"                        },
  { "ms",         2, "application/x-troff-ms"            },
  { "msh",        3, "model/mesh"                        },
  { "nc",         2, "application/x-netcdf"              },
  { "oda",        3, "application/oda"                   },



  { "ogg",        3, "application/ogg"                   },
  { "ogm",        3, "application/ogg"                   },
  { "pbm",        3, "image/x-portable-bitmap"           },
  { "pdb",        3, "chemical/x-pdb"                    },
  { "pdf",        3, "application/pdf"                   },
  { "pgm",        3, "image/x-portable-graymap"          },
  { "pgn",        3, "application/x-chess-pgn"           },







>
>
>







180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
  { "mpeg",       4, "video/mpeg"                        },
  { "mpg",        3, "video/mpeg"                        },
  { "mpga",       4, "audio/mpeg"                        },
  { "ms",         2, "application/x-troff-ms"            },
  { "msh",        3, "model/mesh"                        },
  { "nc",         2, "application/x-netcdf"              },
  { "oda",        3, "application/oda"                   },
  { "odp",        3, "application/vnd.oasis.opendocument.presentation" },
  { "ods",        3, "application/vnd.oasis.opendocument.spreadsheet" },
  { "odt",        3, "application/vnd.oasis.opendocument.text" },
  { "ogg",        3, "application/ogg"                   },
  { "ogm",        3, "application/ogg"                   },
  { "pbm",        3, "image/x-portable-bitmap"           },
  { "pdb",        3, "chemical/x-pdb"                    },
  { "pdf",        3, "application/pdf"                   },
  { "pgm",        3, "image/x-portable-graymap"          },
  { "pgn",        3, "application/x-chess-pgn"           },

Changes to src/info.c.

672
673
674
675
676
677
678


679
680
681
682
683
684
685
      @ </td></tr>
      @ <tr><th>Other&nbsp;Links:</th>
      @   <td>
      @     %z(href("%R/tree?ci=%S",zUuid))files</a>
      @   | %z(href("%R/fileage?name=%S",zUuid))file ages</a>
      @   | %z(href("%R/tree?nofiles&type=tree&ci=%S",zUuid))folders</a>
      @   | %z(href("%R/artifact/%S",zUuid))manifest</a>


      if( g.perm.Write ){
        @   | %z(href("%R/ci_edit?r=%S",zUuid))edit</a>
      }
      @   </td>
      @ </tr>
      blob_reset(&projName);
    }







>
>







672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
      @ </td></tr>
      @ <tr><th>Other&nbsp;Links:</th>
      @   <td>
      @     %z(href("%R/tree?ci=%S",zUuid))files</a>
      @   | %z(href("%R/fileage?name=%S",zUuid))file ages</a>
      @   | %z(href("%R/tree?nofiles&type=tree&ci=%S",zUuid))folders</a>
      @   | %z(href("%R/artifact/%S",zUuid))manifest</a>
      @   | <a href="%s(g.zTop)/vdiff?from=pbranch:%S(zUuid)&to=%S(zUuid)">
      @           changes over parent branch</a>
      if( g.perm.Write ){
        @   | %z(href("%R/ci_edit?r=%S",zUuid))edit</a>
      }
      @   </td>
      @ </tr>
      blob_reset(&projName);
    }
905
906
907
908
909
910
911


912
913
914
915
916
917
918
919
920
921
922
923

924
925
926
927
928
929
930


931
932
933
934
935
936
937
** Output a description of a check-in
*/
static void checkin_description(int rid){
  Stmt q;
  db_prepare(&q,
    "SELECT datetime(mtime), coalesce(euser,user),"
    "       coalesce(ecomment,comment), uuid,"


    "      (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref"
    "        WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid"
    "          AND tagxref.rid=blob.rid AND tagxref.tagtype>0)"
    "  FROM event, blob"
    " WHERE event.objid=%d AND type='ci'"
    "   AND blob.rid=%d",
    rid, rid
  );
  while( db_step(&q)==SQLITE_ROW ){
    const char *zDate = db_column_text(&q, 0);
    const char *zUser = db_column_text(&q, 1);
    const char *zUuid = db_column_text(&q, 3);

    const char *zTagList = db_column_text(&q, 4);
    Blob comment;
    int wikiFlags = WIKI_INLINE|WIKI_NOBADLINKS;
    if( db_get_boolean("timeline-block-markup", 0)==0 ){
      wikiFlags |= WIKI_NOBLOCK;
    }
    hyperlink_to_uuid(zUuid);


    blob_zero(&comment);
    db_column_blob(&q, 2, &comment);
    wiki_convert(&comment, 0, wikiFlags);
    blob_reset(&comment);
    @ (user:
    hyperlink_to_user(zUser,zDate,",");
    if( zTagList && zTagList[0] && g.perm.Hyperlink ){







>
>






|





>







>
>







907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
** Output a description of a check-in
*/
static void checkin_description(int rid){
  Stmt q;
  db_prepare(&q,
    "SELECT datetime(mtime), coalesce(euser,user),"
    "       coalesce(ecomment,comment), uuid,"
    "       coalesce((SELECT value FROM tagxref"
    "        WHERE tagid=%d AND tagtype>0 AND rid=blob.rid),'trunk'),"
    "      (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref"
    "        WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid"
    "          AND tagxref.rid=blob.rid AND tagxref.tagtype>0)"
    "  FROM event, blob"
    " WHERE event.objid=%d AND type='ci'"
    "   AND blob.rid=%d",
    TAG_BRANCH, rid, rid
  );
  while( db_step(&q)==SQLITE_ROW ){
    const char *zDate = db_column_text(&q, 0);
    const char *zUser = db_column_text(&q, 1);
    const char *zUuid = db_column_text(&q, 3);
    const char *zBranch = db_column_text(&q, 4);
    const char *zTagList = db_column_text(&q, 4);
    Blob comment;
    int wikiFlags = WIKI_INLINE|WIKI_NOBADLINKS;
    if( db_get_boolean("timeline-block-markup", 0)==0 ){
      wikiFlags |= WIKI_NOBLOCK;
    }
    hyperlink_to_uuid(zUuid);
    @ on branch <a href="%R/timeline?r=%s(zBranch)&nd&c=%T(zDate)">
    @   %s(zBranch)</a> - 
    blob_zero(&comment);
    db_column_blob(&q, 2, &comment);
    wiki_convert(&comment, 0, wikiFlags);
    blob_reset(&comment);
    @ (user:
    hyperlink_to_user(zUser,zDate,",");
    if( zTagList && zTagList[0] && g.perm.Hyperlink ){

Changes to src/name.c.

179
180
181
182
183
184
185









186
187
188
189
190
191
192
    rid = db_int(0,
      "SELECT objid FROM event"
      " WHERE mtime<=julianday('%qz') AND type GLOB '%q'"
      " ORDER BY mtime DESC LIMIT 1",
      &zTag[4], zType);
    return rid;
  }










  /* "tag:" + symbolic-name */
  if( memcmp(zTag, "tag:", 4)==0 ){
    rid = db_int(0,
       "SELECT event.objid, max(event.mtime)"
       "  FROM tag, tagxref, event"
       " WHERE tag.tagname='sym-%q' "







>
>
>
>
>
>
>
>
>







179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
    rid = db_int(0,
      "SELECT objid FROM event"
      " WHERE mtime<=julianday('%qz') AND type GLOB '%q'"
      " ORDER BY mtime DESC LIMIT 1",
      &zTag[4], zType);
    return rid;
  }

  /* "parent:", as for parent branch. It returns the checkin of
     the last checkin of the parent branch that has been merged in. */
  if( memcmp(zTag, "pbranch:", 8)==0 ){
    int branchRid = symbolic_name_to_rid(&zTag[8], zType);
    if (branchRid == 0) return 0;
    rid = get_parent_branch_rid(branchRid);
    return rid;
  }

  /* "tag:" + symbolic-name */
  if( memcmp(zTag, "tag:", 4)==0 ){
    rid = db_int(0,
       "SELECT event.objid, max(event.mtime)"
       "  FROM tag, tagxref, event"
       " WHERE tag.tagname='sym-%q' "
1056
1057
1058
1059
1060
1061
1062


































































































**
** Show all phantom artifacts
*/
void test_phatoms_cmd(void){
  db_find_and_open_repository(0,0);
  describe_artifacts_to_stdout("IN (SELECT rid FROM blob WHERE size<0)", 0);
}









































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
**
** Show all phantom artifacts
*/
void test_phatoms_cmd(void){
  db_find_and_open_repository(0,0);
  describe_artifacts_to_stdout("IN (SELECT rid FROM blob WHERE size<0)", 0);
}



/*
** It returns the checkin of the last checkin of the parent branch that has
** been merged in.
*/
int get_parent_branch_rid(int ridRequested){
  Stmt s;
  const char *branchName;    /* Name of the branch requested at rid */
  const char *parentBranchName; /* Name of the parent branch */
  int rid;

  /* Get the name of the current branch */
  branchName = db_text(0,
    "SELECT value FROM tagxref"
    " WHERE tagid=%d"
    "   AND tagxref.tagtype>0"
    "   AND rid=%d",
    TAG_BRANCH, ridRequested);

  if ( !branchName )
    return 0;

  /* Find the name of the branch this was forked from */
  db_prepare(&s,
    "SELECT pid, tagxref.value FROM plink JOIN tagxref"
    " WHERE cid=:rid"
    "   AND isprim=1"
    "   AND tagxref.tagid=%d"
    "   AND tagxref.tagtype>0"
    "   AND tagxref.rid=pid",
    TAG_BRANCH);

  rid = ridRequested;
  while( rid > 0 ) {
    db_bind_int(&s, ":rid", rid);
    if ( db_step(&s) == SQLITE_ROW ) {
      rid = db_column_int(&s, 0);
      parentBranchName = db_column_text(&s, 1);
      if ( !parentBranchName ) {
        rid = 0;
        break;
      }

      if ( fossil_strcmp(parentBranchName, branchName) ) {
        parentBranchName = fossil_strdup(parentBranchName);
        break;
      }
    }else{
      rid = 0;
      break;
    }
    db_reset(&s);
  }
  db_finalize(&s);

  if (rid == 0)
      return 0;

  /* Find the last checkin coming from the parent branch */
  db_prepare(&s,
    "SELECT pid, tagxref.value FROM plink JOIN tagxref"
    " WHERE cid=:rid"
    "   AND tagxref.tagid=%d"
    "   AND tagxref.tagtype>0"
    "   AND tagxref.rid=pid ORDER BY isprim ASC",
    TAG_BRANCH);

  rid = ridRequested;
  while( rid > 0 ) {
    db_bind_int(&s, ":rid", rid);
    int found = 0;
    while ( db_step(&s) == SQLITE_ROW ) {
      const char *branchNamePid; /* Branch name of the pid */

      ++found;
      rid = db_column_int(&s, 0);
      branchNamePid = db_column_text(&s, 1);
      if ( !branchNamePid ) {
        break;
      }
      if ( fossil_strcmp(parentBranchName, branchNamePid)==0 ) {
        /* Found the last merge from the parent branch */
        db_finalize(&s);
        return rid;
      }
    }
    
    if (found == 0) {
      break;
    }
    db_reset(&s);
  }
  db_finalize(&s);

  return 0;
}

Changes to src/timeline.c.

100
101
102
103
104
105
106
107
108
109
110




111
112
113
114
115
116
117
118
119
120

121
122
123
124

125
126
127
128
129

130

131
132
133
134
135
136
137
138
139
140
141
142
143
/*
** Hash a string and use the hash to determine a background color.
*/
char *hash_color(const char *z){
  int i;                       /* Loop counter */
  unsigned int h = 0;          /* Hash on the branch name */
  int r, g, b;                 /* Values for red, green, and blue */
  int h1, h2, h3, h4;          /* Elements of the hash value */
  int mx, mn;                  /* Components of HSV */
  static char zColor[10];      /* The resulting color */
  static int ix[2] = {0,0};    /* Color chooser parameters */





  if( ix[0]==0 ){
    if( db_get_boolean("white-foreground", 0) ){
      ix[0] = 140;
      ix[1] = 40;
    }else{
      ix[0] = 216;
      ix[1] = 16;
    }
  }

  for(i=0; z[i]; i++ ){
    h = (h<<11) ^ (h<<1) ^ (h>>3) ^ z[i];
  }
  h1 = h % 6;  h /= 6;

  h3 = h % 30; h /= 30;
  h4 = h % 40; h /= 40;
  mx = ix[0] - h3;
  mn = mx - h4 - ix[1];
  h2 = (h%(mx - mn)) + mn;

  switch( h1 ){

    case 0:  r = mx; g = h2, b = mn;  break;
    case 1:  r = h2; g = mx, b = mn;  break;
    case 2:  r = mn; g = mx, b = h2;  break;
    case 3:  r = mn; g = h2, b = mx;  break;
    case 4:  r = h2; g = mn, b = mx;  break;
    default: r = mx; g = mn, b = h2;  break;
  }
  sqlite3_snprintf(8, zColor, "#%02x%02x%02x", r,g,b);
  return zColor;
}

/*
** COMMAND:  test-hash-color







<
<

|
>
>
>
>

|
|
<
<
<
<
<
|
<
>
|


|
>
|
|
|
|
<
>
|
>
|
|
|
<
<
<







100
101
102
103
104
105
106


107
108
109
110
111
112
113
114
115





116

117
118
119
120
121
122
123
124
125
126

127
128
129
130
131
132



133
134
135
136
137
138
139
/*
** Hash a string and use the hash to determine a background color.
*/
char *hash_color(const char *z){
  int i;                       /* Loop counter */
  unsigned int h = 0;          /* Hash on the branch name */
  int r, g, b;                 /* Values for red, green, and blue */


  static char zColor[10];      /* The resulting color */
  static int whitefg = -1;
  int cpc = 4;                 /* colours per component */
  int cfactor = 128/cpc;       /* Factor so n*cpc < 128 */
  int cmin = cfactor - 1;      /* Factor so the max component is 127
                                  and the min is different than the bg */

  if(whitefg = -1) 
    whitefg = db_get_boolean("white-foreground", 0);







  /* Calculate the hash based on the branch name */
  for(i=0; z[i]; i++){
    h = (h<<11) ^ (h<<1) ^ (h>>3) ^ z[i];
  }

  /* 'cpc' different random values per component, between 'cmin' and 127 */
  r = cmin + (h % cpc) * cfactor;  h /= cpc;
  g = cmin + (h % cpc) * cfactor;  h /= cpc;
  b = cmin + (h % cpc) * cfactor;  h /= cpc;


  /* In case of blackfg, get the inverse effect */
  if(!whitefg)
  {
      r = 255 - r;
      g = 255 - g;
      b = 255 - b;



  }
  sqlite3_snprintf(8, zColor, "#%02x%02x%02x", r,g,b);
  return zColor;
}

/*
** COMMAND:  test-hash-color