Fossil

Check-in [9a2c75fc]
Login

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

Overview
Comment:Started work on allowing manifest.tags to automatically be created containing the checkout's tags. Repurposed the manifest setting slightly allowing manifest and manifest.uuid to be toggled individually, but keeping backwards compatibility.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | jan-manifest-tags
Files: files | file ages | folders
SHA1:9a2c75fc1cb557fe713d129ae2a8d2e10163f0df
User & Date: jan 2016-01-03 20:58:53
Context
2016-01-03
21:16
Change manifest setting to a non-boolean. check-in: 87a15475 user: jan tags: jan-manifest-tags
20:58
Started work on allowing manifest.tags to automatically be created containing the checkout's tags. Repurposed the manifest setting slightly allowing manifest and manifest.uuid to be toggled individually, but keeping backwards compatibility. check-in: 9a2c75fc user: jan tags: jan-manifest-tags
2016-01-01
17:30
Update the built-in SQLite to the second beta for 3.10.0. check-in: 987a80ef user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/checkout.c.

125
126
127
128
129
130
131



132
133
134
135
136


137
138



139
140
141
142
143
144

145

146


147
148
149
150
151








152
153
154
155
156
157
158
159
160
161
162




163
164
165



















166
167
168
169
170
171
172
}


/*
** If the "manifest" setting is true, then automatically generate
** files named "manifest" and "manifest.uuid" containing, respectively,
** the text of the manifest and the artifact ID of the manifest.



*/
void manifest_to_disk(int vid){
  char *zManFile;
  Blob manifest;
  Blob hash;



  if( db_get_boolean("manifest",0) ){



    blob_zero(&manifest);
    content_get(vid, &manifest);
    zManFile = mprintf("%smanifest", g.zLocalRoot);
    blob_zero(&hash);
    sha1sum_blob(&manifest, &hash);
    sterilize_manifest(&manifest);

    blob_write_to_file(&manifest, zManFile);

    free(zManFile);


    zManFile = mprintf("%smanifest.uuid", g.zLocalRoot);
    blob_append(&hash, "\n", 1);
    blob_write_to_file(&hash, zManFile);
    free(zManFile);
    blob_reset(&hash);








  }else{
    if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest'") ){
      zManFile = mprintf("%smanifest", g.zLocalRoot);
      file_delete(zManFile);
      free(zManFile);
    }
    if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest.uuid'") ){
      zManFile = mprintf("%smanifest.uuid", g.zLocalRoot);
      file_delete(zManFile);
      free(zManFile);
    }




  }

}




















/*
** COMMAND: checkout*
** COMMAND: co*
**
** Usage: %fossil checkout ?VERSION | --latest? ?OPTIONS?
**    or: %fossil co ?VERSION | --latest? ?OPTIONS?







>
>
>





>
>

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











>
>
>
>
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142

143
144
145
146
147
148
149
150
151
152
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
}


/*
** If the "manifest" setting is true, then automatically generate
** files named "manifest" and "manifest.uuid" containing, respectively,
** the text of the manifest and the artifact ID of the manifest.
** If the manifest setting is set, but is not a boolean value, then treat
** each character as a flag to enable writing "manifest", "manifest.uuid" or
** "manifest.tags".
*/
void manifest_to_disk(int vid){
  char *zManFile;
  Blob manifest;
  Blob hash;
  Blob taglist;
  int flg;


  flg = db_get_manifest_setting();
  if( flg ){
    if( flg & (MFESTFLG_RAW|MFESTFLG_UUID) ){
      blob_zero(&manifest);
      content_get(vid, &manifest);
      zManFile = mprintf("%smanifest", g.zLocalRoot);
      blob_zero(&hash);
      sha1sum_blob(&manifest, &hash);
      sterilize_manifest(&manifest);
		if( flg & MFESTFLG_RAW ){
        blob_write_to_file(&manifest, zManFile);
      }
      free(zManFile);
    }
	 if( flg & MFESTFLG_UUID ){
      zManFile = mprintf("%smanifest.uuid", g.zLocalRoot);
      blob_append(&hash, "\n", 1);
      blob_write_to_file(&hash, zManFile);
      free(zManFile);
      blob_reset(&hash);
    }
	 if( flg & MFESTFLG_TAGS ){
      blob_zero(&taglist);
      zManFile = mprintf("%smanifest.tags", g.zLocalRoot);
      get_checkin_taglist(vid, &taglist);
      blob_write_to_file(&taglist, zManFile);
      free(zManFile);
    }
  }else{
    if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest'") ){
      zManFile = mprintf("%smanifest", g.zLocalRoot);
      file_delete(zManFile);
      free(zManFile);
    }
    if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest.uuid'") ){
      zManFile = mprintf("%smanifest.uuid", g.zLocalRoot);
      file_delete(zManFile);
      free(zManFile);
    }
    if( !db_exists("SELECT 1 FROM vfile WHERE pathname='manifest.tags'") ){
      zManFile = mprintf("%smanifest.tags", g.zLocalRoot);
      file_delete(zManFile);
      free(zManFile);
    }
  }

}

