235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
|
** cat FILE ... Concatenate the content of FILEs to stdout.
**
** edit FILE Bring up FILE in a text editor for modification.
**
** export FILE OUTPUT Write the content of FILE into OUTPUT on disk
**
** list | ls Show all unversioned files held in the local
** repository.
**
** revert ?URL? Restore the state of all unversioned files in the
** local repository to match the remote repository
** URL.
**
** Options:
** -v|--verbose Extra diagnostic output
** -n|--dryrun Show what would have happened
**
** remove|rm|delete FILE ...
** Remove unversioned files from the local repository.
** Changes are not pushed to other repositories until
** the next sync.
**
** sync ?URL? Synchronize the state of all unversioned files with
** the remote repository URL. The most recent version
** of each file is propagated to all repositories and
** all prior versions are permanently forgotten.
**
** Options:
|
|
>
>
>
|
>
>
>
|
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
|
** cat FILE ... Concatenate the content of FILEs to stdout.
**
** edit FILE Bring up FILE in a text editor for modification.
**
** export FILE OUTPUT Write the content of FILE into OUTPUT on disk
**
** list | ls Show all unversioned files held in the local
** repository. Options:
**
** --glob PATTERN Show only files that match
** --like PATTERN Show only files that match
**
** revert ?URL? Restore the state of all unversioned files in the
** local repository to match the remote repository
** URL.
**
** Options:
** -v|--verbose Extra diagnostic output
** -n|--dryrun Show what would have happened
**
** remove|rm|delete FILE ...
** Remove unversioned files from the local repository.
** Changes are not pushed to other repositories until
** the next sync. Options:
**
** --glob PATTERN Remove files that match
** --like PATTERN Remove files that match
**
** sync ?URL? Synchronize the state of all unversioned files with
** the remote repository URL. The most recent version
** of each file is propagated to all repositories and
** all prior versions are permanently forgotten.
**
** Options:
|
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
|
char *zCmd; /* Command to run the text editor */
Blob content; /* Content of the unversioned file */
verify_all_options();
if( g.argc!=4) usage("edit UVFILE");
zUVFile = g.argv[3];
zEditor = fossil_text_editor();
if( zEditor==0 ) fossil_fatal("no text editor - set the VISUAL env variable");
zTFile = fossil_temp_filename();
if( zTFile==0 ) fossil_fatal("cannot find a temporary filename");
db_begin_transaction();
content_rcvid_init("#!fossil unversioned edit");
if( unversioned_content(zUVFile, &content) ){
fossil_fatal("no such uv-file: %Q", zUVFile);
}
|
>
|
>
|
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
|
char *zCmd; /* Command to run the text editor */
Blob content; /* Content of the unversioned file */
verify_all_options();
if( g.argc!=4) usage("edit UVFILE");
zUVFile = g.argv[3];
zEditor = fossil_text_editor();
if( zEditor==0 ){
fossil_fatal("no text editor - set the VISUAL env variable");
}
zTFile = fossil_temp_filename();
if( zTFile==0 ) fossil_fatal("cannot find a temporary filename");
db_begin_transaction();
content_rcvid_init("#!fossil unversioned edit");
if( unversioned_content(zUVFile, &content) ){
fossil_fatal("no such uv-file: %Q", zUVFile);
}
|
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
|
/* Show the hash value used during uv sync */
int debugFlag = find_option("debug",0,0)!=0;
fossil_print("%s\n", unversioned_content_hash(debugFlag));
}else if( memcmp(zCmd, "list", nCmd)==0 || memcmp(zCmd, "ls", nCmd)==0 ){
Stmt q;
int allFlag = find_option("all","a",0)!=0;
int longFlag = find_option("l",0,0)!=0 || (nCmd>1 && zCmd[1]=='i');
verify_all_options();
if( !longFlag ){
if( allFlag ){
db_prepare(&q, "SELECT name FROM unversioned ORDER BY name");
}else{
db_prepare(&q, "SELECT name FROM unversioned WHERE hash IS NOT NULL"
" ORDER BY name");
}
while( db_step(&q)==SQLITE_ROW ){
fossil_print("%s\n", db_column_text(&q,0));
}
}else{
db_prepare(&q,
"SELECT hash, datetime(mtime,'unixepoch'), sz, length(content), name"
" FROM unversioned"
" ORDER BY name;"
);
while( db_step(&q)==SQLITE_ROW ){
const char *zHash = db_column_text(&q, 0);
const char *zNoContent = "";
if( zHash==0 ){
if( !allFlag ) continue;
zHash = "(deleted)";
|
>
>
>
>
>
>
>
>
>
>
>
>
|
>
|
>
|
|
|
|
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
|
/* Show the hash value used during uv sync */
int debugFlag = find_option("debug",0,0)!=0;
fossil_print("%s\n", unversioned_content_hash(debugFlag));
}else if( memcmp(zCmd, "list", nCmd)==0 || memcmp(zCmd, "ls", nCmd)==0 ){
Stmt q;
int allFlag = find_option("all","a",0)!=0;
int longFlag = find_option("l",0,0)!=0 || (nCmd>1 && zCmd[1]=='i');
char *zPattern = sqlite3_mprintf("true");
const char *zGlob;
zGlob = find_option("glob",0,1);
if( zGlob ){
sqlite3_free(zPattern);
zPattern = sqlite3_mprintf("(name GLOB %Q)", zGlob);
}
zGlob = find_option("like",0,1);
if( zGlob ){
sqlite3_free(zPattern);
zPattern = sqlite3_mprintf("(name LIKE %Q)", zGlob);
}
verify_all_options();
if( !longFlag ){
if( allFlag ){
db_prepare(&q, "SELECT name FROM unversioned WHERE %s ORDER BY name",
zPattern/*safe-for-%s*/);
}else{
db_prepare(&q, "SELECT name FROM unversioned"
" WHERE %s AND hash IS NOT NULL"
" ORDER BY name", zPattern/*safe-for-%s*/);
}
while( db_step(&q)==SQLITE_ROW ){
fossil_print("%s\n", db_column_text(&q,0));
}
}else{
db_prepare(&q,
"SELECT hash, datetime(mtime,'unixepoch'), sz, length(content), name"
" FROM unversioned WHERE %s"
" ORDER BY name;", zPattern/*safe-for-%s*/
);
while( db_step(&q)==SQLITE_ROW ){
const char *zHash = db_column_text(&q, 0);
const char *zNoContent = "";
if( zHash==0 ){
if( !allFlag ) continue;
zHash = "(deleted)";
|
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
|
db_column_int(&q,3),
db_column_text(&q,4),
zNoContent
);
}
}
db_finalize(&q);
}else if( memcmp(zCmd, "revert", nCmd)==0 ){
unsigned syncFlags = unversioned_sync_flags(SYNC_UNVERSIONED|SYNC_UV_REVERT);
g.argv[1] = "sync";
g.argv[2] = "--uv-noop";
sync_unversioned(syncFlags);
}else if( memcmp(zCmd, "remove", nCmd)==0 || memcmp(zCmd, "rm", nCmd)==0
|| memcmp(zCmd, "delete", nCmd)==0 ){
int i;
verify_all_options();
db_begin_transaction();
for(i=3; i<g.argc; i++){
db_multi_exec(
"UPDATE unversioned"
" SET hash=NULL, content=NULL, mtime=%lld, sz=0 WHERE name=%Q",
mtime, g.argv[i]
);
}
|
>
>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
|
db_column_int(&q,3),
db_column_text(&q,4),
zNoContent
);
}
}
db_finalize(&q);
sqlite3_free(zPattern);
}else if( memcmp(zCmd, "revert", nCmd)==0 ){
unsigned syncFlags =
unversioned_sync_flags(SYNC_UNVERSIONED|SYNC_UV_REVERT);
g.argv[1] = "sync";
g.argv[2] = "--uv-noop";
sync_unversioned(syncFlags);
}else if( memcmp(zCmd, "remove", nCmd)==0 || memcmp(zCmd, "rm", nCmd)==0
|| memcmp(zCmd, "delete", nCmd)==0 ){
int i;
const char *zGlob;
db_begin_transaction();
while( (zGlob = find_option("glob",0,1))!=0 ){
db_multi_exec(
"UPDATE unversioned"
" SET hash=NULL, content=NULL, mtime=%lld, sz=0 WHERE name GLOB %Q",
mtime, zGlob
);
}
while( (zGlob = find_option("like",0,1))!=0 ){
db_multi_exec(
"UPDATE unversioned"
" SET hash=NULL, content=NULL, mtime=%lld, sz=0 WHERE name LIKE %Q",
mtime, zGlob
);
}
verify_all_options();
for(i=3; i<g.argc; i++){
db_multi_exec(
"UPDATE unversioned"
" SET hash=NULL, content=NULL, mtime=%lld, sz=0 WHERE name=%Q",
mtime, g.argv[i]
);
}
|