Fossil

Check-in [2a4ab3b1]
Login

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

Overview
Comment:“delete” command, still can use “del” which is shorter and non ambiguous – ignore -wal and -shm files in repository root for adding, computing extras and closing repository, just in case
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | benoit
Files: files | file ages | folders
SHA1:2a4ab3b15134939be29e95799605ef472658a487
User & Date: benoit 2010-07-29 19:01:27
Context
2010-07-30
00:16
Merge change by Benoit Mortgat into the trunk. check-in: e3fb8dc3 user: drh tags: trunk
2010-07-29
19:01
“delete” command, still can use “del” which is shorter and non ambiguous – ignore -wal and -shm files in repository root for adding, computing extras and closing repository, just in case Closed-Leaf check-in: 2a4ab3b1 user: benoit tags: benoit
2010-07-28
02:38
Add a link to http://chiselapp.com/ on the homepage. check-in: 0e1ca296 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/add.c.

37
38
39
40
41
42
43


44
45


46
47
48
49
50
51
52
...
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
  const char *zPath;

  file_tree_name(zName, &pathname, 1);
  zPath = blob_str(&pathname);
  if( strcmp(zPath, "manifest")==0
   || strcmp(zPath, "_FOSSIL_")==0
   || strcmp(zPath, "_FOSSIL_-journal")==0


   || strcmp(zPath, ".fos")==0
   || strcmp(zPath, ".fos-journal")==0


   || strcmp(zPath, "manifest.uuid")==0
   || blob_compare(&pathname, pOmit)==0
  ){
    fossil_warning("cannot add %s", zPath);
  }else{
    if( !file_is_simple_pathname(zPath) ){
      fossil_fatal("filename contains illegal characters: %s", zPath);
................................................................................
  }
  closedir(d);
  blob_reset(&path);
}

