273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
|
** The --latest flag can be used in place of VERSION to checkout the
** latest version in the repository.
**
** Options:
** --force Ignore edited files in the current checkout
** --keep Only update the manifest and manifest.uuid files
** --force-missing Force checkout even if content is missing
**
** See also: update
*/
void checkout_cmd(void){
int forceFlag; /* Force checkout even if edits exist */
int forceMissingFlag; /* Force checkout even if missing content */
int keepFlag; /* Do not change any files on disk */
int latestFlag; /* Checkout the latest version */
char *zVers; /* Version to checkout */
int promptFlag; /* True to prompt before overwriting */
int vid, prior;
Blob cksum1, cksum1b, cksum2;
db_must_be_within_tree();
db_begin_write();
forceFlag = find_option("force","f",0)!=0;
forceMissingFlag = find_option("force-missing",0,0)!=0;
keepFlag = find_option("keep",0,0)!=0;
latestFlag = find_option("latest",0,0)!=0;
promptFlag = find_option("prompt",0,0)!=0 || forceFlag==0;
/* We should be done with options.. */
verify_all_options();
if( (latestFlag!=0 && g.argc!=2) || (latestFlag==0 && g.argc!=3) ){
usage("VERSION|--latest ?--force? ?--keep?");
}
|
>
>
>
>
>
|
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
** The --latest flag can be used in place of VERSION to checkout the
** latest version in the repository.
**
** Options:
** --force Ignore edited files in the current checkout
** --keep Only update the manifest and manifest.uuid files
** --force-missing Force checkout even if content is missing
** --setmtime Set timestamps of all files to match their SCM-side
** times (the timestamp of the last checkin which modified
** them).
**
** See also: update
*/
void checkout_cmd(void){
int forceFlag; /* Force checkout even if edits exist */
int forceMissingFlag; /* Force checkout even if missing content */
int keepFlag; /* Do not change any files on disk */
int latestFlag; /* Checkout the latest version */
char *zVers; /* Version to checkout */
int promptFlag; /* True to prompt before overwriting */
int vid, prior;
int setmtimeFlag; /* --setmtime. Set mtimes on files */
Blob cksum1, cksum1b, cksum2;
db_must_be_within_tree();
db_begin_write();
forceFlag = find_option("force","f",0)!=0;
forceMissingFlag = find_option("force-missing",0,0)!=0;
keepFlag = find_option("keep",0,0)!=0;
latestFlag = find_option("latest",0,0)!=0;
promptFlag = find_option("prompt",0,0)!=0 || forceFlag==0;
setmtimeFlag = find_option("setmtime",0,0)!=0;
/* We should be done with options.. */
verify_all_options();
if( (latestFlag!=0 && g.argc!=2) || (latestFlag==0 && g.argc!=3) ){
usage("VERSION|--latest ?--force? ?--keep?");
}
|
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
|
" ORDER BY event.mtime DESC");
if( zVers==0 ){
zVers = db_text(0, "SELECT uuid FROM event, blob"
" WHERE event.objid=blob.rid AND event.type='ci'"
" ORDER BY event.mtime DESC");
}
if( zVers==0 ){
return;
}
}else{
zVers = g.argv[2];
}
vid = load_vfile(zVers, forceMissingFlag);
if( prior==vid ){
db_end_transaction(0);
return;
}
if( !keepFlag ){
uncheckout(prior);
}
db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid);
|
>
>
|
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
|
" ORDER BY event.mtime DESC");
if( zVers==0 ){
zVers = db_text(0, "SELECT uuid FROM event, blob"
" WHERE event.objid=blob.rid AND event.type='ci'"
" ORDER BY event.mtime DESC");
}
if( zVers==0 ){
db_end_transaction(0);
return;
}
}else{
zVers = g.argv[2];
}
vid = load_vfile(zVers, forceMissingFlag);
if( prior==vid ){
if( setmtimeFlag ) vfile_check_signature(vid, CKSIG_SETMTIME);
db_end_transaction(0);
return;
}
if( !keepFlag ){
uncheckout(prior);
}
db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid);
|
353
354
355
356
357
358
359
360
361
362
363
364
365
366
|
if( blob_compare(&cksum1, &cksum2) ){
fossil_print("WARNING: manifest checksum does not agree with disk\n");
}
if( blob_size(&cksum1b) && blob_compare(&cksum1, &cksum1b) ){
fossil_print("WARNING: manifest checksum does not agree with manifest\n");
}
}
db_end_transaction(0);
}
/*
** Unlink the local database file
*/
static void unlink_local_database(int manifestOnly){
|
>
|
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
|
if( blob_compare(&cksum1, &cksum2) ){
fossil_print("WARNING: manifest checksum does not agree with disk\n");
}
if( blob_size(&cksum1b) && blob_compare(&cksum1, &cksum1b) ){
fossil_print("WARNING: manifest checksum does not agree with manifest\n");
}
}
if( setmtimeFlag ) vfile_check_signature(vid, CKSIG_SETMTIME);
db_end_transaction(0);
}
/*
** Unlink the local database file
*/
static void unlink_local_database(int manifestOnly){
|