Fossil SCM

start of "nop" no-operation command

bharder 2010-09-22 02:58 nop
Commit 46ea03734f8471e0790f994e23386e6a3cc88cd0
1 file changed +53
+53
--- src/add.c
+++ src/add.c
@@ -123,10 +123,17 @@
123123
add_one_file(zName, vid, pOmit);
124124
}
125125
db_finalize(&q);
126126
db_multi_exec("DELETE FROM sfile");
127127
}
128
+
129
+
130
+
131
+
132
+
133
+
134
+
128135
129136
/*
130137
** COMMAND: add
131138
**
132139
** Usage: %fossil add FILE...
@@ -224,10 +231,56 @@
224231
}
225232
}
226233
closedir(d);
227234
blob_reset(&path);
228235
}
236
+
237
+/*
238
+** COMMAND: nop
239
+**
240
+** Usage: %fossil nop FILE...
241
+**
242
+** Do nothing to one or more files from the tree.
243
+**
244
+** This command does not remove the files from disk. It just marks the
245
+** files as no longer being part of the project. In other words, future
246
+** changes to the named files will not be versioned.
247
+*/
248
+void nop_cmd(void){
249
+ int i;
250
+ int vid;
251
+
252
+ db_must_be_within_tree();
253
+ vid = db_lget_int("checkout", 0);
254
+ if( vid==0 ){
255
+ fossil_panic("no checkout to remove from");
256
+ }
257
+ db_begin_transaction();
258
+ for(i=2; i<g.argc; i++){
259
+ char *zName;
260
+
261
+ zName = mprintf("%/", g.argv[i]);
262
+ if( file_isdir(zName) == 1 ){
263
+ del_directory_content(zName);
264
+ } else {
265
+ char *zPath;
266
+ Blob pathname;
267
+ file_tree_name(zName, &pathname, 1);
268
+ zPath = blob_str(&pathname);
269
+ if( !db_exists(
270
+ "SELECT 1 FROM vfile WHERE pathname=%Q AND NOT deleted", zPath) ){
271
+ fossil_fatal("not in the repository: %s", zName);
272
+ }else{
273
+ db_multi_exec("UPDATE vfile SET deleted=0, changed=0 WHERE pathname=%Q", zPath);
274
+ printf("NOP %s\n", zPath);
275
+ }
276
+ blob_reset(&pathname);
277
+ }
278
+ free(zName);
279
+ }
280
+ db_end_transaction(0);
281
+}
229282
230283
/*
231284
** COMMAND: rm
232285
** COMMAND: delete
233286
** COMMAND: dismiss
234287
--- src/add.c
+++ src/add.c
@@ -123,10 +123,17 @@
123 add_one_file(zName, vid, pOmit);
124 }
125 db_finalize(&q);
126 db_multi_exec("DELETE FROM sfile");
127 }
 
 
 
 
 
 
 
128
129 /*
130 ** COMMAND: add
131 **
132 ** Usage: %fossil add FILE...
@@ -224,10 +231,56 @@
224 }
225 }
226 closedir(d);
227 blob_reset(&path);
228 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
229
230 /*
231 ** COMMAND: rm
232 ** COMMAND: delete
233 ** COMMAND: dismiss
234
--- src/add.c
+++ src/add.c
@@ -123,10 +123,17 @@
123 add_one_file(zName, vid, pOmit);
124 }
125 db_finalize(&q);
126 db_multi_exec("DELETE FROM sfile");
127 }
128
129
130
131
132
133
134
135
136 /*
137 ** COMMAND: add
138 **
139 ** Usage: %fossil add FILE...
@@ -224,10 +231,56 @@
231 }
232 }
233 closedir(d);
234 blob_reset(&path);
235 }
236
237 /*
238 ** COMMAND: nop
239 **
240 ** Usage: %fossil nop FILE...
241 **
242 ** Do nothing to one or more files from the tree.
243 **
244 ** This command does not remove the files from disk. It just marks the
245 ** files as no longer being part of the project. In other words, future
246 ** changes to the named files will not be versioned.
247 */
248 void nop_cmd(void){
249 int i;
250 int vid;
251
252 db_must_be_within_tree();
253 vid = db_lget_int("checkout", 0);
254 if( vid==0 ){
255 fossil_panic("no checkout to remove from");
256 }
257 db_begin_transaction();
258 for(i=2; i<g.argc; i++){
259 char *zName;
260
261 zName = mprintf("%/", g.argv[i]);
262 if( file_isdir(zName) == 1 ){
263 del_directory_content(zName);
264 } else {
265 char *zPath;
266 Blob pathname;
267 file_tree_name(zName, &pathname, 1);
268 zPath = blob_str(&pathname);
269 if( !db_exists(
270 "SELECT 1 FROM vfile WHERE pathname=%Q AND NOT deleted", zPath) ){
271 fossil_fatal("not in the repository: %s", zName);
272 }else{
273 db_multi_exec("UPDATE vfile SET deleted=0, changed=0 WHERE pathname=%Q", zPath);
274 printf("NOP %s\n", zPath);
275 }
276 blob_reset(&pathname);
277 }
278 free(zName);
279 }
280 db_end_transaction(0);
281 }
282
283 /*
284 ** COMMAND: rm
285 ** COMMAND: delete
286 ** COMMAND: dismiss
287

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button