Fossil

Check-in [182adc02]
Login

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

Overview
Comment:Add 'unversioned remove' as an alias for 'unversioned rm'. Update and improve help text.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:182adc0290305cc16f58f4d5b64deae34f4e89a3
User & Date: mistachkin 2016-10-04 23:44:15
Context
2016-10-04
23:49
Add a Tcl script to act as a (fake) text editor for the test suite. check-in: b6a01114 user: mistachkin tags: trunk
23:44
Add 'unversioned remove' as an alias for 'unversioned rm'. Update and improve help text. check-in: 182adc02 user: mistachkin tags: trunk
23:32
The final newline must be retained for all test results. check-in: b045d077 user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/unversioned.c.

225
226
227
228
229
230
231
232

233
234
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
...
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
...
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
**
**    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
**
**    rm FILE ...          Remove an 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 propagate to all repositories and all
**                         prior versions are permanently forgotten.

**                         Options:
**                            -v|--verbose     Extra diagnostic output
**                            -n|--dryrun      Show what would have happened
**
**    touch FILE ...       Update the TIMESTAMP on all of the listed files
**
** Options:
**
**   --mtime TIMESTAMP     Use TIMESTAMP instead of "now" for "add" and "rm".

*/
void unversioned_cmd(void){
  const char *zCmd;
  int nCmd;
  const char *zMtime = find_option("mtime", 0, 1);
  sqlite3_int64 mtime;
  db_find_and_open_repository(0, 0);
................................................................................
    }
    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, "rm", 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",
................................................................................
        "UPDATE unversioned SET mtime=%lld WHERE name=%Q",
        mtime, g.argv[i]
      );
    }
    db_unset("uv-hash", 0);
    db_end_transaction(0);
  }else{
    usage("add|cat|edit|export|ls|revert|rm|sync|touch");
  }
}

/*
** WEBPAGE: uvlist
**
** Display a list of all unversioned files in the repository.







|
>

|
|
>
>




|

|


|
|
|
>








|
>







 







|







 







|







225
226
227
228
229
230
231
232
233
234
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
...
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
...
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
**
**    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 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 propagate to all repositories and
**                         all prior versions are permanently forgotten.
**
**                         Options:
**                            -v|--verbose     Extra diagnostic output
**                            -n|--dryrun      Show what would have happened
**
**    touch FILE ...       Update the TIMESTAMP on all of the listed files
**
** Options:
**
**   --mtime TIMESTAMP     Use TIMESTAMP instead of "now" for the "add",
**                         "edit", and "remove" subcommands.
*/
void unversioned_cmd(void){
  const char *zCmd;
  int nCmd;
  const char *zMtime = find_option("mtime", 0, 1);
  sqlite3_int64 mtime;
  db_find_and_open_repository(0, 0);
................................................................................
    }
    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 ){
    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",
................................................................................
        "UPDATE unversioned SET mtime=%lld WHERE name=%Q",
        mtime, g.argv[i]
      );
    }
    db_unset("uv-hash", 0);
    db_end_transaction(0);
  }else{
    usage("add|cat|edit|export|list|revert|remove|sync|touch");
  }
}

/*
** WEBPAGE: uvlist
**
** Display a list of all unversioned files in the repository.