Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | added experimental IMPORT command (ticket [e0352240ad]) |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | wolfgangHelpCmd |
| Files: | files | file ages | folders |
| SHA1: |
b37d5f256e207b92d233db367cee793d |
| User & Date: | wolfgang 2010-10-13 19:40:04.000 |
| Original Comment: | added experimental IMPORT command |
References
|
2010-10-14
| ||
| 18:47 | • Ticket [e0352240ad] Support for importing vendor source status still Open with 1 other change ... (artifact: db8c219c92 user: wolfgang) | |
|
2010-10-13
| ||
| 19:44 | • Ticket [e0352240ad]: 1 change ... (artifact: 7540fb62d2 user: wolfgang) | |
| 19:44 | • Ticket [e0352240ad]: 1 change ... (artifact: 9167a341f2 user: wolfgang) | |
Context
|
2010-10-14
| ||
| 18:41 | rename import to addremove ... (check-in: 7e65c703c0 user: wolfgang tags: wolfgangHelpCmd) | |
|
2010-10-13
| ||
| 19:40 | added experimental IMPORT command (ticket [e0352240ad]) ... (check-in: b37d5f256e user: wolfgang tags: wolfgangHelpCmd) | |
|
2010-10-11
| ||
| 15:49 | merge from trunk ... (check-in: c9df947761 user: wolfgang tags: wolfgangHelpCmd) | |
Changes
Changes to src/add.c.
| ︙ | ︙ | |||
267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
printf("DELETED %s\n", zPath);
}
blob_reset(&pathname);
}
free(zName);
}
db_multi_exec("DELETE FROM vfile WHERE deleted AND rid=0");
db_end_transaction(0);
}
/*
** Rename a single file.
**
** The original name of the file is zOrig. The new filename is zNew.
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 267 268 269 270 271 272 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 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 |
printf("DELETED %s\n", zPath);
}
blob_reset(&pathname);
}
free(zName);
}
db_multi_exec("DELETE FROM vfile WHERE deleted AND rid=0");
db_end_transaction(0);
}
/*
** COMMAND: import ?--dotfiles? ?--ignore GLOBPATTERN?
**
** Usage: %fossil import
**
** If used in a checkout, the current checkout file tree is synchronized
** with the repository:
** * all files, existing in the file tree but not in the repository
** (files displayed using the <a>extra</a> command)
** are added to the repository - see also <a>add</a>
** * all files, existing in the repository, not existing in the file tree
** (files displayed as MISSING using the <a>status</a> command)
** are removed from the repository - see also <a>rm</a>
** The command does not <a>commit</a>!
**
** This command can be used to track third party software.
*/
void import_cmd(void){
Blob path;
const char *zIgnoreFlag = find_option("ignore",0,1);
int allFlag = find_option("dotfiles",0,0)!=0;
int n;
Stmt q;
int vid;
Blob repo;
int addons = 0;
int deletes = 0;
if( zIgnoreFlag==0 ){
zIgnoreFlag = db_get("ignore-glob", 0);
}
db_must_be_within_tree();
vid = db_lget_int("checkout",0);
if( vid==0 ){
fossil_panic("no checkout to add to");
}
db_begin_transaction();
db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)");
n = strlen(g.zLocalRoot);
blob_init(&path, g.zLocalRoot, n-1);
/* now we read the complete file structure into a temp table */
vfile_scan(0, &path, blob_size(&path), allFlag);
if( file_tree_name(g.zRepositoryName, &repo, 0) ){
db_multi_exec("DELETE FROM sfile WHERE x=%B", &repo);
}
printf("importing checkout root '%s'\ninto repository '%s':\n",
g.zLocalRoot,g.zRepositoryName);
/* step 1: search for extra files */
db_prepare(&q,
"SELECT x, %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')"
" AND NOT %s"
" ORDER BY 1",
g.zLocalRoot,
glob_expr("x", zIgnoreFlag)
);
while( db_step(&q)==SQLITE_ROW ){
Blob omit;
blob_zero(&omit);
add_one_file(db_column_text(&q, 1), vid, &omit);
addons++;
}
db_finalize(&q);
/* step 2: search for missing files */
db_prepare(&q,
"SELECT pathname,%Q || pathname,deleted FROM vfile"
" WHERE deleted!=1"
" ORDER BY 1",
g.zLocalRoot
);
while( db_step(&q)==SQLITE_ROW ){
const char * zFile;
const char * zPath;
zFile = db_column_text(&q, 0);
zPath = db_column_text(&q, 1);
if( !file_isfile(zPath) ){
db_multi_exec("UPDATE vfile SET deleted=1 WHERE pathname=%Q", zFile);
printf("DELETED %s\n", zFile);
deletes--;
}
}
db_finalize(&q);
/* show cmmand summary */
printf("added %d files, deleted %d files\n",addons,deletes);
db_end_transaction(0);
}
/*
** Rename a single file.
**
** The original name of the file is zOrig. The new filename is zNew.
|
| ︙ | ︙ |
Changes to src/checkin.c.
| ︙ | ︙ | |||
99 100 101 102 103 104 105 | /* ** COMMAND: changes ** ** Usage: %fossil changes ** ** Report on the edit status of all files in the current checkout. | > | > > | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
/*
** COMMAND: changes
**
** Usage: %fossil changes
**
** Report on the edit status of all files in the current checkout.
**
** See also the <a>status</a>, <a>extra</a> and <a>import</a> commands.
*/
void changes_cmd(void){
Blob report;
int vid;
db_must_be_within_tree();
blob_zero(&report);
vid = db_lget_int("checkout", 0);
vfile_check_signature(vid, 0);
status_report(&report, "", 0);
blob_write_to_file(&report, "-");
}
/*
** COMMAND: status
**
** Usage: %fossil status
**
** Report on the status of the current checkout.
**
** See also <a>import</a>
*/
void status_cmd(void){
int vid;
db_must_be_within_tree();
/* 012345678901234 */
printf("repository: %s\n", db_lget("repository",""));
printf("local-root: %s\n", g.zLocalRoot);
|
| ︙ | ︙ | |||
249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
** Usage: %fossil extras ?--dotfiles? ?--ignore GLOBPATTERN?
**
** Print a list of all files in the source tree that are not part of
** the current checkout. See also the <a>clean</a> command.
**
** Files and subdirectories whose names begin with "." are normally
** ignored but can be included by adding the --dotfiles option.
*/
void extra_cmd(void){
Blob path;
Blob repo;
Stmt q;
int n;
const char *zIgnoreFlag = find_option("ignore",0,1);
| > > | 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
** Usage: %fossil extras ?--dotfiles? ?--ignore GLOBPATTERN?
**
** Print a list of all files in the source tree that are not part of
** the current checkout. See also the <a>clean</a> command.
**
** Files and subdirectories whose names begin with "." are normally
** ignored but can be included by adding the --dotfiles option.
**
** See also <a>import</a>
*/
void extra_cmd(void){
Blob path;
Blob repo;
Stmt q;
int n;
const char *zIgnoreFlag = find_option("ignore",0,1);
|
| ︙ | ︙ |