void get_checkin_taglist(int rid, Blob *pOut){
  char *zTags;
  Stmt stmt;
  blob_reset(pOut);
  db_prepare(&stmt, "SELECT substr(tagname, 5)"
                    "  FROM tagxref, tag"
                    " WHERE tagxref.rid=%d"
                    "   AND tag.tagid=tagxref.tagid"
                    "   AND tag.tagname GLOB 'sym-*'", rid);
  while( db_step(&stmt)==SQLITE_ROW ){
    const char *zName;
    zName = db_column_text(&stmt, 0);
    blob_appendf(pOut, "%s\n", zName);
  }
  db_reset(&stmt);
}


/*
** COMMAND: checkout*
** COMMAND: co*
**
** Usage: %fossil checkout ?VERSION | --latest? ?OPTIONS?
**    or: %fossil co ?VERSION | --latest? ?OPTIONS?

Changes to src/db.c.

2204
2205
2206
2207
2208
2209
2210



































2211
2212
2213
2214
2215
2216
2217
}
int db_lget_int(const char *zName, int dflt){
  return db_int(dflt, "SELECT value FROM vvar WHERE name=%Q", zName);
}
void db_lset_int(const char *zName, int value){
  db_multi_exec("REPLACE INTO vvar(name,value) VALUES(%Q,%d)", zName, value);
}




































/*
** Record the name of a local repository in the global_config() database.
** The repository filename %s is recorded as an entry with a "name" field
** of the following form:
**
**       repo:%s







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







2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
}
int db_lget_int(const char *zName, int dflt){
  return db_int(dflt, "SELECT value FROM vvar WHERE name=%Q", zName);
}
void db_lset_int(const char *zName, int value){
  db_multi_exec("REPLACE INTO vvar(name,value) VALUES(%Q,%d)", zName, value);
}

#if INTERFACE
/* Manifest generation flags */
#define MFESTFLG_RAW  0x01
#define MFESTFLG_UUID 0x02
#define MFESTFLG_TAGS 0x04
#endif /* INTERFACE */

/*
** Get the manifest setting.  For backwards compatibility first check if the
** value is a boolean.  If it's not a boolean, treat each character as a flag
** to enable a manifest type.  This system puts certain boundary conditions on
** which letters can be used to represent flags (any permutation fo flags must
** not be able to fully form one of the boolean values).
*/
int db_get_manifest_setting(void){
  int flg;
  char *zVal = db_get("manifest", "off");
  if( is_false(zVal) ){
    return 0;
  }else if( is_truth(zVal) ) {
    return MFESTFLG_RAW|MFESTFLG_UUID;
  }
  flg = 0;
  while( *zVal ){
   switch( *zVal ){
     case 'r': flg |= MFESTFLG_RAW;  break;
     case 'u': flg |= MFESTFLG_UUID; break;
     case 't': flg |= MFESTFLG_TAGS; break;
    }
    zVal++;
  }
  return flg;
}


/*
** Record the name of a local repository in the global_config() database.
** The repository filename %s is recorded as an entry with a "name" field
** of the following form:
**
**       repo:%s