/*
** COMMAND: rm
** COMMAND: del
**
** Usage: %fossil rm FILE...
**    or: %fossil del FILE...
**
** Remove one or more files from the tree.
**
** This command does not remove the files from disk.  It just marks the
** files as no longer being part of the project.  In other words, future
** changes to the named files will not be versioned.
*/
void del_cmd(void){
  int i;
  int vid;

  db_must_be_within_tree();
  vid = db_lget_int("checkout", 0);
  if( vid==0 ){
    fossil_panic("no checkout to remove from");







>
>


>
>







 







|


|







|







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
...
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
  const char *zPath;

  file_tree_name(zName, &pathname, 1);
  zPath = blob_str(&pathname);
  if( strcmp(zPath, "manifest")==0
   || strcmp(zPath, "_FOSSIL_")==0
   || strcmp(zPath, "_FOSSIL_-journal")==0
   || strcmp(zPath, "_FOSSIL_-wal")==0
   || strcmp(zPath, "_FOSSIL_-shm")==0
   || strcmp(zPath, ".fos")==0
   || strcmp(zPath, ".fos-journal")==0
   || strcmp(zPath, ".fos-wal")==0
   || strcmp(zPath, ".fos-shm")==0
   || strcmp(zPath, "manifest.uuid")==0
   || blob_compare(&pathname, pOmit)==0
  ){
    fossil_warning("cannot add %s", zPath);
  }else{
    if( !file_is_simple_pathname(zPath) ){
      fossil_fatal("filename contains illegal characters: %s", zPath);
................................................................................
  }
  closedir(d);
  blob_reset(&path);
}

/*
** COMMAND: rm
** COMMAND: delete
**
** Usage: %fossil rm FILE...
**    or: %fossil delete FILE...
**
** Remove one or more files from the tree.
**
** This command does not remove the files from disk.  It just marks the
** files as no longer being part of the project.  In other words, future
** changes to the named files will not be versioned.
*/
void delete_cmd(void){
  int i;
  int vid;

  db_must_be_within_tree();
  vid = db_lget_int("checkout", 0);
  if( vid==0 ){
    fossil_panic("no checkout to remove from");

Changes to src/checkin.c.

269
270
271
272
273
274
275
276


277
278
279
280
281
282
283
...
315
316
317
318
319
320
321
322


323
324
325
326
327
328
329
  if( zIgnoreFlag==0 ){
    zIgnoreFlag = db_get("ignore-glob", 0);
  }
  vfile_scan(0, &path, blob_size(&path), allFlag);
  db_prepare(&q, 
      "SELECT x FROM sfile"
      " WHERE x NOT IN ('manifest','manifest.uuid','_FOSSIL_',"
                         "'_FOSSIL_-journal','.fos','.fos-journal')"


      "   AND NOT %s"
      " ORDER BY 1",
      glob_expr("x", zIgnoreFlag)
  );
  if( file_tree_name(g.zRepositoryName, &repo, 0) ){
    db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
  }
................................................................................
  db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
  n = strlen(g.zLocalRoot);
  blob_init(&path, g.zLocalRoot, n-1);
  vfile_scan(0, &path, blob_size(&path), dotfilesFlag);
  db_prepare(&q, 
      "SELECT %Q || x FROM sfile"
      " WHERE x NOT IN ('manifest','manifest.uuid','_FOSSIL_',"
                       "'_FOSSIL_-journal','.fos','.fos-journal')"


      " ORDER BY 1", g.zLocalRoot);
  if( file_tree_name(g.zRepositoryName, &repo, 0) ){
    db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
  }
  while( db_step(&q)==SQLITE_ROW ){
    if( allFlag ){
      unlink(db_column_text(&q, 0));







|
>
>







 







|
>
>







269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
...
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
  if( zIgnoreFlag==0 ){
    zIgnoreFlag = db_get("ignore-glob", 0);
  }
  vfile_scan(0, &path, blob_size(&path), allFlag);
  db_prepare(&q, 
      "SELECT x FROM sfile"
      " WHERE x NOT IN ('manifest','manifest.uuid','_FOSSIL_',"
                       "'_FOSSIL_-journal','.fos','.fos-journal',"
                       "'_FOSSIL_-wal','_FOSSIL_-shm','.fos-wal',"
                       "'.fos-shm')"
      "   AND NOT %s"
      " ORDER BY 1",
      glob_expr("x", zIgnoreFlag)
  );
  if( file_tree_name(g.zRepositoryName, &repo, 0) ){
    db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
  }
................................................................................
  db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
  n = strlen(g.zLocalRoot);
  blob_init(&path, g.zLocalRoot, n-1);
  vfile_scan(0, &path, blob_size(&path), dotfilesFlag);
  db_prepare(&q, 
      "SELECT %Q || x FROM sfile"
      " WHERE x NOT IN ('manifest','manifest.uuid','_FOSSIL_',"
                       "'_FOSSIL_-journal','.fos','.fos-journal',"
                       "'_FOSSIL_-wal','_FOSSIL_-shm','.fos-wal',"
                       "'.fos-shm')"
      " ORDER BY 1", g.zLocalRoot);
  if( file_tree_name(g.zRepositoryName, &repo, 0) ){
    db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
  }
  while( db_step(&q)==SQLITE_ROW ){
    if( allFlag ){
      unlink(db_column_text(&q, 0));

Changes to src/checkout.c.

230
231
232
233
234
235
236


237
238


239
240
241
242
243
244
245
/*
** Unlink the local database file
*/
void unlink_local_database(void){
  static const char *azFile[] = {
     "%s_FOSSIL_",
     "%s_FOSSIL_-journal",


     "%s.fos",
     "%s.fos-journal",


  };
  int i;
  for(i=0; i<sizeof(azFile)/sizeof(azFile[0]); i++){
    char *z = mprintf(azFile[i], g.zLocalRoot);
    unlink(z);
    free(z);
  }







>
>


>
>







230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
/*
** Unlink the local database file
*/
void unlink_local_database(void){
  static const char *azFile[] = {
     "%s_FOSSIL_",
     "%s_FOSSIL_-journal",
     "%s_FOSSIL_-wal",
     "%s_FOSSIL_-shm",
     "%s.fos",
     "%s.fos-journal",
     "%s.fos-wal",
     "%s.fos-shm",
  };
  int i;
  for(i=0; i<sizeof(azFile)/sizeof(azFile[0]); i++){
    char *z = mprintf(azFile[i], g.zLocalRoot);
    unlink(z);
    free(z);
  }