Overview
SHA1 Hash: | 255bacf9078d3c4c4b6fdf1cf6ac95e5e038e1d6 |
---|---|
Date: | 2007-09-24 17:11:51 |
User: | jnc |
Comment: | Added revert command, currently only offering revert to current version. Organized todo.txt a bit, added new bug report |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified src/update.c from [c90f6451d9] to [7eb6f9c777].
@@ -210,6 +210,60 @@ */ db_multi_exec("DELETE FROM vfile WHERE vid!=%d", tid); manifest_to_disk(tid); db_lset_int("checkout", tid); db_end_transaction(0); +} + +/* +** COMMAND: revert +** +** Usage: %fossil revert ?-yes FILE +** +** Revert to the current repository version of FILE. This +** command will confirm your operation, unless you do so +** at the command line via the -yes option. +**/ +void revert_cmd(void){ + const char *zFile; + Blob fname; + Blob record; + Blob ans; + int rid, yesRevert; + + yesRevert = find_option("yes","y", 0)!=0; + verify_all_options(); + + if( g.argc<3 ){ + usage("?OPTIONS FILE"); + } + db_must_be_within_tree(); + + zFile = g.argv[g.argc-1]; + if( !file_tree_name(zFile, &fname) ){ + fossil_panic("unknown file: %s", zFile); + } + rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B", &fname); + + if( rid==0 ){ + fossil_panic("no history for file: %b", &fname); + } + + if( yesRevert==0 ){ + char *prompt = mprintf("revert file %B? this will destroy local changes [y/N]? ", + &fname); + blob_zero(&ans); + prompt_user(prompt, &ans); + if( blob_str(&ans)[0]=='y' ){ + yesRevert = 1; + } + } + if( yesRevert==1 ){ + content_get(rid, &record); + blob_write_to_file(&record, blob_str(&fname)); + printf("%s reverted\n", blob_str(&fname)); + blob_reset(&record); + blob_reset(&fname); + }else{ + printf("revert canceled\n"); + } }
Modified todo.txt from [8c698d0971] to [6d5d9db2ed].
@@ -1,5 +1,33 @@ +Bugs: + + * When doing an update, if a file is not found that should be there + then the update aborts, only after it has written several files. It + does not update your checked out version, thus when doing a fossil + changes, you see everything that has come over from your update + command. Steps to reproduce: + + $ rm src/main.c + $ fossil update 9b30 + UPDATE ... etc ... + fossil: no such file: src/main.c + $ fossil info + (shows version you were on prior to update) + $ fossil changes + EDITED ... many ... + + * Bug: If the server closes the socket unexpectedly, the + fwrite() in http.c:103 throws a signal and kills the child + process. fwrite() is not suppose to do this. Need to figure + out what is going wrong. + + * Bug: pull is ending prematurely. + + * Bug: Make sure merge and other commands (check-out) do not try + to use a phantom. + + Things to work on: * Use the wiki_convert() routine to render comments and other text on web pages. @@ -11,20 +39,10 @@ * If the server returns an error (for example if the outbound /xfer message exceeds the maximum POST size of the server) the client does not report this error back to the user as it should. - * Bug: If the server closes the socket unexpectedly, the - fwrite() in http.c:103 throws a signal and kills the child - process. fwrite() is not suppose to do this. Need to figure - out what is going wrong. - - * Bug: pull is ending prematurely. - - * Bug: Make sure merge and other commands (check-out) do not try - to use a phantom. -¿ * The ipaddr field of the rcvfrom table is not being set. This field should be the IP address from which information is received for the local repository. So when somebody does a push of new files we record the ipaddr. Or when we do a pull, we record the ipaddr.