Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Change the "revert" command so that it will take multiple file arguments and revert each one. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
353297a149b49964445783d5e9e3bbb6 |
| User & Date: | drh 2009-12-17 14:21:58.000 |
Context
|
2009-12-17
| ||
| 14:27 | Change the "ls" command so that it only shows the filenames by default. To see the extra information about the status of each file, add the -l option. Ex: "fossil ls -l" check-in: 9c06ea3120 user: drh tags: trunk | |
| 14:21 | Change the "revert" command so that it will take multiple file arguments and revert each one. check-in: 353297a149 user: drh tags: trunk | |
|
2009-12-16
| ||
| 02:02 | Improvements to some comments in vfile.c. check-in: 2f15cd805e user: drh tags: trunk | |
Changes
Changes to src/update.c.
| ︙ | ︙ | |||
271 272 273 274 275 276 277 | return 0; } /* ** COMMAND: revert ** | | | > | | | > | < | < | | | | | | | | | | | > | | | | | | | | | | | | | | | | | > > | 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 |
return 0;
}
/*
** COMMAND: revert
**
** Usage: %fossil revert ?--yes? ?-r REVISION? FILE ...
**
** Revert to the current repository version of FILE, or to
** the version associated with baseline REVISION if the -r flag
** appears. This command will confirm your operation unless the
** file is missing or the --yes option is used.
**/
void revert_cmd(void){
char *zFile;
const char *zRevision;
Blob fname;
Blob record;
Blob ans;
int i;
int rid = 0, yesRevert;
yesRevert = find_option("yes", "y", 0)!=0;
zRevision = find_option("revision", "r", 1);
verify_all_options();
if( g.argc<3 ){
usage("?OPTIONS FILE ...");
}
db_must_be_within_tree();
for(i=2; i<g.argc; i++){
zFile = mprintf("%/", g.argv[i]);
file_tree_name(zFile, &fname, 1);
if( access(zFile, 0) ) yesRevert = 1;
if( yesRevert==0 ){
char *prompt = mprintf("revert file %B? this will"
" destroy local changes (y/N)? ",
&fname);
blob_zero(&ans);
prompt_user(prompt, &ans);
free( prompt );
if( blob_str(&ans)[0]=='y' ){
yesRevert = 1;
}
blob_reset(&ans);
}
if( yesRevert==1 && zRevision!=0 ){
historical_version_of_file(zRevision, zFile, &record);
}else if( yesRevert==1 ){
rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B", &fname);
if( rid==0 ){
fossil_panic("no history for file: %b", &fname);
}
content_get(rid, &record);
}
if( yesRevert==1 ){
blob_write_to_file(&record, zFile);
printf("%s reverted\n", zFile);
blob_reset(&record);
blob_reset(&fname);
}else{
printf("revert canceled\n");
}
free(zFile);
}
}
|