Fossil SCM
Bring the "stash" enhancement into the trunk.
Commit
12a2a5eaf20f2d2439e16fdd2e08918cfbb94fdd
Parent
30981b64a4fcf74…
11 files changed
+2
-1
+2
-2
+11
+12
-8
+12
-2
+1
+1
-4
+144
+1
-2
+101
-33
+56
-12
+2
-1
| --- src/blob.c | ||
| +++ src/blob.c | ||
| @@ -279,11 +279,12 @@ | ||
| 279 | 279 | p->aData[p->nUsed] = 0; |
| 280 | 280 | return p->aData; |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | /* |
| 284 | -** Compare two blobs. | |
| 284 | +** Compare two blobs. Return negative, zero, or positive if the first | |
| 285 | +** blob is less then, equal to, or greater than the second. | |
| 285 | 286 | */ |
| 286 | 287 | int blob_compare(Blob *pA, Blob *pB){ |
| 287 | 288 | int szA, szB, sz, rc; |
| 288 | 289 | blob_is_init(pA); |
| 289 | 290 | blob_is_init(pB); |
| 290 | 291 |
| --- src/blob.c | |
| +++ src/blob.c | |
| @@ -279,11 +279,12 @@ | |
| 279 | p->aData[p->nUsed] = 0; |
| 280 | return p->aData; |
| 281 | } |
| 282 | |
| 283 | /* |
| 284 | ** Compare two blobs. |
| 285 | */ |
| 286 | int blob_compare(Blob *pA, Blob *pB){ |
| 287 | int szA, szB, sz, rc; |
| 288 | blob_is_init(pA); |
| 289 | blob_is_init(pB); |
| 290 |
| --- src/blob.c | |
| +++ src/blob.c | |
| @@ -279,11 +279,12 @@ | |
| 279 | p->aData[p->nUsed] = 0; |
| 280 | return p->aData; |
| 281 | } |
| 282 | |
| 283 | /* |
| 284 | ** Compare two blobs. Return negative, zero, or positive if the first |
| 285 | ** blob is less then, equal to, or greater than the second. |
| 286 | */ |
| 287 | int blob_compare(Blob *pA, Blob *pB){ |
| 288 | int szA, szB, sz, rc; |
| 289 | blob_is_init(pA); |
| 290 | blob_is_init(pB); |
| 291 |
+2
-2
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -49,11 +49,11 @@ | ||
| 49 | 49 | const char *zPathname = db_column_text(&q,0); |
| 50 | 50 | int isDeleted = db_column_int(&q, 1); |
| 51 | 51 | int isChnged = db_column_int(&q,2); |
| 52 | 52 | int isNew = db_column_int(&q,3)==0; |
| 53 | 53 | int isRenamed = db_column_int(&q,4); |
| 54 | - char *zFullName = mprintf("%s/%s", g.zLocalRoot, zPathname); | |
| 54 | + char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname); | |
| 55 | 55 | blob_append(report, zPrefix, nPrefix); |
| 56 | 56 | if( isDeleted ){ |
| 57 | 57 | blob_appendf(report, "DELETED %s\n", zPathname); |
| 58 | 58 | }else if( !file_isfile(zFullName) ){ |
| 59 | 59 | if( access(zFullName, 0)==0 ){ |
| @@ -174,11 +174,11 @@ | ||
| 174 | 174 | const char *zPathname = db_column_text(&q,0); |
| 175 | 175 | int isDeleted = db_column_int(&q, 1); |
| 176 | 176 | int isNew = db_column_int(&q,2)==0; |
| 177 | 177 | int chnged = db_column_int(&q,3); |
| 178 | 178 | int renamed = db_column_int(&q,4); |
| 179 | - char *zFullName = mprintf("%s/%s", g.zLocalRoot, zPathname); | |
| 179 | + char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname); | |
| 180 | 180 | if( isBrief ){ |
| 181 | 181 | printf("%s\n", zPathname); |
| 182 | 182 | }else if( isNew ){ |
| 183 | 183 | printf("ADDED %s\n", zPathname); |
| 184 | 184 | }else if( isDeleted ){ |
| 185 | 185 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -49,11 +49,11 @@ | |
| 49 | const char *zPathname = db_column_text(&q,0); |
| 50 | int isDeleted = db_column_int(&q, 1); |
| 51 | int isChnged = db_column_int(&q,2); |
| 52 | int isNew = db_column_int(&q,3)==0; |
| 53 | int isRenamed = db_column_int(&q,4); |
| 54 | char *zFullName = mprintf("%s/%s", g.zLocalRoot, zPathname); |
| 55 | blob_append(report, zPrefix, nPrefix); |
| 56 | if( isDeleted ){ |
| 57 | blob_appendf(report, "DELETED %s\n", zPathname); |
| 58 | }else if( !file_isfile(zFullName) ){ |
| 59 | if( access(zFullName, 0)==0 ){ |
| @@ -174,11 +174,11 @@ | |
| 174 | const char *zPathname = db_column_text(&q,0); |
| 175 | int isDeleted = db_column_int(&q, 1); |
| 176 | int isNew = db_column_int(&q,2)==0; |
| 177 | int chnged = db_column_int(&q,3); |
| 178 | int renamed = db_column_int(&q,4); |
| 179 | char *zFullName = mprintf("%s/%s", g.zLocalRoot, zPathname); |
| 180 | if( isBrief ){ |
| 181 | printf("%s\n", zPathname); |
| 182 | }else if( isNew ){ |
| 183 | printf("ADDED %s\n", zPathname); |
| 184 | }else if( isDeleted ){ |
| 185 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -49,11 +49,11 @@ | |
| 49 | const char *zPathname = db_column_text(&q,0); |
| 50 | int isDeleted = db_column_int(&q, 1); |
| 51 | int isChnged = db_column_int(&q,2); |
| 52 | int isNew = db_column_int(&q,3)==0; |
| 53 | int isRenamed = db_column_int(&q,4); |
| 54 | char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname); |
| 55 | blob_append(report, zPrefix, nPrefix); |
| 56 | if( isDeleted ){ |
| 57 | blob_appendf(report, "DELETED %s\n", zPathname); |
| 58 | }else if( !file_isfile(zFullName) ){ |
| 59 | if( access(zFullName, 0)==0 ){ |
| @@ -174,11 +174,11 @@ | |
| 174 | const char *zPathname = db_column_text(&q,0); |
| 175 | int isDeleted = db_column_int(&q, 1); |
| 176 | int isNew = db_column_int(&q,2)==0; |
| 177 | int chnged = db_column_int(&q,3); |
| 178 | int renamed = db_column_int(&q,4); |
| 179 | char *zFullName = mprintf("%s%s", g.zLocalRoot, zPathname); |
| 180 | if( isBrief ){ |
| 181 | printf("%s\n", zPathname); |
| 182 | }else if( isNew ){ |
| 183 | printf("ADDED %s\n", zPathname); |
| 184 | }else if( isDeleted ){ |
| 185 |
M
src/db.c
+11
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -867,10 +867,21 @@ | ||
| 867 | 867 | rep_not_found: |
| 868 | 868 | if( (bFlags & OPEN_OK_NOT_FOUND)==0 ){ |
| 869 | 869 | fossil_fatal("use --repository or -R to specify the repository database"); |
| 870 | 870 | } |
| 871 | 871 | } |
| 872 | + | |
| 873 | +/* | |
| 874 | +** Return the name of the database "localdb", "configdb", or "repository". | |
| 875 | +*/ | |
| 876 | +const char *db_name(const char *zDb){ | |
| 877 | + assert( strcmp(zDb,"localdb")==0 | |
| 878 | + || strcmp(zDb,"configdb")==0 | |
| 879 | + || strcmp(zDb,"repository")==0 ); | |
| 880 | + if( strcmp(zDb, g.zMainDbType)==0 ) zDb = "main"; | |
| 881 | + return zDb; | |
| 882 | +} | |
| 872 | 883 | |
| 873 | 884 | /* |
| 874 | 885 | ** Verify that the repository schema is correct. If it is not correct, |
| 875 | 886 | ** issue a fatal error and die. |
| 876 | 887 | */ |
| 877 | 888 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -867,10 +867,21 @@ | |
| 867 | rep_not_found: |
| 868 | if( (bFlags & OPEN_OK_NOT_FOUND)==0 ){ |
| 869 | fossil_fatal("use --repository or -R to specify the repository database"); |
| 870 | } |
| 871 | } |
| 872 | |
| 873 | /* |
| 874 | ** Verify that the repository schema is correct. If it is not correct, |
| 875 | ** issue a fatal error and die. |
| 876 | */ |
| 877 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -867,10 +867,21 @@ | |
| 867 | rep_not_found: |
| 868 | if( (bFlags & OPEN_OK_NOT_FOUND)==0 ){ |
| 869 | fossil_fatal("use --repository or -R to specify the repository database"); |
| 870 | } |
| 871 | } |
| 872 | |
| 873 | /* |
| 874 | ** Return the name of the database "localdb", "configdb", or "repository". |
| 875 | */ |
| 876 | const char *db_name(const char *zDb){ |
| 877 | assert( strcmp(zDb,"localdb")==0 |
| 878 | || strcmp(zDb,"configdb")==0 |
| 879 | || strcmp(zDb,"repository")==0 ); |
| 880 | if( strcmp(zDb, g.zMainDbType)==0 ) zDb = "main"; |
| 881 | return zDb; |
| 882 | } |
| 883 | |
| 884 | /* |
| 885 | ** Verify that the repository schema is correct. If it is not correct, |
| 886 | ** issue a fatal error and die. |
| 887 | */ |
| 888 |
+12
-8
| --- src/diffcmd.c | ||
| +++ src/diffcmd.c | ||
| @@ -24,10 +24,18 @@ | ||
| 24 | 24 | /* |
| 25 | 25 | ** Diff option flags |
| 26 | 26 | */ |
| 27 | 27 | #define DIFF_NEWFILE 0x01 /* Treat non-existing fails as empty files */ |
| 28 | 28 | #define DIFF_NOEOLWS 0x02 /* Ignore whitespace at the end of lines */ |
| 29 | + | |
| 30 | +/* | |
| 31 | +** Print the "Index:" message that patch wants to see at the top of a diff. | |
| 32 | +*/ | |
| 33 | +void diff_print_index(const char *zFile){ | |
| 34 | + printf("Index: %s\n=======================================" | |
| 35 | + "============================\n", zFile); | |
| 36 | +} | |
| 29 | 37 | |
| 30 | 38 | /* |
| 31 | 39 | ** Show the difference between two files, one in memory and one on disk. |
| 32 | 40 | ** |
| 33 | 41 | ** The difference is the set of edits needed to transform pFile1 into |
| @@ -34,11 +42,11 @@ | ||
| 34 | 42 | ** zFile2. The content of pFile1 is in memory. zFile2 exists on disk. |
| 35 | 43 | ** |
| 36 | 44 | ** Use the internal diff logic if zDiffCmd is NULL. Otherwise call the |
| 37 | 45 | ** command zDiffCmd to do the diffing. |
| 38 | 46 | */ |
| 39 | -static void diff_file( | |
| 47 | +void diff_file( | |
| 40 | 48 | Blob *pFile1, /* In memory content to compare from */ |
| 41 | 49 | const char *zFile2, /* On disk content to compare to */ |
| 42 | 50 | const char *zName, /* Display name of the file */ |
| 43 | 51 | const char *zDiffCmd, /* Command for comparison */ |
| 44 | 52 | int ignoreEolWs /* Ignore whitespace at end of line */ |
| @@ -104,11 +112,11 @@ | ||
| 104 | 112 | ** pFile2. |
| 105 | 113 | ** |
| 106 | 114 | ** Use the internal diff logic if zDiffCmd is NULL. Otherwise call the |
| 107 | 115 | ** command zDiffCmd to do the diffing. |
| 108 | 116 | */ |
| 109 | -static void diff_file_mem( | |
| 117 | +void diff_file_mem( | |
| 110 | 118 | Blob *pFile1, /* In memory content to compare from */ |
| 111 | 119 | Blob *pFile2, /* In memory content to compare to */ |
| 112 | 120 | const char *zName, /* Display name of the file */ |
| 113 | 121 | const char *zDiffCmd, /* Command for comparison */ |
| 114 | 122 | int ignoreEolWs /* Ignore whitespace at end of lines */ |
| @@ -257,14 +265,11 @@ | ||
| 257 | 265 | if( srcid>0 ){ |
| 258 | 266 | content_get(srcid, &content); |
| 259 | 267 | }else{ |
| 260 | 268 | blob_zero(&content); |
| 261 | 269 | } |
| 262 | - printf("Index: %s\n=======================================" | |
| 263 | - "============================\n", | |
| 264 | - zPathname | |
| 265 | - ); | |
| 270 | + diff_print_index(zPathname); | |
| 266 | 271 | diff_file(&content, zFullName, zPathname, zDiffCmd, ignoreEolWs); |
| 267 | 272 | blob_reset(&content); |
| 268 | 273 | } |
| 269 | 274 | free(zToFree); |
| 270 | 275 | } |
| @@ -307,12 +312,11 @@ | ||
| 307 | 312 | int ignoreEolWs |
| 308 | 313 | ){ |
| 309 | 314 | Blob f1, f2; |
| 310 | 315 | int rid; |
| 311 | 316 | const char *zName = pFrom ? pFrom->zName : pTo->zName; |
| 312 | - printf("Index: %s\n=======================================" | |
| 313 | - "============================\n", zName); | |
| 317 | + diff_print_index(zName); | |
| 314 | 318 | if( pFrom ){ |
| 315 | 319 | rid = uuid_to_rid(pFrom->zUuid, 0); |
| 316 | 320 | content_get(rid, &f1); |
| 317 | 321 | }else{ |
| 318 | 322 | blob_zero(&f1); |
| 319 | 323 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -24,10 +24,18 @@ | |
| 24 | /* |
| 25 | ** Diff option flags |
| 26 | */ |
| 27 | #define DIFF_NEWFILE 0x01 /* Treat non-existing fails as empty files */ |
| 28 | #define DIFF_NOEOLWS 0x02 /* Ignore whitespace at the end of lines */ |
| 29 | |
| 30 | /* |
| 31 | ** Show the difference between two files, one in memory and one on disk. |
| 32 | ** |
| 33 | ** The difference is the set of edits needed to transform pFile1 into |
| @@ -34,11 +42,11 @@ | |
| 34 | ** zFile2. The content of pFile1 is in memory. zFile2 exists on disk. |
| 35 | ** |
| 36 | ** Use the internal diff logic if zDiffCmd is NULL. Otherwise call the |
| 37 | ** command zDiffCmd to do the diffing. |
| 38 | */ |
| 39 | static void diff_file( |
| 40 | Blob *pFile1, /* In memory content to compare from */ |
| 41 | const char *zFile2, /* On disk content to compare to */ |
| 42 | const char *zName, /* Display name of the file */ |
| 43 | const char *zDiffCmd, /* Command for comparison */ |
| 44 | int ignoreEolWs /* Ignore whitespace at end of line */ |
| @@ -104,11 +112,11 @@ | |
| 104 | ** pFile2. |
| 105 | ** |
| 106 | ** Use the internal diff logic if zDiffCmd is NULL. Otherwise call the |
| 107 | ** command zDiffCmd to do the diffing. |
| 108 | */ |
| 109 | static void diff_file_mem( |
| 110 | Blob *pFile1, /* In memory content to compare from */ |
| 111 | Blob *pFile2, /* In memory content to compare to */ |
| 112 | const char *zName, /* Display name of the file */ |
| 113 | const char *zDiffCmd, /* Command for comparison */ |
| 114 | int ignoreEolWs /* Ignore whitespace at end of lines */ |
| @@ -257,14 +265,11 @@ | |
| 257 | if( srcid>0 ){ |
| 258 | content_get(srcid, &content); |
| 259 | }else{ |
| 260 | blob_zero(&content); |
| 261 | } |
| 262 | printf("Index: %s\n=======================================" |
| 263 | "============================\n", |
| 264 | zPathname |
| 265 | ); |
| 266 | diff_file(&content, zFullName, zPathname, zDiffCmd, ignoreEolWs); |
| 267 | blob_reset(&content); |
| 268 | } |
| 269 | free(zToFree); |
| 270 | } |
| @@ -307,12 +312,11 @@ | |
| 307 | int ignoreEolWs |
| 308 | ){ |
| 309 | Blob f1, f2; |
| 310 | int rid; |
| 311 | const char *zName = pFrom ? pFrom->zName : pTo->zName; |
| 312 | printf("Index: %s\n=======================================" |
| 313 | "============================\n", zName); |
| 314 | if( pFrom ){ |
| 315 | rid = uuid_to_rid(pFrom->zUuid, 0); |
| 316 | content_get(rid, &f1); |
| 317 | }else{ |
| 318 | blob_zero(&f1); |
| 319 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -24,10 +24,18 @@ | |
| 24 | /* |
| 25 | ** Diff option flags |
| 26 | */ |
| 27 | #define DIFF_NEWFILE 0x01 /* Treat non-existing fails as empty files */ |
| 28 | #define DIFF_NOEOLWS 0x02 /* Ignore whitespace at the end of lines */ |
| 29 | |
| 30 | /* |
| 31 | ** Print the "Index:" message that patch wants to see at the top of a diff. |
| 32 | */ |
| 33 | void diff_print_index(const char *zFile){ |
| 34 | printf("Index: %s\n=======================================" |
| 35 | "============================\n", zFile); |
| 36 | } |
| 37 | |
| 38 | /* |
| 39 | ** Show the difference between two files, one in memory and one on disk. |
| 40 | ** |
| 41 | ** The difference is the set of edits needed to transform pFile1 into |
| @@ -34,11 +42,11 @@ | |
| 42 | ** zFile2. The content of pFile1 is in memory. zFile2 exists on disk. |
| 43 | ** |
| 44 | ** Use the internal diff logic if zDiffCmd is NULL. Otherwise call the |
| 45 | ** command zDiffCmd to do the diffing. |
| 46 | */ |
| 47 | void diff_file( |
| 48 | Blob *pFile1, /* In memory content to compare from */ |
| 49 | const char *zFile2, /* On disk content to compare to */ |
| 50 | const char *zName, /* Display name of the file */ |
| 51 | const char *zDiffCmd, /* Command for comparison */ |
| 52 | int ignoreEolWs /* Ignore whitespace at end of line */ |
| @@ -104,11 +112,11 @@ | |
| 112 | ** pFile2. |
| 113 | ** |
| 114 | ** Use the internal diff logic if zDiffCmd is NULL. Otherwise call the |
| 115 | ** command zDiffCmd to do the diffing. |
| 116 | */ |
| 117 | void diff_file_mem( |
| 118 | Blob *pFile1, /* In memory content to compare from */ |
| 119 | Blob *pFile2, /* In memory content to compare to */ |
| 120 | const char *zName, /* Display name of the file */ |
| 121 | const char *zDiffCmd, /* Command for comparison */ |
| 122 | int ignoreEolWs /* Ignore whitespace at end of lines */ |
| @@ -257,14 +265,11 @@ | |
| 265 | if( srcid>0 ){ |
| 266 | content_get(srcid, &content); |
| 267 | }else{ |
| 268 | blob_zero(&content); |
| 269 | } |
| 270 | diff_print_index(zPathname); |
| 271 | diff_file(&content, zFullName, zPathname, zDiffCmd, ignoreEolWs); |
| 272 | blob_reset(&content); |
| 273 | } |
| 274 | free(zToFree); |
| 275 | } |
| @@ -307,12 +312,11 @@ | |
| 312 | int ignoreEolWs |
| 313 | ){ |
| 314 | Blob f1, f2; |
| 315 | int rid; |
| 316 | const char *zName = pFrom ? pFrom->zName : pTo->zName; |
| 317 | diff_print_index(zName); |
| 318 | if( pFrom ){ |
| 319 | rid = uuid_to_rid(pFrom->zUuid, 0); |
| 320 | content_get(rid, &f1); |
| 321 | }else{ |
| 322 | blob_zero(&f1); |
| 323 |
+12
-2
| --- src/main.mk | ||
| +++ src/main.mk | ||
| @@ -68,10 +68,11 @@ | ||
| 68 | 68 | $(SRCDIR)/setup.c \ |
| 69 | 69 | $(SRCDIR)/sha1.c \ |
| 70 | 70 | $(SRCDIR)/shun.c \ |
| 71 | 71 | $(SRCDIR)/skins.c \ |
| 72 | 72 | $(SRCDIR)/sqlcmd.c \ |
| 73 | + $(SRCDIR)/stash.c \ | |
| 73 | 74 | $(SRCDIR)/stat.c \ |
| 74 | 75 | $(SRCDIR)/style.c \ |
| 75 | 76 | $(SRCDIR)/sync.c \ |
| 76 | 77 | $(SRCDIR)/tag.c \ |
| 77 | 78 | $(SRCDIR)/th_main.c \ |
| @@ -146,10 +147,11 @@ | ||
| 146 | 147 | setup_.c \ |
| 147 | 148 | sha1_.c \ |
| 148 | 149 | shun_.c \ |
| 149 | 150 | skins_.c \ |
| 150 | 151 | sqlcmd_.c \ |
| 152 | + stash_.c \ | |
| 151 | 153 | stat_.c \ |
| 152 | 154 | style_.c \ |
| 153 | 155 | sync_.c \ |
| 154 | 156 | tag_.c \ |
| 155 | 157 | th_main_.c \ |
| @@ -224,10 +226,11 @@ | ||
| 224 | 226 | $(OBJDIR)/setup.o \ |
| 225 | 227 | $(OBJDIR)/sha1.o \ |
| 226 | 228 | $(OBJDIR)/shun.o \ |
| 227 | 229 | $(OBJDIR)/skins.o \ |
| 228 | 230 | $(OBJDIR)/sqlcmd.o \ |
| 231 | + $(OBJDIR)/stash.o \ | |
| 229 | 232 | $(OBJDIR)/stat.o \ |
| 230 | 233 | $(OBJDIR)/style.o \ |
| 231 | 234 | $(OBJDIR)/sync.o \ |
| 232 | 235 | $(OBJDIR)/tag.o \ |
| 233 | 236 | $(OBJDIR)/th_main.o \ |
| @@ -290,16 +293,16 @@ | ||
| 290 | 293 | # noop |
| 291 | 294 | |
| 292 | 295 | clean: |
| 293 | 296 | rm -f $(OBJDIR)/*.o *_.c $(APPNAME) VERSION.h |
| 294 | 297 | rm -f translate makeheaders mkindex page_index.h headers |
| 295 | - rm -f add.h allrepo.h attach.h bag.h bisect.h blob.h branch.h browse.h captcha.h cgi.h checkin.h checkout.h clearsign.h clone.h comformat.h configure.h content.h db.h delta.h deltacmd.h descendants.h diff.h diffcmd.h doc.h encode.h event.h export.h file.h finfo.h graph.h http.h http_socket.h http_ssl.h http_transport.h import.h info.h login.h main.h manifest.h md5.h merge.h merge3.h name.h pivot.h popen.h pqueue.h printf.h rebuild.h report.h rss.h schema.h search.h setup.h sha1.h shun.h skins.h sqlcmd.h stat.h style.h sync.h tag.h th_main.h timeline.h tkt.h tktsetup.h undo.h update.h url.h user.h verify.h vfile.h wiki.h wikiformat.h winhttp.h xfer.h zip.h | |
| 298 | + rm -f add.h allrepo.h attach.h bag.h bisect.h blob.h branch.h browse.h captcha.h cgi.h checkin.h checkout.h clearsign.h clone.h comformat.h configure.h content.h db.h delta.h deltacmd.h descendants.h diff.h diffcmd.h doc.h encode.h event.h export.h file.h finfo.h graph.h http.h http_socket.h http_ssl.h http_transport.h import.h info.h login.h main.h manifest.h md5.h merge.h merge3.h name.h pivot.h popen.h pqueue.h printf.h rebuild.h report.h rss.h schema.h search.h setup.h sha1.h shun.h skins.h sqlcmd.h stash.h stat.h style.h sync.h tag.h th_main.h timeline.h tkt.h tktsetup.h undo.h update.h url.h user.h verify.h vfile.h wiki.h wikiformat.h winhttp.h xfer.h zip.h | |
| 296 | 299 | |
| 297 | 300 | page_index.h: $(TRANS_SRC) mkindex |
| 298 | 301 | ./mkindex $(TRANS_SRC) >$@ |
| 299 | 302 | headers: page_index.h makeheaders VERSION.h |
| 300 | - ./makeheaders add_.c:add.h allrepo_.c:allrepo.h attach_.c:attach.h bag_.c:bag.h bisect_.c:bisect.h blob_.c:blob.h branch_.c:branch.h browse_.c:browse.h captcha_.c:captcha.h cgi_.c:cgi.h checkin_.c:checkin.h checkout_.c:checkout.h clearsign_.c:clearsign.h clone_.c:clone.h comformat_.c:comformat.h configure_.c:configure.h content_.c:content.h db_.c:db.h delta_.c:delta.h deltacmd_.c:deltacmd.h descendants_.c:descendants.h diff_.c:diff.h diffcmd_.c:diffcmd.h doc_.c:doc.h encode_.c:encode.h event_.c:event.h export_.c:export.h file_.c:file.h finfo_.c:finfo.h graph_.c:graph.h http_.c:http.h http_socket_.c:http_socket.h http_ssl_.c:http_ssl.h http_transport_.c:http_transport.h import_.c:import.h info_.c:info.h login_.c:login.h main_.c:main.h manifest_.c:manifest.h md5_.c:md5.h merge_.c:merge.h merge3_.c:merge3.h name_.c:name.h pivot_.c:pivot.h popen_.c:popen.h pqueue_.c:pqueue.h printf_.c:printf.h rebuild_.c:rebuild.h report_.c:report.h rss_.c:rss.h schema_.c:schema.h search_.c:search.h setup_.c:setup.h sha1_.c:sha1.h shun_.c:shun.h skins_.c:skins.h sqlcmd_.c:sqlcmd.h stat_.c:stat.h style_.c:style.h sync_.c:sync.h tag_.c:tag.h th_main_.c:th_main.h timeline_.c:timeline.h tkt_.c:tkt.h tktsetup_.c:tktsetup.h undo_.c:undo.h update_.c:update.h url_.c:url.h user_.c:user.h verify_.c:verify.h vfile_.c:vfile.h wiki_.c:wiki.h wikiformat_.c:wikiformat.h winhttp_.c:winhttp.h xfer_.c:xfer.h zip_.c:zip.h $(SRCDIR)/sqlite3.h $(SRCDIR)/th.h VERSION.h | |
| 303 | + ./makeheaders add_.c:add.h allrepo_.c:allrepo.h attach_.c:attach.h bag_.c:bag.h bisect_.c:bisect.h blob_.c:blob.h branch_.c:branch.h browse_.c:browse.h captcha_.c:captcha.h cgi_.c:cgi.h checkin_.c:checkin.h checkout_.c:checkout.h clearsign_.c:clearsign.h clone_.c:clone.h comformat_.c:comformat.h configure_.c:configure.h content_.c:content.h db_.c:db.h delta_.c:delta.h deltacmd_.c:deltacmd.h descendants_.c:descendants.h diff_.c:diff.h diffcmd_.c:diffcmd.h doc_.c:doc.h encode_.c:encode.h event_.c:event.h export_.c:export.h file_.c:file.h finfo_.c:finfo.h graph_.c:graph.h http_.c:http.h http_socket_.c:http_socket.h http_ssl_.c:http_ssl.h http_transport_.c:http_transport.h import_.c:import.h info_.c:info.h login_.c:login.h main_.c:main.h manifest_.c:manifest.h md5_.c:md5.h merge_.c:merge.h merge3_.c:merge3.h name_.c:name.h pivot_.c:pivot.h popen_.c:popen.h pqueue_.c:pqueue.h printf_.c:printf.h rebuild_.c:rebuild.h report_.c:report.h rss_.c:rss.h schema_.c:schema.h search_.c:search.h setup_.c:setup.h sha1_.c:sha1.h shun_.c:shun.h skins_.c:skins.h sqlcmd_.c:sqlcmd.h stash_.c:stash.h stat_.c:stat.h style_.c:style.h sync_.c:sync.h tag_.c:tag.h th_main_.c:th_main.h timeline_.c:timeline.h tkt_.c:tkt.h tktsetup_.c:tktsetup.h undo_.c:undo.h update_.c:update.h url_.c:url.h user_.c:user.h verify_.c:verify.h vfile_.c:vfile.h wiki_.c:wiki.h wikiformat_.c:wikiformat.h winhttp_.c:winhttp.h xfer_.c:xfer.h zip_.c:zip.h $(SRCDIR)/sqlite3.h $(SRCDIR)/th.h VERSION.h | |
| 301 | 304 | touch headers |
| 302 | 305 | headers: Makefile |
| 303 | 306 | Makefile: |
| 304 | 307 | add_.c: $(SRCDIR)/add.c translate |
| 305 | 308 | ./translate $(SRCDIR)/add.c >add_.c |
| @@ -698,10 +701,17 @@ | ||
| 698 | 701 | |
| 699 | 702 | $(OBJDIR)/sqlcmd.o: sqlcmd_.c sqlcmd.h $(SRCDIR)/config.h |
| 700 | 703 | $(XTCC) -o $(OBJDIR)/sqlcmd.o -c sqlcmd_.c |
| 701 | 704 | |
| 702 | 705 | sqlcmd.h: headers |
| 706 | +stash_.c: $(SRCDIR)/stash.c translate | |
| 707 | + ./translate $(SRCDIR)/stash.c >stash_.c | |
| 708 | + | |
| 709 | +$(OBJDIR)/stash.o: stash_.c stash.h $(SRCDIR)/config.h | |
| 710 | + $(XTCC) -o $(OBJDIR)/stash.o -c stash_.c | |
| 711 | + | |
| 712 | +stash.h: headers | |
| 703 | 713 | stat_.c: $(SRCDIR)/stat.c translate |
| 704 | 714 | ./translate $(SRCDIR)/stat.c >stat_.c |
| 705 | 715 | |
| 706 | 716 | $(OBJDIR)/stat.o: stat_.c stat.h $(SRCDIR)/config.h |
| 707 | 717 | $(XTCC) -o $(OBJDIR)/stat.o -c stat_.c |
| 708 | 718 |
| --- src/main.mk | |
| +++ src/main.mk | |
| @@ -68,10 +68,11 @@ | |
| 68 | $(SRCDIR)/setup.c \ |
| 69 | $(SRCDIR)/sha1.c \ |
| 70 | $(SRCDIR)/shun.c \ |
| 71 | $(SRCDIR)/skins.c \ |
| 72 | $(SRCDIR)/sqlcmd.c \ |
| 73 | $(SRCDIR)/stat.c \ |
| 74 | $(SRCDIR)/style.c \ |
| 75 | $(SRCDIR)/sync.c \ |
| 76 | $(SRCDIR)/tag.c \ |
| 77 | $(SRCDIR)/th_main.c \ |
| @@ -146,10 +147,11 @@ | |
| 146 | setup_.c \ |
| 147 | sha1_.c \ |
| 148 | shun_.c \ |
| 149 | skins_.c \ |
| 150 | sqlcmd_.c \ |
| 151 | stat_.c \ |
| 152 | style_.c \ |
| 153 | sync_.c \ |
| 154 | tag_.c \ |
| 155 | th_main_.c \ |
| @@ -224,10 +226,11 @@ | |
| 224 | $(OBJDIR)/setup.o \ |
| 225 | $(OBJDIR)/sha1.o \ |
| 226 | $(OBJDIR)/shun.o \ |
| 227 | $(OBJDIR)/skins.o \ |
| 228 | $(OBJDIR)/sqlcmd.o \ |
| 229 | $(OBJDIR)/stat.o \ |
| 230 | $(OBJDIR)/style.o \ |
| 231 | $(OBJDIR)/sync.o \ |
| 232 | $(OBJDIR)/tag.o \ |
| 233 | $(OBJDIR)/th_main.o \ |
| @@ -290,16 +293,16 @@ | |
| 290 | # noop |
| 291 | |
| 292 | clean: |
| 293 | rm -f $(OBJDIR)/*.o *_.c $(APPNAME) VERSION.h |
| 294 | rm -f translate makeheaders mkindex page_index.h headers |
| 295 | rm -f add.h allrepo.h attach.h bag.h bisect.h blob.h branch.h browse.h captcha.h cgi.h checkin.h checkout.h clearsign.h clone.h comformat.h configure.h content.h db.h delta.h deltacmd.h descendants.h diff.h diffcmd.h doc.h encode.h event.h export.h file.h finfo.h graph.h http.h http_socket.h http_ssl.h http_transport.h import.h info.h login.h main.h manifest.h md5.h merge.h merge3.h name.h pivot.h popen.h pqueue.h printf.h rebuild.h report.h rss.h schema.h search.h setup.h sha1.h shun.h skins.h sqlcmd.h stat.h style.h sync.h tag.h th_main.h timeline.h tkt.h tktsetup.h undo.h update.h url.h user.h verify.h vfile.h wiki.h wikiformat.h winhttp.h xfer.h zip.h |
| 296 | |
| 297 | page_index.h: $(TRANS_SRC) mkindex |
| 298 | ./mkindex $(TRANS_SRC) >$@ |
| 299 | headers: page_index.h makeheaders VERSION.h |
| 300 | ./makeheaders add_.c:add.h allrepo_.c:allrepo.h attach_.c:attach.h bag_.c:bag.h bisect_.c:bisect.h blob_.c:blob.h branch_.c:branch.h browse_.c:browse.h captcha_.c:captcha.h cgi_.c:cgi.h checkin_.c:checkin.h checkout_.c:checkout.h clearsign_.c:clearsign.h clone_.c:clone.h comformat_.c:comformat.h configure_.c:configure.h content_.c:content.h db_.c:db.h delta_.c:delta.h deltacmd_.c:deltacmd.h descendants_.c:descendants.h diff_.c:diff.h diffcmd_.c:diffcmd.h doc_.c:doc.h encode_.c:encode.h event_.c:event.h export_.c:export.h file_.c:file.h finfo_.c:finfo.h graph_.c:graph.h http_.c:http.h http_socket_.c:http_socket.h http_ssl_.c:http_ssl.h http_transport_.c:http_transport.h import_.c:import.h info_.c:info.h login_.c:login.h main_.c:main.h manifest_.c:manifest.h md5_.c:md5.h merge_.c:merge.h merge3_.c:merge3.h name_.c:name.h pivot_.c:pivot.h popen_.c:popen.h pqueue_.c:pqueue.h printf_.c:printf.h rebuild_.c:rebuild.h report_.c:report.h rss_.c:rss.h schema_.c:schema.h search_.c:search.h setup_.c:setup.h sha1_.c:sha1.h shun_.c:shun.h skins_.c:skins.h sqlcmd_.c:sqlcmd.h stat_.c:stat.h style_.c:style.h sync_.c:sync.h tag_.c:tag.h th_main_.c:th_main.h timeline_.c:timeline.h tkt_.c:tkt.h tktsetup_.c:tktsetup.h undo_.c:undo.h update_.c:update.h url_.c:url.h user_.c:user.h verify_.c:verify.h vfile_.c:vfile.h wiki_.c:wiki.h wikiformat_.c:wikiformat.h winhttp_.c:winhttp.h xfer_.c:xfer.h zip_.c:zip.h $(SRCDIR)/sqlite3.h $(SRCDIR)/th.h VERSION.h |
| 301 | touch headers |
| 302 | headers: Makefile |
| 303 | Makefile: |
| 304 | add_.c: $(SRCDIR)/add.c translate |
| 305 | ./translate $(SRCDIR)/add.c >add_.c |
| @@ -698,10 +701,17 @@ | |
| 698 | |
| 699 | $(OBJDIR)/sqlcmd.o: sqlcmd_.c sqlcmd.h $(SRCDIR)/config.h |
| 700 | $(XTCC) -o $(OBJDIR)/sqlcmd.o -c sqlcmd_.c |
| 701 | |
| 702 | sqlcmd.h: headers |
| 703 | stat_.c: $(SRCDIR)/stat.c translate |
| 704 | ./translate $(SRCDIR)/stat.c >stat_.c |
| 705 | |
| 706 | $(OBJDIR)/stat.o: stat_.c stat.h $(SRCDIR)/config.h |
| 707 | $(XTCC) -o $(OBJDIR)/stat.o -c stat_.c |
| 708 |
| --- src/main.mk | |
| +++ src/main.mk | |
| @@ -68,10 +68,11 @@ | |
| 68 | $(SRCDIR)/setup.c \ |
| 69 | $(SRCDIR)/sha1.c \ |
| 70 | $(SRCDIR)/shun.c \ |
| 71 | $(SRCDIR)/skins.c \ |
| 72 | $(SRCDIR)/sqlcmd.c \ |
| 73 | $(SRCDIR)/stash.c \ |
| 74 | $(SRCDIR)/stat.c \ |
| 75 | $(SRCDIR)/style.c \ |
| 76 | $(SRCDIR)/sync.c \ |
| 77 | $(SRCDIR)/tag.c \ |
| 78 | $(SRCDIR)/th_main.c \ |
| @@ -146,10 +147,11 @@ | |
| 147 | setup_.c \ |
| 148 | sha1_.c \ |
| 149 | shun_.c \ |
| 150 | skins_.c \ |
| 151 | sqlcmd_.c \ |
| 152 | stash_.c \ |
| 153 | stat_.c \ |
| 154 | style_.c \ |
| 155 | sync_.c \ |
| 156 | tag_.c \ |
| 157 | th_main_.c \ |
| @@ -224,10 +226,11 @@ | |
| 226 | $(OBJDIR)/setup.o \ |
| 227 | $(OBJDIR)/sha1.o \ |
| 228 | $(OBJDIR)/shun.o \ |
| 229 | $(OBJDIR)/skins.o \ |
| 230 | $(OBJDIR)/sqlcmd.o \ |
| 231 | $(OBJDIR)/stash.o \ |
| 232 | $(OBJDIR)/stat.o \ |
| 233 | $(OBJDIR)/style.o \ |
| 234 | $(OBJDIR)/sync.o \ |
| 235 | $(OBJDIR)/tag.o \ |
| 236 | $(OBJDIR)/th_main.o \ |
| @@ -290,16 +293,16 @@ | |
| 293 | # noop |
| 294 | |
| 295 | clean: |
| 296 | rm -f $(OBJDIR)/*.o *_.c $(APPNAME) VERSION.h |
| 297 | rm -f translate makeheaders mkindex page_index.h headers |
| 298 | rm -f add.h allrepo.h attach.h bag.h bisect.h blob.h branch.h browse.h captcha.h cgi.h checkin.h checkout.h clearsign.h clone.h comformat.h configure.h content.h db.h delta.h deltacmd.h descendants.h diff.h diffcmd.h doc.h encode.h event.h export.h file.h finfo.h graph.h http.h http_socket.h http_ssl.h http_transport.h import.h info.h login.h main.h manifest.h md5.h merge.h merge3.h name.h pivot.h popen.h pqueue.h printf.h rebuild.h report.h rss.h schema.h search.h setup.h sha1.h shun.h skins.h sqlcmd.h stash.h stat.h style.h sync.h tag.h th_main.h timeline.h tkt.h tktsetup.h undo.h update.h url.h user.h verify.h vfile.h wiki.h wikiformat.h winhttp.h xfer.h zip.h |
| 299 | |
| 300 | page_index.h: $(TRANS_SRC) mkindex |
| 301 | ./mkindex $(TRANS_SRC) >$@ |
| 302 | headers: page_index.h makeheaders VERSION.h |
| 303 | ./makeheaders add_.c:add.h allrepo_.c:allrepo.h attach_.c:attach.h bag_.c:bag.h bisect_.c:bisect.h blob_.c:blob.h branch_.c:branch.h browse_.c:browse.h captcha_.c:captcha.h cgi_.c:cgi.h checkin_.c:checkin.h checkout_.c:checkout.h clearsign_.c:clearsign.h clone_.c:clone.h comformat_.c:comformat.h configure_.c:configure.h content_.c:content.h db_.c:db.h delta_.c:delta.h deltacmd_.c:deltacmd.h descendants_.c:descendants.h diff_.c:diff.h diffcmd_.c:diffcmd.h doc_.c:doc.h encode_.c:encode.h event_.c:event.h export_.c:export.h file_.c:file.h finfo_.c:finfo.h graph_.c:graph.h http_.c:http.h http_socket_.c:http_socket.h http_ssl_.c:http_ssl.h http_transport_.c:http_transport.h import_.c:import.h info_.c:info.h login_.c:login.h main_.c:main.h manifest_.c:manifest.h md5_.c:md5.h merge_.c:merge.h merge3_.c:merge3.h name_.c:name.h pivot_.c:pivot.h popen_.c:popen.h pqueue_.c:pqueue.h printf_.c:printf.h rebuild_.c:rebuild.h report_.c:report.h rss_.c:rss.h schema_.c:schema.h search_.c:search.h setup_.c:setup.h sha1_.c:sha1.h shun_.c:shun.h skins_.c:skins.h sqlcmd_.c:sqlcmd.h stash_.c:stash.h stat_.c:stat.h style_.c:style.h sync_.c:sync.h tag_.c:tag.h th_main_.c:th_main.h timeline_.c:timeline.h tkt_.c:tkt.h tktsetup_.c:tktsetup.h undo_.c:undo.h update_.c:update.h url_.c:url.h user_.c:user.h verify_.c:verify.h vfile_.c:vfile.h wiki_.c:wiki.h wikiformat_.c:wikiformat.h winhttp_.c:winhttp.h xfer_.c:xfer.h zip_.c:zip.h $(SRCDIR)/sqlite3.h $(SRCDIR)/th.h VERSION.h |
| 304 | touch headers |
| 305 | headers: Makefile |
| 306 | Makefile: |
| 307 | add_.c: $(SRCDIR)/add.c translate |
| 308 | ./translate $(SRCDIR)/add.c >add_.c |
| @@ -698,10 +701,17 @@ | |
| 701 | |
| 702 | $(OBJDIR)/sqlcmd.o: sqlcmd_.c sqlcmd.h $(SRCDIR)/config.h |
| 703 | $(XTCC) -o $(OBJDIR)/sqlcmd.o -c sqlcmd_.c |
| 704 | |
| 705 | sqlcmd.h: headers |
| 706 | stash_.c: $(SRCDIR)/stash.c translate |
| 707 | ./translate $(SRCDIR)/stash.c >stash_.c |
| 708 | |
| 709 | $(OBJDIR)/stash.o: stash_.c stash.h $(SRCDIR)/config.h |
| 710 | $(XTCC) -o $(OBJDIR)/stash.o -c stash_.c |
| 711 | |
| 712 | stash.h: headers |
| 713 | stat_.c: $(SRCDIR)/stat.c translate |
| 714 | ./translate $(SRCDIR)/stat.c >stat_.c |
| 715 | |
| 716 | $(OBJDIR)/stat.o: stat_.c stat.h $(SRCDIR)/config.h |
| 717 | $(XTCC) -o $(OBJDIR)/stat.o -c stat_.c |
| 718 |
+1
| --- src/makemake.tcl | ||
| +++ src/makemake.tcl | ||
| @@ -61,10 +61,11 @@ | ||
| 61 | 61 | setup |
| 62 | 62 | sha1 |
| 63 | 63 | shun |
| 64 | 64 | skins |
| 65 | 65 | sqlcmd |
| 66 | + stash | |
| 66 | 67 | stat |
| 67 | 68 | style |
| 68 | 69 | sync |
| 69 | 70 | tag |
| 70 | 71 | th_main |
| 71 | 72 |
| --- src/makemake.tcl | |
| +++ src/makemake.tcl | |
| @@ -61,10 +61,11 @@ | |
| 61 | setup |
| 62 | sha1 |
| 63 | shun |
| 64 | skins |
| 65 | sqlcmd |
| 66 | stat |
| 67 | style |
| 68 | sync |
| 69 | tag |
| 70 | th_main |
| 71 |
| --- src/makemake.tcl | |
| +++ src/makemake.tcl | |
| @@ -61,10 +61,11 @@ | |
| 61 | setup |
| 62 | sha1 |
| 63 | shun |
| 64 | skins |
| 65 | sqlcmd |
| 66 | stash |
| 67 | stat |
| 68 | style |
| 69 | sync |
| 70 | tag |
| 71 | th_main |
| 72 |
+1
-4
| --- src/merge.c | ||
| +++ src/merge.c | ||
| @@ -438,14 +438,11 @@ | ||
| 438 | 438 | |
| 439 | 439 | |
| 440 | 440 | /* Report on conflicts |
| 441 | 441 | */ |
| 442 | 442 | if( nConflict && !nochangeFlag ){ |
| 443 | - printf( | |
| 444 | - "WARNING: merge conflicts - see messages above for details.\n" | |
| 445 | - "HINT: The \"fossil undo\" command will back out this merge if " | |
| 446 | - "you want\n"); | |
| 443 | + printf("WARNING: merge conflicts - see messages above for details.\n"); | |
| 447 | 444 | } |
| 448 | 445 | |
| 449 | 446 | /* |
| 450 | 447 | ** Clean up the mid and pid VFILE entries. Then commit the changes. |
| 451 | 448 | */ |
| 452 | 449 | |
| 453 | 450 | ADDED src/stash.c |
| --- src/merge.c | |
| +++ src/merge.c | |
| @@ -438,14 +438,11 @@ | |
| 438 | |
| 439 | |
| 440 | /* Report on conflicts |
| 441 | */ |
| 442 | if( nConflict && !nochangeFlag ){ |
| 443 | printf( |
| 444 | "WARNING: merge conflicts - see messages above for details.\n" |
| 445 | "HINT: The \"fossil undo\" command will back out this merge if " |
| 446 | "you want\n"); |
| 447 | } |
| 448 | |
| 449 | /* |
| 450 | ** Clean up the mid and pid VFILE entries. Then commit the changes. |
| 451 | */ |
| 452 | |
| 453 | DDED src/stash.c |
| --- src/merge.c | |
| +++ src/merge.c | |
| @@ -438,14 +438,11 @@ | |
| 438 | |
| 439 | |
| 440 | /* Report on conflicts |
| 441 | */ |
| 442 | if( nConflict && !nochangeFlag ){ |
| 443 | printf("WARNING: merge conflicts - see messages above for details.\n"); |
| 444 | } |
| 445 | |
| 446 | /* |
| 447 | ** Clean up the mid and pid VFILE entries. Then commit the changes. |
| 448 | */ |
| 449 | |
| 450 | DDED src/stash.c |
+144
| --- a/src/stash.c | ||
| +++ b/src/stash.c | ||
| @@ -0,0 +1,144 @@ | ||
| 1 | +#ifdef _WIN32 * SUMMAR | |
| 2 | +** *S SUMMAR | |
| 3 | +**SUMMAR | |
| 4 | +** * fossi"%w""%w".stashfileDb;zDb = db_name("localdb"); | |
| 5 | +* SUMMA | |
| 6 | +#endifossil stash | |
| 7 | + * fossil stash | |
| 8 | +** *t@4JS,2: * * * * * fossil stash * *t it will be useful, | |
| 9 | +** but without any warranty; without even the implied warranty of | |
| 10 | +** merchantability or stash | |
| 11 | + * fossil stash | |
| 12 | +** *t@4JS,2: * * * * * fossil stash * *t it will be useful, | |
| 13 | +** but without any warranty; without even the implied warranty of | |
| 14 | +** merchantability or fitness for a particul<num>/* | |
| 15 | +** Copyright (c) 2010 D. Richard Hipp | |
| 16 | +** | |
| 17 | +** This program is free software; you can redistribut\"%w\", zDb | |
| 18 | + * SUMMAR | |
| 19 | +** *S SUMMAR | |
| 20 | +**SUMMAR | |
| 21 | +** * fossi"%w""%w".stashfileDb;zDb = db_name("localdb"); | |
| 22 | +* SUMMAR | |
| 23 | +** *S SUMMAR | |
| 24 | +MMAR | |
| 25 | +** * fossil stash | |
| 26 | + * fossil stash | |
| 27 | +** *t@4JS,2: * * * * * fossil stash * *t it will be useful, | |
| 28 | +** but without any warranty; without even the implied warranty of | |
| 29 | +** merchantability or fitness for a particul<num>/* | |
| 30 | +** Copyright (c) 2010 D. Richard Hipp | |
| 31 | +** | |
| 32 | +** This program is free software; yo stash | |
| 33 | +** *t@4JS,2: * * * * * fossil stash * *t it will be useful, | |
| 34 | +** but without any warranty; without even the implied warranty of | |
| 35 | +** merchantability or stash | |
| 36 | + * fossil stash | |
| 37 | +** *t@4JS,2: * * * * * fossil stash * *t it will be useful, | |
| 38 | +** but without any warranty; without even the implied warranty of | |
| 39 | +** merchantability or fitness for a particul<num>/* | |
| 40 | +** Copyright (c) 2010 D. Richard Hipp | |
| 41 | +** | |
| 42 | +** This program is free software; you can redistribut\"%w\", zDb | |
| 43 | + * SUMMAR | |
| 44 | +** *S SUMMAR | |
| 45 | +**SUMMAR | |
| 46 | +** * fossi"%w""%w".stashfileDb;zDb = db_name("localdb"); | |
| 47 | +* SUMMAR | |
| 48 | +** *S SUMMAR | |
| 49 | +MMAR | |
| 50 | +** * fossil stash | |
| 51 | + * fossil stash | |
| 52 | +** *t@4JS,2: * * * * * fossil stash * *t it will be useful, | |
| 53 | +** but without any warranty; without even the implied warranty of | |
| 54 | +** merchantability or fitness for a particul<num>/* | |
| 55 | +** Copyright (c) 2010 D. Richard Hipp | |
| 56 | +** | |
| 57 | +** This program is free software; yo#ifdef _WIN32 * SUMMAR | |
| 58 | +** *S SUMMAR | |
| 59 | +**SUMMAR | |
| 60 | +** * fossi"%w""%w".stashfileDb;zDb = db_name("localdb"); | |
| 61 | +* SUMMA | |
| 62 | +#endifossil stash | |
| 63 | + * fossil stash | |
| 64 | +** *t@4JS,2: * * * * * fossil stash * *t it will be useful, | |
| 65 | +** but without any warranty; without even the implied warranty of | |
| 66 | +** merchantability or stash | |
| 67 | + * fossil stash | |
| 68 | +** *t@4JS,2: * * * * * fossil stash * *t it will be useful, | |
| 69 | +** but without any warranty; without even the implied warranty of | |
| 70 | +** merchantability or fitness for a particul<num>/* | |
| 71 | +** Copyright (c) 2010 D. Richard Hipp | |
| 72 | +** | |
| 73 | +** This program is free software; you can redistribut\"%w\", zDb | |
| 74 | + * SUMMAR | |
| 75 | +** *S SUMMAR | |
| 76 | +**SUMMAR | |
| 77 | +** * fossi"%w""%w".stashfileDb;zDb = db_name("localdb"); | |
| 78 | +* SUMMAR | |
| 79 | +** *S SUMMAR | |
| 80 | +MMAR | |
| 81 | +** * fossil stash | |
| 82 | + * fossil stash | |
| 83 | +** *t@4JS,2: * * * * * fossil stash * *t it will be useful, | |
| 84 | +** but without any warranty; without even the implied warranty of | |
| 85 | +** merchantability or fitness for a particul<num>/* | |
| 86 | +** Copyright (c) 2010 D. Richard Hipp | |
| 87 | +** | |
| 88 | +** This program is free software; yofdef _WIN32 * SUMM _WIN32 * SUMMAR | |
| 89 | +** *S SUMMAR | |
| 90 | +**SUMMAR | |
| 91 | +** * fossi"%w""%w".stashfileDb;zDb = db_name("localdb"); | |
| 92 | +* SUMMA | |
| 93 | +#endifossil stash | |
| 94 | + * fossil stash | |
| 95 | +** *t@4JS,2: * * * * * fossil stash * *t it will be useful, | |
| 96 | +** but without any warranty; without even the implied warranty of | |
| 97 | +** merchantability or stash | |
| 98 | + * fossil stash | |
| 99 | +** *t@4JS,2: * * * * * fossil stash * *t it will be useful, | |
| 100 | +** but without any warranty; without even the implied warranty of | |
| 101 | +** merchantability or fitness for a particul<num>/* | |
| 102 | +** Copyright (c) 2010 D. Richard Hipp | |
| 103 | +** | |
| 104 | +** This program is free software; you can redistribut\"%w\", zDb | |
| 105 | + * SUMMAR | |
| 106 | +** *S SUMMAR | |
| 107 | +**SUMMAR | |
| 108 | +** * fossi"%w""%w".stashfileDb;zDb = db_name("localdb"); | |
| 109 | +* SUMMAR | |
| 110 | +** *S SUMMAR | |
| 111 | +MMAR | |
| 112 | +** * fog.argc = 2fdef _WIN32 * SUMMAR | |
| 113 | +** *S SUMMAR | |
| 114 | +**SUMMAR | |
| 115 | +** * fossi"%w""%w".stashfileDb;zDb = db_name("localdb"); | |
| 116 | +* SUMMA | |
| 117 | +#endifossil stash | |
| 118 | + * fossil stash | |
| 119 | +** *t@4JS,2: * * * * * fossil stash * *t it will be useful, | |
| 120 | +** but without any warranty; without even the implied warranty of | |
| 121 | +** merchantability or stash | |
| 122 | + * fossil stash | |
| 123 | +** *t@4JS,2: * * * * * fossil stash * *t it will be useful, | |
| 124 | +** but without any warranty; without even the implied warranty of | |
| 125 | +** merchantability or fitness for a particul<num>/* | |
| 126 | +** Copyright (c) 2010 D. Richard Hipp | |
| 127 | +** | |
| 128 | +** This program is free software; you can redistribut\"%w\", zDb | |
| 129 | + * SUMMAR | |
| 130 | +** *S SUMMAR | |
| 131 | +**SUMMAR | |
| 132 | +** * fossi"%w""%w".stashfileDb;zDb = db_name("localdb"); | |
| 133 | +* SUMMAR | |
| 134 | +** *S SUMMAR | |
| 135 | +MMAR | |
| 136 | +** * fossil stash | |
| 137 | + * fossil stash | |
| 138 | +** *t@4JS,2: * * * * * fossiMMAR | |
| 139 | +**SUMMAR | |
| 140 | +** * fossi"%w""%w".stashfileDb;zDb = db_name("localdb"); | |
| 141 | +* SUMMA | |
| 142 | +#endifossil stul, | |
| 143 | +** but without #ifdef _WIN32 * SUMMAR | |
| 144 | +**pop |
| --- a/src/stash.c | |
| +++ b/src/stash.c | |
| @@ -0,0 +1,144 @@ | |
| --- a/src/stash.c | |
| +++ b/src/stash.c | |
| @@ -0,0 +1,144 @@ | |
| 1 | #ifdef _WIN32 * SUMMAR |
| 2 | ** *S SUMMAR |
| 3 | **SUMMAR |
| 4 | ** * fossi"%w""%w".stashfileDb;zDb = db_name("localdb"); |
| 5 | * SUMMA |
| 6 | #endifossil stash |
| 7 | * fossil stash |
| 8 | ** *t@4JS,2: * * * * * fossil stash * *t it will be useful, |
| 9 | ** but without any warranty; without even the implied warranty of |
| 10 | ** merchantability or stash |
| 11 | * fossil stash |
| 12 | ** *t@4JS,2: * * * * * fossil stash * *t it will be useful, |
| 13 | ** but without any warranty; without even the implied warranty of |
| 14 | ** merchantability or fitness for a particul<num>/* |
| 15 | ** Copyright (c) 2010 D. Richard Hipp |
| 16 | ** |
| 17 | ** This program is free software; you can redistribut\"%w\", zDb |
| 18 | * SUMMAR |
| 19 | ** *S SUMMAR |
| 20 | **SUMMAR |
| 21 | ** * fossi"%w""%w".stashfileDb;zDb = db_name("localdb"); |
| 22 | * SUMMAR |
| 23 | ** *S SUMMAR |
| 24 | MMAR |
| 25 | ** * fossil stash |
| 26 | * fossil stash |
| 27 | ** *t@4JS,2: * * * * * fossil stash * *t it will be useful, |
| 28 | ** but without any warranty; without even the implied warranty of |
| 29 | ** merchantability or fitness for a particul<num>/* |
| 30 | ** Copyright (c) 2010 D. Richard Hipp |
| 31 | ** |
| 32 | ** This program is free software; yo stash |
| 33 | ** *t@4JS,2: * * * * * fossil stash * *t it will be useful, |
| 34 | ** but without any warranty; without even the implied warranty of |
| 35 | ** merchantability or stash |
| 36 | * fossil stash |
| 37 | ** *t@4JS,2: * * * * * fossil stash * *t it will be useful, |
| 38 | ** but without any warranty; without even the implied warranty of |
| 39 | ** merchantability or fitness for a particul<num>/* |
| 40 | ** Copyright (c) 2010 D. Richard Hipp |
| 41 | ** |
| 42 | ** This program is free software; you can redistribut\"%w\", zDb |
| 43 | * SUMMAR |
| 44 | ** *S SUMMAR |
| 45 | **SUMMAR |
| 46 | ** * fossi"%w""%w".stashfileDb;zDb = db_name("localdb"); |
| 47 | * SUMMAR |
| 48 | ** *S SUMMAR |
| 49 | MMAR |
| 50 | ** * fossil stash |
| 51 | * fossil stash |
| 52 | ** *t@4JS,2: * * * * * fossil stash * *t it will be useful, |
| 53 | ** but without any warranty; without even the implied warranty of |
| 54 | ** merchantability or fitness for a particul<num>/* |
| 55 | ** Copyright (c) 2010 D. Richard Hipp |
| 56 | ** |
| 57 | ** This program is free software; yo#ifdef _WIN32 * SUMMAR |
| 58 | ** *S SUMMAR |
| 59 | **SUMMAR |
| 60 | ** * fossi"%w""%w".stashfileDb;zDb = db_name("localdb"); |
| 61 | * SUMMA |
| 62 | #endifossil stash |
| 63 | * fossil stash |
| 64 | ** *t@4JS,2: * * * * * fossil stash * *t it will be useful, |
| 65 | ** but without any warranty; without even the implied warranty of |
| 66 | ** merchantability or stash |
| 67 | * fossil stash |
| 68 | ** *t@4JS,2: * * * * * fossil stash * *t it will be useful, |
| 69 | ** but without any warranty; without even the implied warranty of |
| 70 | ** merchantability or fitness for a particul<num>/* |
| 71 | ** Copyright (c) 2010 D. Richard Hipp |
| 72 | ** |
| 73 | ** This program is free software; you can redistribut\"%w\", zDb |
| 74 | * SUMMAR |
| 75 | ** *S SUMMAR |
| 76 | **SUMMAR |
| 77 | ** * fossi"%w""%w".stashfileDb;zDb = db_name("localdb"); |
| 78 | * SUMMAR |
| 79 | ** *S SUMMAR |
| 80 | MMAR |
| 81 | ** * fossil stash |
| 82 | * fossil stash |
| 83 | ** *t@4JS,2: * * * * * fossil stash * *t it will be useful, |
| 84 | ** but without any warranty; without even the implied warranty of |
| 85 | ** merchantability or fitness for a particul<num>/* |
| 86 | ** Copyright (c) 2010 D. Richard Hipp |
| 87 | ** |
| 88 | ** This program is free software; yofdef _WIN32 * SUMM _WIN32 * SUMMAR |
| 89 | ** *S SUMMAR |
| 90 | **SUMMAR |
| 91 | ** * fossi"%w""%w".stashfileDb;zDb = db_name("localdb"); |
| 92 | * SUMMA |
| 93 | #endifossil stash |
| 94 | * fossil stash |
| 95 | ** *t@4JS,2: * * * * * fossil stash * *t it will be useful, |
| 96 | ** but without any warranty; without even the implied warranty of |
| 97 | ** merchantability or stash |
| 98 | * fossil stash |
| 99 | ** *t@4JS,2: * * * * * fossil stash * *t it will be useful, |
| 100 | ** but without any warranty; without even the implied warranty of |
| 101 | ** merchantability or fitness for a particul<num>/* |
| 102 | ** Copyright (c) 2010 D. Richard Hipp |
| 103 | ** |
| 104 | ** This program is free software; you can redistribut\"%w\", zDb |
| 105 | * SUMMAR |
| 106 | ** *S SUMMAR |
| 107 | **SUMMAR |
| 108 | ** * fossi"%w""%w".stashfileDb;zDb = db_name("localdb"); |
| 109 | * SUMMAR |
| 110 | ** *S SUMMAR |
| 111 | MMAR |
| 112 | ** * fog.argc = 2fdef _WIN32 * SUMMAR |
| 113 | ** *S SUMMAR |
| 114 | **SUMMAR |
| 115 | ** * fossi"%w""%w".stashfileDb;zDb = db_name("localdb"); |
| 116 | * SUMMA |
| 117 | #endifossil stash |
| 118 | * fossil stash |
| 119 | ** *t@4JS,2: * * * * * fossil stash * *t it will be useful, |
| 120 | ** but without any warranty; without even the implied warranty of |
| 121 | ** merchantability or stash |
| 122 | * fossil stash |
| 123 | ** *t@4JS,2: * * * * * fossil stash * *t it will be useful, |
| 124 | ** but without any warranty; without even the implied warranty of |
| 125 | ** merchantability or fitness for a particul<num>/* |
| 126 | ** Copyright (c) 2010 D. Richard Hipp |
| 127 | ** |
| 128 | ** This program is free software; you can redistribut\"%w\", zDb |
| 129 | * SUMMAR |
| 130 | ** *S SUMMAR |
| 131 | **SUMMAR |
| 132 | ** * fossi"%w""%w".stashfileDb;zDb = db_name("localdb"); |
| 133 | * SUMMAR |
| 134 | ** *S SUMMAR |
| 135 | MMAR |
| 136 | ** * fossil stash |
| 137 | * fossil stash |
| 138 | ** *t@4JS,2: * * * * * fossiMMAR |
| 139 | **SUMMAR |
| 140 | ** * fossi"%w""%w".stashfileDb;zDb = db_name("localdb"); |
| 141 | * SUMMA |
| 142 | #endifossil stul, |
| 143 | ** but without #ifdef _WIN32 * SUMMAR |
| 144 | **pop |
+1
-2
| --- src/stat.c | ||
| +++ src/stat.c | ||
| @@ -109,12 +109,11 @@ | ||
| 109 | 109 | @ %h(MANIFEST_DATE) %h(MANIFEST_VERSION) (%h(COMPILER_NAME)) |
| 110 | 110 | @ </td></tr> |
| 111 | 111 | @ <tr><th>SQLite Version:</th><td> |
| 112 | 112 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%.19s [%.10s] (%s)", |
| 113 | 113 | SQLITE_SOURCE_ID, &SQLITE_SOURCE_ID[20], SQLITE_VERSION); |
| 114 | - zDb = "repository"; | |
| 115 | - if( strcmp(g.zMainDbType, zDb)==0 ) zDb = "main"; | |
| 114 | + zDb = db_name("repository"); | |
| 116 | 115 | @ %s(zBuf) |
| 117 | 116 | @ </td></tr> |
| 118 | 117 | @ <tr><th>Database Stats:</th><td> |
| 119 | 118 | @ %d(db_int(0, "PRAGMA %s.page_count", zDb)) pages, |
| 120 | 119 | @ %d(db_int(0, "PRAGMA %s.page_size", zDb)) bytes/page, |
| 121 | 120 |
| --- src/stat.c | |
| +++ src/stat.c | |
| @@ -109,12 +109,11 @@ | |
| 109 | @ %h(MANIFEST_DATE) %h(MANIFEST_VERSION) (%h(COMPILER_NAME)) |
| 110 | @ </td></tr> |
| 111 | @ <tr><th>SQLite Version:</th><td> |
| 112 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%.19s [%.10s] (%s)", |
| 113 | SQLITE_SOURCE_ID, &SQLITE_SOURCE_ID[20], SQLITE_VERSION); |
| 114 | zDb = "repository"; |
| 115 | if( strcmp(g.zMainDbType, zDb)==0 ) zDb = "main"; |
| 116 | @ %s(zBuf) |
| 117 | @ </td></tr> |
| 118 | @ <tr><th>Database Stats:</th><td> |
| 119 | @ %d(db_int(0, "PRAGMA %s.page_count", zDb)) pages, |
| 120 | @ %d(db_int(0, "PRAGMA %s.page_size", zDb)) bytes/page, |
| 121 |
| --- src/stat.c | |
| +++ src/stat.c | |
| @@ -109,12 +109,11 @@ | |
| 109 | @ %h(MANIFEST_DATE) %h(MANIFEST_VERSION) (%h(COMPILER_NAME)) |
| 110 | @ </td></tr> |
| 111 | @ <tr><th>SQLite Version:</th><td> |
| 112 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%.19s [%.10s] (%s)", |
| 113 | SQLITE_SOURCE_ID, &SQLITE_SOURCE_ID[20], SQLITE_VERSION); |
| 114 | zDb = db_name("repository"); |
| 115 | @ %s(zBuf) |
| 116 | @ </td></tr> |
| 117 | @ <tr><th>Database Stats:</th><td> |
| 118 | @ %d(db_int(0, "PRAGMA %s.page_count", zDb)) pages, |
| 119 | @ %d(db_int(0, "PRAGMA %s.page_size", zDb)) bytes/page, |
| 120 |
+101
-33
| --- src/undo.c | ||
| +++ src/undo.c | ||
| @@ -104,10 +104,11 @@ | ||
| 104 | 104 | ** Undo or redo all undoable or redoable changes. |
| 105 | 105 | */ |
| 106 | 106 | static void undo_all(int redoFlag){ |
| 107 | 107 | int ucid; |
| 108 | 108 | int ncid; |
| 109 | + const char *zDb = db_name("localdb"); | |
| 109 | 110 | undo_all_filesystem(redoFlag); |
| 110 | 111 | db_multi_exec( |
| 111 | 112 | "CREATE TEMP TABLE undo_vfile_2 AS SELECT * FROM vfile;" |
| 112 | 113 | "DELETE FROM vfile;" |
| 113 | 114 | "INSERT INTO vfile SELECT * FROM undo_vfile;" |
| @@ -119,10 +120,24 @@ | ||
| 119 | 120 | "INSERT INTO vmerge SELECT * FROM undo_vmerge;" |
| 120 | 121 | "DELETE FROM undo_vmerge;" |
| 121 | 122 | "INSERT INTO undo_vmerge SELECT * FROM undo_vmerge_2;" |
| 122 | 123 | "DROP TABLE undo_vmerge_2;" |
| 123 | 124 | ); |
| 125 | + if(db_exists("SELECT 1 FROM %s.sqlite_master WHERE name='undo_stash'", zDb) ){ | |
| 126 | + if( redoFlag ){ | |
| 127 | + db_multi_exec( | |
| 128 | + "DELETE FROM stash WHERE stashid IN (SELECT stashid FROM undo_stash);" | |
| 129 | + "DELETE FROM stashfile" | |
| 130 | + " WHERE stashid NOT IN (SELECT stashid FROM stash);" | |
| 131 | + ); | |
| 132 | + }else{ | |
| 133 | + db_multi_exec( | |
| 134 | + "INSERT OR IGNORE INTO stash SELECT * FROM undo_stash;" | |
| 135 | + "INSERT OR IGNORE INTO stashfile SELECT * FROM undo_stashfile;" | |
| 136 | + ); | |
| 137 | + } | |
| 138 | + } | |
| 124 | 139 | ncid = db_lget_int("undo_checkout", 0); |
| 125 | 140 | ucid = db_lget_int("checkout", 0); |
| 126 | 141 | db_lset_int("undo_checkout", ucid); |
| 127 | 142 | db_lset_int("checkout", ncid); |
| 128 | 143 | } |
| @@ -133,10 +148,12 @@ | ||
| 133 | 148 | void undo_reset(void){ |
| 134 | 149 | static const char zSql[] = |
| 135 | 150 | @ DROP TABLE IF EXISTS undo; |
| 136 | 151 | @ DROP TABLE IF EXISTS undo_vfile; |
| 137 | 152 | @ DROP TABLE IF EXISTS undo_vmerge; |
| 153 | + @ DROP TABLE IF EXISTS undo_stash; | |
| 154 | + @ DROP TABLE IF EXISTS undo_stashfile; | |
| 138 | 155 | ; |
| 139 | 156 | db_multi_exec(zSql); |
| 140 | 157 | db_lset_int("undo_available", 0); |
| 141 | 158 | db_lset_int("undo_checkout", 0); |
| 142 | 159 | } |
| @@ -144,40 +161,44 @@ | ||
| 144 | 161 | /* |
| 145 | 162 | ** The following variable stores the original command-line of the |
| 146 | 163 | ** command that is a candidate to be undone. |
| 147 | 164 | */ |
| 148 | 165 | static char *undoCmd = 0; |
| 166 | + | |
| 167 | +/* | |
| 168 | +** This flag is true if we are in the process of collecting file changes | |
| 169 | +** for undo. When this flag is false, undo_save() is a no-op. | |
| 170 | +** | |
| 171 | +** The undoDisable flag, if set, prevents undo from being activated. | |
| 172 | +*/ | |
| 173 | +static int undoActive = 0; | |
| 174 | +static int undoDisable = 0; | |
| 175 | + | |
| 149 | 176 | |
| 150 | 177 | /* |
| 151 | 178 | ** Capture the current command-line and store it as part of the undo |
| 152 | 179 | ** state. This routine is called before options are extracted from the |
| 153 | 180 | ** command-line so that we can record the complete command-line. |
| 154 | 181 | */ |
| 155 | 182 | void undo_capture_command_line(void){ |
| 156 | 183 | Blob cmdline; |
| 157 | 184 | int i; |
| 158 | - assert( undoCmd==0 ); | |
| 185 | + if( undoCmd!=0 || undoDisable ) return; | |
| 159 | 186 | blob_zero(&cmdline); |
| 160 | 187 | for(i=1; i<g.argc; i++){ |
| 161 | 188 | if( i>1 ) blob_append(&cmdline, " ", 1); |
| 162 | 189 | blob_append(&cmdline, g.argv[i], -1); |
| 163 | 190 | } |
| 164 | 191 | undoCmd = blob_str(&cmdline); |
| 165 | 192 | } |
| 166 | 193 | |
| 167 | -/* | |
| 168 | -** This flag is true if we are in the process of collecting file changes | |
| 169 | -** for undo. When this flag is false, undo_save() is a no-op. | |
| 170 | -*/ | |
| 171 | -static int undoActive = 0; | |
| 172 | - | |
| 173 | 194 | /* |
| 174 | 195 | ** Begin capturing a snapshot that can be undone. |
| 175 | 196 | */ |
| 176 | 197 | void undo_begin(void){ |
| 177 | 198 | int cid; |
| 178 | - const char *zDb = "localdb"; | |
| 199 | + const char *zDb = db_name("localdb"); | |
| 179 | 200 | static const char zSql[] = |
| 180 | 201 | @ CREATE TABLE %s.undo( |
| 181 | 202 | @ pathname TEXT UNIQUE, -- Name of the file |
| 182 | 203 | @ redoflag BOOLEAN, -- 0 for undoable. 1 for redoable |
| 183 | 204 | @ existsflag BOOLEAN, -- True if the file exists |
| @@ -184,19 +205,26 @@ | ||
| 184 | 205 | @ content BLOB -- Saved content |
| 185 | 206 | @ ); |
| 186 | 207 | @ CREATE TABLE %s.undo_vfile AS SELECT * FROM vfile; |
| 187 | 208 | @ CREATE TABLE %s.undo_vmerge AS SELECT * FROM vmerge; |
| 188 | 209 | ; |
| 210 | + if( undoDisable ) return; | |
| 189 | 211 | undo_reset(); |
| 190 | - if( strcmp(g.zMainDbType,zDb)==0 ) zDb = "main"; | |
| 191 | - db_multi_exec(zSql, zDb, zDb, zDb, zDb); | |
| 212 | + db_multi_exec(zSql, zDb, zDb, zDb); | |
| 192 | 213 | cid = db_lget_int("checkout", 0); |
| 193 | 214 | db_lset_int("undo_checkout", cid); |
| 194 | 215 | db_lset_int("undo_available", 1); |
| 195 | 216 | db_lset("undo_cmdline", undoCmd); |
| 196 | 217 | undoActive = 1; |
| 197 | 218 | } |
| 219 | + | |
| 220 | +/* | |
| 221 | +** Permanently disable undo | |
| 222 | +*/ | |
| 223 | +void undo_disable(void){ | |
| 224 | + undoDisable = 1; | |
| 225 | +} | |
| 198 | 226 | |
| 199 | 227 | /* |
| 200 | 228 | ** This flag is true if one or more files have changed and have been |
| 201 | 229 | ** recorded in the undo log but the undo log has not yet been committed. |
| 202 | 230 | ** |
| @@ -215,11 +243,11 @@ | ||
| 215 | 243 | Blob content; |
| 216 | 244 | int existsFlag; |
| 217 | 245 | Stmt q; |
| 218 | 246 | |
| 219 | 247 | if( !undoActive ) return; |
| 220 | - zFullname = mprintf("%s/%s", g.zLocalRoot, zPathname); | |
| 248 | + zFullname = mprintf("%s%s", g.zLocalRoot, zPathname); | |
| 221 | 249 | existsFlag = file_size(zFullname)>=0; |
| 222 | 250 | db_prepare(&q, |
| 223 | 251 | "INSERT OR IGNORE INTO undo(pathname,redoflag,existsflag,content)" |
| 224 | 252 | " VALUES(%Q,0,%d,:c)", |
| 225 | 253 | zPathname, existsFlag |
| @@ -234,16 +262,39 @@ | ||
| 234 | 262 | if( existsFlag ){ |
| 235 | 263 | blob_reset(&content); |
| 236 | 264 | } |
| 237 | 265 | undoNeedRollback = 1; |
| 238 | 266 | } |
| 267 | + | |
| 268 | +/* | |
| 269 | +** Make the current state of stashid undoable. | |
| 270 | +*/ | |
| 271 | +void undo_save_stash(int stashid){ | |
| 272 | + const char *zDb = db_name("localdb"); | |
| 273 | + db_multi_exec( | |
| 274 | + "DROP TABLE IF EXISTS undo_stash;" | |
| 275 | + "CREATE TABLE %s.undo_stash AS" | |
| 276 | + " SELECT * FROM stash WHERE stashid=%d;", | |
| 277 | + zDb, stashid | |
| 278 | + ); | |
| 279 | + db_multi_exec( | |
| 280 | + "DROP TABLE IF EXISTS undo_stashfile;" | |
| 281 | + "CREATE TABLE %s.undo_stashfile AS" | |
| 282 | + " SELECT * FROM stashfile WHERE stashid=%d;", | |
| 283 | + zDb, stashid | |
| 284 | + ); | |
| 285 | +} | |
| 239 | 286 | |
| 240 | 287 | /* |
| 241 | 288 | ** Complete the undo process is one is currently in process. |
| 242 | 289 | */ |
| 243 | 290 | void undo_finish(void){ |
| 244 | 291 | if( undoActive ){ |
| 292 | + if( undoNeedRollback ){ | |
| 293 | + printf("\"fossil undo\" is available to undo changes" | |
| 294 | + " to the working checkout.\n"); | |
| 295 | + } | |
| 245 | 296 | undoActive = 0; |
| 246 | 297 | undoNeedRollback = 0; |
| 247 | 298 | } |
| 248 | 299 | } |
| 249 | 300 | |
| @@ -270,16 +321,23 @@ | ||
| 270 | 321 | ** COMMAND: redo |
| 271 | 322 | ** |
| 272 | 323 | ** Usage: %fossil undo ?--explain? ?FILENAME...? |
| 273 | 324 | ** or: %fossil redo ?--explain? ?FILENAME...? |
| 274 | 325 | ** |
| 275 | -** Undo the most recent update or merge or revert operation. If FILENAME is | |
| 276 | -** specified then restore the content of the named file(s) but otherwise | |
| 277 | -** leave the update or merge or revert in effect. The redo command undoes | |
| 278 | -** the effect of the most recent undo. | |
| 326 | +** Undo the changes to the working checkout caused by the most recent | |
| 327 | +** of the following operations: | |
| 328 | +** | |
| 329 | +** (1) fossil update (5) fossil stash apply | |
| 330 | +** (2) fossil merge (6) fossil stash drop | |
| 331 | +** (3) fossil revert (7) fossil stash goto | |
| 332 | +** (4) fossil stash pop | |
| 333 | +** | |
| 334 | +** If FILENAME is specified then restore the content of the named | |
| 335 | +** file(s) but otherwise leave the update or merge or revert in effect. | |
| 336 | +** The redo command undoes the effect of the most recent undo. | |
| 279 | 337 | ** |
| 280 | -** If the --explain option is present, not changes are made and instead | |
| 338 | +** If the --explain option is present, no changes are made and instead | |
| 281 | 339 | ** the undo or redo command explains what actions the undo or redo would |
| 282 | 340 | ** have done had the --explain been omitted. |
| 283 | 341 | ** |
| 284 | 342 | ** A single level of undo/redo is supported. The undo/redo stack |
| 285 | 343 | ** is cleared by the commit and checkout commands. |
| @@ -288,10 +346,11 @@ | ||
| 288 | 346 | int isRedo = g.argv[1][0]=='r'; |
| 289 | 347 | int undo_available; |
| 290 | 348 | int explainFlag = find_option("explain", 0, 0)!=0; |
| 291 | 349 | const char *zCmd = isRedo ? "redo" : "undo"; |
| 292 | 350 | db_must_be_within_tree(); |
| 351 | + verify_all_options(); | |
| 293 | 352 | db_begin_transaction(); |
| 294 | 353 | undo_available = db_lget_int("undo_available", 0); |
| 295 | 354 | if( explainFlag ){ |
| 296 | 355 | if( undo_available==0 ){ |
| 297 | 356 | printf("No undo or redo is available\n"); |
| @@ -318,26 +377,35 @@ | ||
| 318 | 377 | db_finalize(&q); |
| 319 | 378 | if( nChng==0 ){ |
| 320 | 379 | printf("No file changes would occur with this undo/redo.\n"); |
| 321 | 380 | } |
| 322 | 381 | } |
| 323 | - }else if( g.argc==2 ){ | |
| 324 | - if( undo_available!=(1+isRedo) ){ | |
| 325 | - fossil_fatal("nothing to %s", zCmd); | |
| 326 | - } | |
| 327 | - undo_all(isRedo); | |
| 328 | - db_lset_int("undo_available", 2-isRedo); | |
| 329 | - }else if( g.argc>=3 ){ | |
| 330 | - int i; | |
| 331 | - if( undo_available==0 ){ | |
| 332 | - fossil_fatal("nothing to %s", zCmd); | |
| 333 | - } | |
| 334 | - for(i=2; i<g.argc; i++){ | |
| 335 | - const char *zFile = g.argv[i]; | |
| 336 | - Blob path; | |
| 337 | - file_tree_name(zFile, &path, 1); | |
| 338 | - undo_one(blob_str(&path), isRedo); | |
| 339 | - blob_reset(&path); | |
| 382 | + }else{ | |
| 383 | + int vid1 = db_lget_int("checkout", 0); | |
| 384 | + int vid2; | |
| 385 | + if( g.argc==2 ){ | |
| 386 | + if( undo_available!=(1+isRedo) ){ | |
| 387 | + fossil_fatal("nothing to %s", zCmd); | |
| 388 | + } | |
| 389 | + undo_all(isRedo); | |
| 390 | + db_lset_int("undo_available", 2-isRedo); | |
| 391 | + }else if( g.argc>=3 ){ | |
| 392 | + int i; | |
| 393 | + if( undo_available==0 ){ | |
| 394 | + fossil_fatal("nothing to %s", zCmd); | |
| 395 | + } | |
| 396 | + for(i=2; i<g.argc; i++){ | |
| 397 | + const char *zFile = g.argv[i]; | |
| 398 | + Blob path; | |
| 399 | + file_tree_name(zFile, &path, 1); | |
| 400 | + undo_one(blob_str(&path), isRedo); | |
| 401 | + blob_reset(&path); | |
| 402 | + } | |
| 403 | + } | |
| 404 | + vid2 = db_lget_int("checkout", 0); | |
| 405 | + if( vid1!=vid2 ){ | |
| 406 | + printf("--------------------\n"); | |
| 407 | + show_common_info(vid2, "updated-to:", 1, 0); | |
| 340 | 408 | } |
| 341 | 409 | } |
| 342 | 410 | db_end_transaction(0); |
| 343 | 411 | } |
| 344 | 412 |
| --- src/undo.c | |
| +++ src/undo.c | |
| @@ -104,10 +104,11 @@ | |
| 104 | ** Undo or redo all undoable or redoable changes. |
| 105 | */ |
| 106 | static void undo_all(int redoFlag){ |
| 107 | int ucid; |
| 108 | int ncid; |
| 109 | undo_all_filesystem(redoFlag); |
| 110 | db_multi_exec( |
| 111 | "CREATE TEMP TABLE undo_vfile_2 AS SELECT * FROM vfile;" |
| 112 | "DELETE FROM vfile;" |
| 113 | "INSERT INTO vfile SELECT * FROM undo_vfile;" |
| @@ -119,10 +120,24 @@ | |
| 119 | "INSERT INTO vmerge SELECT * FROM undo_vmerge;" |
| 120 | "DELETE FROM undo_vmerge;" |
| 121 | "INSERT INTO undo_vmerge SELECT * FROM undo_vmerge_2;" |
| 122 | "DROP TABLE undo_vmerge_2;" |
| 123 | ); |
| 124 | ncid = db_lget_int("undo_checkout", 0); |
| 125 | ucid = db_lget_int("checkout", 0); |
| 126 | db_lset_int("undo_checkout", ucid); |
| 127 | db_lset_int("checkout", ncid); |
| 128 | } |
| @@ -133,10 +148,12 @@ | |
| 133 | void undo_reset(void){ |
| 134 | static const char zSql[] = |
| 135 | @ DROP TABLE IF EXISTS undo; |
| 136 | @ DROP TABLE IF EXISTS undo_vfile; |
| 137 | @ DROP TABLE IF EXISTS undo_vmerge; |
| 138 | ; |
| 139 | db_multi_exec(zSql); |
| 140 | db_lset_int("undo_available", 0); |
| 141 | db_lset_int("undo_checkout", 0); |
| 142 | } |
| @@ -144,40 +161,44 @@ | |
| 144 | /* |
| 145 | ** The following variable stores the original command-line of the |
| 146 | ** command that is a candidate to be undone. |
| 147 | */ |
| 148 | static char *undoCmd = 0; |
| 149 | |
| 150 | /* |
| 151 | ** Capture the current command-line and store it as part of the undo |
| 152 | ** state. This routine is called before options are extracted from the |
| 153 | ** command-line so that we can record the complete command-line. |
| 154 | */ |
| 155 | void undo_capture_command_line(void){ |
| 156 | Blob cmdline; |
| 157 | int i; |
| 158 | assert( undoCmd==0 ); |
| 159 | blob_zero(&cmdline); |
| 160 | for(i=1; i<g.argc; i++){ |
| 161 | if( i>1 ) blob_append(&cmdline, " ", 1); |
| 162 | blob_append(&cmdline, g.argv[i], -1); |
| 163 | } |
| 164 | undoCmd = blob_str(&cmdline); |
| 165 | } |
| 166 | |
| 167 | /* |
| 168 | ** This flag is true if we are in the process of collecting file changes |
| 169 | ** for undo. When this flag is false, undo_save() is a no-op. |
| 170 | */ |
| 171 | static int undoActive = 0; |
| 172 | |
| 173 | /* |
| 174 | ** Begin capturing a snapshot that can be undone. |
| 175 | */ |
| 176 | void undo_begin(void){ |
| 177 | int cid; |
| 178 | const char *zDb = "localdb"; |
| 179 | static const char zSql[] = |
| 180 | @ CREATE TABLE %s.undo( |
| 181 | @ pathname TEXT UNIQUE, -- Name of the file |
| 182 | @ redoflag BOOLEAN, -- 0 for undoable. 1 for redoable |
| 183 | @ existsflag BOOLEAN, -- True if the file exists |
| @@ -184,19 +205,26 @@ | |
| 184 | @ content BLOB -- Saved content |
| 185 | @ ); |
| 186 | @ CREATE TABLE %s.undo_vfile AS SELECT * FROM vfile; |
| 187 | @ CREATE TABLE %s.undo_vmerge AS SELECT * FROM vmerge; |
| 188 | ; |
| 189 | undo_reset(); |
| 190 | if( strcmp(g.zMainDbType,zDb)==0 ) zDb = "main"; |
| 191 | db_multi_exec(zSql, zDb, zDb, zDb, zDb); |
| 192 | cid = db_lget_int("checkout", 0); |
| 193 | db_lset_int("undo_checkout", cid); |
| 194 | db_lset_int("undo_available", 1); |
| 195 | db_lset("undo_cmdline", undoCmd); |
| 196 | undoActive = 1; |
| 197 | } |
| 198 | |
| 199 | /* |
| 200 | ** This flag is true if one or more files have changed and have been |
| 201 | ** recorded in the undo log but the undo log has not yet been committed. |
| 202 | ** |
| @@ -215,11 +243,11 @@ | |
| 215 | Blob content; |
| 216 | int existsFlag; |
| 217 | Stmt q; |
| 218 | |
| 219 | if( !undoActive ) return; |
| 220 | zFullname = mprintf("%s/%s", g.zLocalRoot, zPathname); |
| 221 | existsFlag = file_size(zFullname)>=0; |
| 222 | db_prepare(&q, |
| 223 | "INSERT OR IGNORE INTO undo(pathname,redoflag,existsflag,content)" |
| 224 | " VALUES(%Q,0,%d,:c)", |
| 225 | zPathname, existsFlag |
| @@ -234,16 +262,39 @@ | |
| 234 | if( existsFlag ){ |
| 235 | blob_reset(&content); |
| 236 | } |
| 237 | undoNeedRollback = 1; |
| 238 | } |
| 239 | |
| 240 | /* |
| 241 | ** Complete the undo process is one is currently in process. |
| 242 | */ |
| 243 | void undo_finish(void){ |
| 244 | if( undoActive ){ |
| 245 | undoActive = 0; |
| 246 | undoNeedRollback = 0; |
| 247 | } |
| 248 | } |
| 249 | |
| @@ -270,16 +321,23 @@ | |
| 270 | ** COMMAND: redo |
| 271 | ** |
| 272 | ** Usage: %fossil undo ?--explain? ?FILENAME...? |
| 273 | ** or: %fossil redo ?--explain? ?FILENAME...? |
| 274 | ** |
| 275 | ** Undo the most recent update or merge or revert operation. If FILENAME is |
| 276 | ** specified then restore the content of the named file(s) but otherwise |
| 277 | ** leave the update or merge or revert in effect. The redo command undoes |
| 278 | ** the effect of the most recent undo. |
| 279 | ** |
| 280 | ** If the --explain option is present, not changes are made and instead |
| 281 | ** the undo or redo command explains what actions the undo or redo would |
| 282 | ** have done had the --explain been omitted. |
| 283 | ** |
| 284 | ** A single level of undo/redo is supported. The undo/redo stack |
| 285 | ** is cleared by the commit and checkout commands. |
| @@ -288,10 +346,11 @@ | |
| 288 | int isRedo = g.argv[1][0]=='r'; |
| 289 | int undo_available; |
| 290 | int explainFlag = find_option("explain", 0, 0)!=0; |
| 291 | const char *zCmd = isRedo ? "redo" : "undo"; |
| 292 | db_must_be_within_tree(); |
| 293 | db_begin_transaction(); |
| 294 | undo_available = db_lget_int("undo_available", 0); |
| 295 | if( explainFlag ){ |
| 296 | if( undo_available==0 ){ |
| 297 | printf("No undo or redo is available\n"); |
| @@ -318,26 +377,35 @@ | |
| 318 | db_finalize(&q); |
| 319 | if( nChng==0 ){ |
| 320 | printf("No file changes would occur with this undo/redo.\n"); |
| 321 | } |
| 322 | } |
| 323 | }else if( g.argc==2 ){ |
| 324 | if( undo_available!=(1+isRedo) ){ |
| 325 | fossil_fatal("nothing to %s", zCmd); |
| 326 | } |
| 327 | undo_all(isRedo); |
| 328 | db_lset_int("undo_available", 2-isRedo); |
| 329 | }else if( g.argc>=3 ){ |
| 330 | int i; |
| 331 | if( undo_available==0 ){ |
| 332 | fossil_fatal("nothing to %s", zCmd); |
| 333 | } |
| 334 | for(i=2; i<g.argc; i++){ |
| 335 | const char *zFile = g.argv[i]; |
| 336 | Blob path; |
| 337 | file_tree_name(zFile, &path, 1); |
| 338 | undo_one(blob_str(&path), isRedo); |
| 339 | blob_reset(&path); |
| 340 | } |
| 341 | } |
| 342 | db_end_transaction(0); |
| 343 | } |
| 344 |
| --- src/undo.c | |
| +++ src/undo.c | |
| @@ -104,10 +104,11 @@ | |
| 104 | ** Undo or redo all undoable or redoable changes. |
| 105 | */ |
| 106 | static void undo_all(int redoFlag){ |
| 107 | int ucid; |
| 108 | int ncid; |
| 109 | const char *zDb = db_name("localdb"); |
| 110 | undo_all_filesystem(redoFlag); |
| 111 | db_multi_exec( |
| 112 | "CREATE TEMP TABLE undo_vfile_2 AS SELECT * FROM vfile;" |
| 113 | "DELETE FROM vfile;" |
| 114 | "INSERT INTO vfile SELECT * FROM undo_vfile;" |
| @@ -119,10 +120,24 @@ | |
| 120 | "INSERT INTO vmerge SELECT * FROM undo_vmerge;" |
| 121 | "DELETE FROM undo_vmerge;" |
| 122 | "INSERT INTO undo_vmerge SELECT * FROM undo_vmerge_2;" |
| 123 | "DROP TABLE undo_vmerge_2;" |
| 124 | ); |
| 125 | if(db_exists("SELECT 1 FROM %s.sqlite_master WHERE name='undo_stash'", zDb) ){ |
| 126 | if( redoFlag ){ |
| 127 | db_multi_exec( |
| 128 | "DELETE FROM stash WHERE stashid IN (SELECT stashid FROM undo_stash);" |
| 129 | "DELETE FROM stashfile" |
| 130 | " WHERE stashid NOT IN (SELECT stashid FROM stash);" |
| 131 | ); |
| 132 | }else{ |
| 133 | db_multi_exec( |
| 134 | "INSERT OR IGNORE INTO stash SELECT * FROM undo_stash;" |
| 135 | "INSERT OR IGNORE INTO stashfile SELECT * FROM undo_stashfile;" |
| 136 | ); |
| 137 | } |
| 138 | } |
| 139 | ncid = db_lget_int("undo_checkout", 0); |
| 140 | ucid = db_lget_int("checkout", 0); |
| 141 | db_lset_int("undo_checkout", ucid); |
| 142 | db_lset_int("checkout", ncid); |
| 143 | } |
| @@ -133,10 +148,12 @@ | |
| 148 | void undo_reset(void){ |
| 149 | static const char zSql[] = |
| 150 | @ DROP TABLE IF EXISTS undo; |
| 151 | @ DROP TABLE IF EXISTS undo_vfile; |
| 152 | @ DROP TABLE IF EXISTS undo_vmerge; |
| 153 | @ DROP TABLE IF EXISTS undo_stash; |
| 154 | @ DROP TABLE IF EXISTS undo_stashfile; |
| 155 | ; |
| 156 | db_multi_exec(zSql); |
| 157 | db_lset_int("undo_available", 0); |
| 158 | db_lset_int("undo_checkout", 0); |
| 159 | } |
| @@ -144,40 +161,44 @@ | |
| 161 | /* |
| 162 | ** The following variable stores the original command-line of the |
| 163 | ** command that is a candidate to be undone. |
| 164 | */ |
| 165 | static char *undoCmd = 0; |
| 166 | |
| 167 | /* |
| 168 | ** This flag is true if we are in the process of collecting file changes |
| 169 | ** for undo. When this flag is false, undo_save() is a no-op. |
| 170 | ** |
| 171 | ** The undoDisable flag, if set, prevents undo from being activated. |
| 172 | */ |
| 173 | static int undoActive = 0; |
| 174 | static int undoDisable = 0; |
| 175 | |
| 176 | |
| 177 | /* |
| 178 | ** Capture the current command-line and store it as part of the undo |
| 179 | ** state. This routine is called before options are extracted from the |
| 180 | ** command-line so that we can record the complete command-line. |
| 181 | */ |
| 182 | void undo_capture_command_line(void){ |
| 183 | Blob cmdline; |
| 184 | int i; |
| 185 | if( undoCmd!=0 || undoDisable ) return; |
| 186 | blob_zero(&cmdline); |
| 187 | for(i=1; i<g.argc; i++){ |
| 188 | if( i>1 ) blob_append(&cmdline, " ", 1); |
| 189 | blob_append(&cmdline, g.argv[i], -1); |
| 190 | } |
| 191 | undoCmd = blob_str(&cmdline); |
| 192 | } |
| 193 | |
| 194 | /* |
| 195 | ** Begin capturing a snapshot that can be undone. |
| 196 | */ |
| 197 | void undo_begin(void){ |
| 198 | int cid; |
| 199 | const char *zDb = db_name("localdb"); |
| 200 | static const char zSql[] = |
| 201 | @ CREATE TABLE %s.undo( |
| 202 | @ pathname TEXT UNIQUE, -- Name of the file |
| 203 | @ redoflag BOOLEAN, -- 0 for undoable. 1 for redoable |
| 204 | @ existsflag BOOLEAN, -- True if the file exists |
| @@ -184,19 +205,26 @@ | |
| 205 | @ content BLOB -- Saved content |
| 206 | @ ); |
| 207 | @ CREATE TABLE %s.undo_vfile AS SELECT * FROM vfile; |
| 208 | @ CREATE TABLE %s.undo_vmerge AS SELECT * FROM vmerge; |
| 209 | ; |
| 210 | if( undoDisable ) return; |
| 211 | undo_reset(); |
| 212 | db_multi_exec(zSql, zDb, zDb, zDb); |
| 213 | cid = db_lget_int("checkout", 0); |
| 214 | db_lset_int("undo_checkout", cid); |
| 215 | db_lset_int("undo_available", 1); |
| 216 | db_lset("undo_cmdline", undoCmd); |
| 217 | undoActive = 1; |
| 218 | } |
| 219 | |
| 220 | /* |
| 221 | ** Permanently disable undo |
| 222 | */ |
| 223 | void undo_disable(void){ |
| 224 | undoDisable = 1; |
| 225 | } |
| 226 | |
| 227 | /* |
| 228 | ** This flag is true if one or more files have changed and have been |
| 229 | ** recorded in the undo log but the undo log has not yet been committed. |
| 230 | ** |
| @@ -215,11 +243,11 @@ | |
| 243 | Blob content; |
| 244 | int existsFlag; |
| 245 | Stmt q; |
| 246 | |
| 247 | if( !undoActive ) return; |
| 248 | zFullname = mprintf("%s%s", g.zLocalRoot, zPathname); |
| 249 | existsFlag = file_size(zFullname)>=0; |
| 250 | db_prepare(&q, |
| 251 | "INSERT OR IGNORE INTO undo(pathname,redoflag,existsflag,content)" |
| 252 | " VALUES(%Q,0,%d,:c)", |
| 253 | zPathname, existsFlag |
| @@ -234,16 +262,39 @@ | |
| 262 | if( existsFlag ){ |
| 263 | blob_reset(&content); |
| 264 | } |
| 265 | undoNeedRollback = 1; |
| 266 | } |
| 267 | |
| 268 | /* |
| 269 | ** Make the current state of stashid undoable. |
| 270 | */ |
| 271 | void undo_save_stash(int stashid){ |
| 272 | const char *zDb = db_name("localdb"); |
| 273 | db_multi_exec( |
| 274 | "DROP TABLE IF EXISTS undo_stash;" |
| 275 | "CREATE TABLE %s.undo_stash AS" |
| 276 | " SELECT * FROM stash WHERE stashid=%d;", |
| 277 | zDb, stashid |
| 278 | ); |
| 279 | db_multi_exec( |
| 280 | "DROP TABLE IF EXISTS undo_stashfile;" |
| 281 | "CREATE TABLE %s.undo_stashfile AS" |
| 282 | " SELECT * FROM stashfile WHERE stashid=%d;", |
| 283 | zDb, stashid |
| 284 | ); |
| 285 | } |
| 286 | |
| 287 | /* |
| 288 | ** Complete the undo process is one is currently in process. |
| 289 | */ |
| 290 | void undo_finish(void){ |
| 291 | if( undoActive ){ |
| 292 | if( undoNeedRollback ){ |
| 293 | printf("\"fossil undo\" is available to undo changes" |
| 294 | " to the working checkout.\n"); |
| 295 | } |
| 296 | undoActive = 0; |
| 297 | undoNeedRollback = 0; |
| 298 | } |
| 299 | } |
| 300 | |
| @@ -270,16 +321,23 @@ | |
| 321 | ** COMMAND: redo |
| 322 | ** |
| 323 | ** Usage: %fossil undo ?--explain? ?FILENAME...? |
| 324 | ** or: %fossil redo ?--explain? ?FILENAME...? |
| 325 | ** |
| 326 | ** Undo the changes to the working checkout caused by the most recent |
| 327 | ** of the following operations: |
| 328 | ** |
| 329 | ** (1) fossil update (5) fossil stash apply |
| 330 | ** (2) fossil merge (6) fossil stash drop |
| 331 | ** (3) fossil revert (7) fossil stash goto |
| 332 | ** (4) fossil stash pop |
| 333 | ** |
| 334 | ** If FILENAME is specified then restore the content of the named |
| 335 | ** file(s) but otherwise leave the update or merge or revert in effect. |
| 336 | ** The redo command undoes the effect of the most recent undo. |
| 337 | ** |
| 338 | ** If the --explain option is present, no changes are made and instead |
| 339 | ** the undo or redo command explains what actions the undo or redo would |
| 340 | ** have done had the --explain been omitted. |
| 341 | ** |
| 342 | ** A single level of undo/redo is supported. The undo/redo stack |
| 343 | ** is cleared by the commit and checkout commands. |
| @@ -288,10 +346,11 @@ | |
| 346 | int isRedo = g.argv[1][0]=='r'; |
| 347 | int undo_available; |
| 348 | int explainFlag = find_option("explain", 0, 0)!=0; |
| 349 | const char *zCmd = isRedo ? "redo" : "undo"; |
| 350 | db_must_be_within_tree(); |
| 351 | verify_all_options(); |
| 352 | db_begin_transaction(); |
| 353 | undo_available = db_lget_int("undo_available", 0); |
| 354 | if( explainFlag ){ |
| 355 | if( undo_available==0 ){ |
| 356 | printf("No undo or redo is available\n"); |
| @@ -318,26 +377,35 @@ | |
| 377 | db_finalize(&q); |
| 378 | if( nChng==0 ){ |
| 379 | printf("No file changes would occur with this undo/redo.\n"); |
| 380 | } |
| 381 | } |
| 382 | }else{ |
| 383 | int vid1 = db_lget_int("checkout", 0); |
| 384 | int vid2; |
| 385 | if( g.argc==2 ){ |
| 386 | if( undo_available!=(1+isRedo) ){ |
| 387 | fossil_fatal("nothing to %s", zCmd); |
| 388 | } |
| 389 | undo_all(isRedo); |
| 390 | db_lset_int("undo_available", 2-isRedo); |
| 391 | }else if( g.argc>=3 ){ |
| 392 | int i; |
| 393 | if( undo_available==0 ){ |
| 394 | fossil_fatal("nothing to %s", zCmd); |
| 395 | } |
| 396 | for(i=2; i<g.argc; i++){ |
| 397 | const char *zFile = g.argv[i]; |
| 398 | Blob path; |
| 399 | file_tree_name(zFile, &path, 1); |
| 400 | undo_one(blob_str(&path), isRedo); |
| 401 | blob_reset(&path); |
| 402 | } |
| 403 | } |
| 404 | vid2 = db_lget_int("checkout", 0); |
| 405 | if( vid1!=vid2 ){ |
| 406 | printf("--------------------\n"); |
| 407 | show_common_info(vid2, "updated-to:", 1, 0); |
| 408 | } |
| 409 | } |
| 410 | db_end_transaction(0); |
| 411 | } |
| 412 |
+56
-12
| --- src/update.c | ||
| +++ src/update.c | ||
| @@ -26,10 +26,40 @@ | ||
| 26 | 26 | ** Return true if artifact rid is a version |
| 27 | 27 | */ |
| 28 | 28 | int is_a_version(int rid){ |
| 29 | 29 | return db_exists("SELECT 1 FROM event WHERE objid=%d AND type='ci'", rid); |
| 30 | 30 | } |
| 31 | + | |
| 32 | +/* This variable is set if we are doing an internal update. It is clear | |
| 33 | +** when running the "update" command. | |
| 34 | +*/ | |
| 35 | +static int internalUpdate = 0; | |
| 36 | +static int internalConflictCnt = 0; | |
| 37 | + | |
| 38 | +/* | |
| 39 | +** Do an update to version vid. | |
| 40 | +** | |
| 41 | +** Start an undo session but do not terminate it. Do not autosync. | |
| 42 | +*/ | |
| 43 | +int update_to(int vid){ | |
| 44 | + int savedArgc; | |
| 45 | + char **savedArgv; | |
| 46 | + char *newArgv[3]; | |
| 47 | + newArgv[0] = g.argv[0]; | |
| 48 | + newArgv[1] = "update"; | |
| 49 | + newArgv[2] = 0; | |
| 50 | + savedArgv = g.argv; | |
| 51 | + savedArgc = g.argc; | |
| 52 | + g.argc = 2; | |
| 53 | + g.argv = newArgv; | |
| 54 | + internalUpdate = vid; | |
| 55 | + internalConflictCnt = 0; | |
| 56 | + update_cmd(); | |
| 57 | + g.argc = savedArgc; | |
| 58 | + g.argv = savedArgv; | |
| 59 | + return internalConflictCnt; | |
| 60 | +} | |
| 31 | 61 | |
| 32 | 62 | /* |
| 33 | 63 | ** COMMAND: update |
| 34 | 64 | ** |
| 35 | 65 | ** Usage: %fossil update ?VERSION? ?FILES...? |
| @@ -67,12 +97,14 @@ | ||
| 67 | 97 | int nChng; /* Number of file renames */ |
| 68 | 98 | int *aChng; /* Array of file renames */ |
| 69 | 99 | int i; /* Loop counter */ |
| 70 | 100 | int nConflict = 0; /* Number of merge conflicts */ |
| 71 | 101 | |
| 72 | - undo_capture_command_line(); | |
| 73 | - url_proxy_options(); | |
| 102 | + if( !internalUpdate ){ | |
| 103 | + undo_capture_command_line(); | |
| 104 | + url_proxy_options(); | |
| 105 | + } | |
| 74 | 106 | latestFlag = find_option("latest",0, 0)!=0; |
| 75 | 107 | nochangeFlag = find_option("nochange","n",0)!=0; |
| 76 | 108 | verboseFlag = find_option("verbose","v",0)!=0; |
| 77 | 109 | debugFlag = find_option("debug",0,0)!=0; |
| 78 | 110 | db_must_be_within_tree(); |
| @@ -81,13 +113,15 @@ | ||
| 81 | 113 | fossil_fatal("cannot find current version"); |
| 82 | 114 | } |
| 83 | 115 | if( !nochangeFlag && db_exists("SELECT 1 FROM vmerge") ){ |
| 84 | 116 | fossil_fatal("cannot update an uncommitted merge"); |
| 85 | 117 | } |
| 86 | - if( !nochangeFlag ) autosync(AUTOSYNC_PULL); | |
| 118 | + if( !nochangeFlag && !internalUpdate ) autosync(AUTOSYNC_PULL); | |
| 87 | 119 | |
| 88 | - if( g.argc>=3 ){ | |
| 120 | + if( internalUpdate ){ | |
| 121 | + tid = internalUpdate; | |
| 122 | + }else if( g.argc>=3 ){ | |
| 89 | 123 | if( strcmp(g.argv[2], "current")==0 ){ |
| 90 | 124 | /* If VERSION is "current", then use the same algorithm to find the |
| 91 | 125 | ** target as if VERSION were omitted. */ |
| 92 | 126 | }else if( strcmp(g.argv[2], "latest")==0 ){ |
| 93 | 127 | /* If VERSION is "latest", then use the same algorithm to find the |
| @@ -145,11 +179,11 @@ | ||
| 145 | 179 | } |
| 146 | 180 | |
| 147 | 181 | if( !verboseFlag && (tid==vid)) return; /* Nothing to update */ |
| 148 | 182 | db_begin_transaction(); |
| 149 | 183 | vfile_check_signature(vid, 1, 0); |
| 150 | - if( !nochangeFlag ) undo_begin(); | |
| 184 | + if( !nochangeFlag && !internalUpdate ) undo_begin(); | |
| 151 | 185 | load_vfile_from_rid(tid); |
| 152 | 186 | |
| 153 | 187 | /* |
| 154 | 188 | ** The record.fn field is used to match files against each other. The |
| 155 | 189 | ** FV table contains one row for each each unique filename in |
| @@ -369,14 +403,15 @@ | ||
| 369 | 403 | show_common_info(tid, "updated-to:", 1, 0); |
| 370 | 404 | |
| 371 | 405 | /* Report on conflicts |
| 372 | 406 | */ |
| 373 | 407 | if( nConflict && !nochangeFlag ){ |
| 374 | - printf( | |
| 375 | - "WARNING: merge conflicts - see messages above for details.\n" | |
| 376 | - "HINT: The \"fossil undo\" command will back out this update if " | |
| 377 | - "you want\n"); | |
| 408 | + if( internalUpdate ){ | |
| 409 | + internalConflictCnt = nConflict; | |
| 410 | + }else{ | |
| 411 | + printf("WARNING: merge conflicts - see messages above for details.\n"); | |
| 412 | + } | |
| 378 | 413 | } |
| 379 | 414 | |
| 380 | 415 | /* |
| 381 | 416 | ** Clean up the mid and pid VFILE entries. Then commit the changes. |
| 382 | 417 | */ |
| @@ -392,11 +427,11 @@ | ||
| 392 | 427 | }else{ |
| 393 | 428 | /* A subset of files have been checked out. Keep the current |
| 394 | 429 | ** checkout unchanged. */ |
| 395 | 430 | db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid); |
| 396 | 431 | } |
| 397 | - undo_finish(); | |
| 432 | + if( !internalUpdate ) undo_finish(); | |
| 398 | 433 | db_end_transaction(0); |
| 399 | 434 | } |
| 400 | 435 | } |
| 401 | 436 | |
| 402 | 437 | |
| @@ -520,18 +555,27 @@ | ||
| 520 | 555 | } |
| 521 | 556 | |
| 522 | 557 | if( errCode==2 ){ |
| 523 | 558 | fossil_warning("file not in repository: %s", zFile); |
| 524 | 559 | }else{ |
| 525 | - char *zFull = mprintf("%//%/", g.zLocalRoot, zFile); | |
| 560 | + char *zFull = mprintf("%/%/", g.zLocalRoot, zFile); | |
| 526 | 561 | undo_save(zFile); |
| 527 | 562 | blob_write_to_file(&record, zFull); |
| 528 | 563 | printf("REVERTED: %s\n", zFile); |
| 564 | + if( zRevision==0 ){ | |
| 565 | + sqlite3_int64 mtime = file_mtime(zFull); | |
| 566 | + db_multi_exec( | |
| 567 | + "UPDATE vfile" | |
| 568 | + " SET mtime=%lld, chnged=0, deleted=0," | |
| 569 | + " pathname=coalesce(origname,pathname), origname=NULL" | |
| 570 | + " WHERE pathname=%Q", | |
| 571 | + mtime, zFile | |
| 572 | + ); | |
| 573 | + } | |
| 529 | 574 | free(zFull); |
| 530 | 575 | } |
| 531 | 576 | blob_reset(&record); |
| 532 | 577 | } |
| 533 | 578 | db_finalize(&q); |
| 534 | 579 | undo_finish(); |
| 535 | 580 | db_end_transaction(0); |
| 536 | - printf("\"fossil undo\" is available to undo the changes shown above.\n"); | |
| 537 | 581 | } |
| 538 | 582 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -26,10 +26,40 @@ | |
| 26 | ** Return true if artifact rid is a version |
| 27 | */ |
| 28 | int is_a_version(int rid){ |
| 29 | return db_exists("SELECT 1 FROM event WHERE objid=%d AND type='ci'", rid); |
| 30 | } |
| 31 | |
| 32 | /* |
| 33 | ** COMMAND: update |
| 34 | ** |
| 35 | ** Usage: %fossil update ?VERSION? ?FILES...? |
| @@ -67,12 +97,14 @@ | |
| 67 | int nChng; /* Number of file renames */ |
| 68 | int *aChng; /* Array of file renames */ |
| 69 | int i; /* Loop counter */ |
| 70 | int nConflict = 0; /* Number of merge conflicts */ |
| 71 | |
| 72 | undo_capture_command_line(); |
| 73 | url_proxy_options(); |
| 74 | latestFlag = find_option("latest",0, 0)!=0; |
| 75 | nochangeFlag = find_option("nochange","n",0)!=0; |
| 76 | verboseFlag = find_option("verbose","v",0)!=0; |
| 77 | debugFlag = find_option("debug",0,0)!=0; |
| 78 | db_must_be_within_tree(); |
| @@ -81,13 +113,15 @@ | |
| 81 | fossil_fatal("cannot find current version"); |
| 82 | } |
| 83 | if( !nochangeFlag && db_exists("SELECT 1 FROM vmerge") ){ |
| 84 | fossil_fatal("cannot update an uncommitted merge"); |
| 85 | } |
| 86 | if( !nochangeFlag ) autosync(AUTOSYNC_PULL); |
| 87 | |
| 88 | if( g.argc>=3 ){ |
| 89 | if( strcmp(g.argv[2], "current")==0 ){ |
| 90 | /* If VERSION is "current", then use the same algorithm to find the |
| 91 | ** target as if VERSION were omitted. */ |
| 92 | }else if( strcmp(g.argv[2], "latest")==0 ){ |
| 93 | /* If VERSION is "latest", then use the same algorithm to find the |
| @@ -145,11 +179,11 @@ | |
| 145 | } |
| 146 | |
| 147 | if( !verboseFlag && (tid==vid)) return; /* Nothing to update */ |
| 148 | db_begin_transaction(); |
| 149 | vfile_check_signature(vid, 1, 0); |
| 150 | if( !nochangeFlag ) undo_begin(); |
| 151 | load_vfile_from_rid(tid); |
| 152 | |
| 153 | /* |
| 154 | ** The record.fn field is used to match files against each other. The |
| 155 | ** FV table contains one row for each each unique filename in |
| @@ -369,14 +403,15 @@ | |
| 369 | show_common_info(tid, "updated-to:", 1, 0); |
| 370 | |
| 371 | /* Report on conflicts |
| 372 | */ |
| 373 | if( nConflict && !nochangeFlag ){ |
| 374 | printf( |
| 375 | "WARNING: merge conflicts - see messages above for details.\n" |
| 376 | "HINT: The \"fossil undo\" command will back out this update if " |
| 377 | "you want\n"); |
| 378 | } |
| 379 | |
| 380 | /* |
| 381 | ** Clean up the mid and pid VFILE entries. Then commit the changes. |
| 382 | */ |
| @@ -392,11 +427,11 @@ | |
| 392 | }else{ |
| 393 | /* A subset of files have been checked out. Keep the current |
| 394 | ** checkout unchanged. */ |
| 395 | db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid); |
| 396 | } |
| 397 | undo_finish(); |
| 398 | db_end_transaction(0); |
| 399 | } |
| 400 | } |
| 401 | |
| 402 | |
| @@ -520,18 +555,27 @@ | |
| 520 | } |
| 521 | |
| 522 | if( errCode==2 ){ |
| 523 | fossil_warning("file not in repository: %s", zFile); |
| 524 | }else{ |
| 525 | char *zFull = mprintf("%//%/", g.zLocalRoot, zFile); |
| 526 | undo_save(zFile); |
| 527 | blob_write_to_file(&record, zFull); |
| 528 | printf("REVERTED: %s\n", zFile); |
| 529 | free(zFull); |
| 530 | } |
| 531 | blob_reset(&record); |
| 532 | } |
| 533 | db_finalize(&q); |
| 534 | undo_finish(); |
| 535 | db_end_transaction(0); |
| 536 | printf("\"fossil undo\" is available to undo the changes shown above.\n"); |
| 537 | } |
| 538 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -26,10 +26,40 @@ | |
| 26 | ** Return true if artifact rid is a version |
| 27 | */ |
| 28 | int is_a_version(int rid){ |
| 29 | return db_exists("SELECT 1 FROM event WHERE objid=%d AND type='ci'", rid); |
| 30 | } |
| 31 | |
| 32 | /* This variable is set if we are doing an internal update. It is clear |
| 33 | ** when running the "update" command. |
| 34 | */ |
| 35 | static int internalUpdate = 0; |
| 36 | static int internalConflictCnt = 0; |
| 37 | |
| 38 | /* |
| 39 | ** Do an update to version vid. |
| 40 | ** |
| 41 | ** Start an undo session but do not terminate it. Do not autosync. |
| 42 | */ |
| 43 | int update_to(int vid){ |
| 44 | int savedArgc; |
| 45 | char **savedArgv; |
| 46 | char *newArgv[3]; |
| 47 | newArgv[0] = g.argv[0]; |
| 48 | newArgv[1] = "update"; |
| 49 | newArgv[2] = 0; |
| 50 | savedArgv = g.argv; |
| 51 | savedArgc = g.argc; |
| 52 | g.argc = 2; |
| 53 | g.argv = newArgv; |
| 54 | internalUpdate = vid; |
| 55 | internalConflictCnt = 0; |
| 56 | update_cmd(); |
| 57 | g.argc = savedArgc; |
| 58 | g.argv = savedArgv; |
| 59 | return internalConflictCnt; |
| 60 | } |
| 61 | |
| 62 | /* |
| 63 | ** COMMAND: update |
| 64 | ** |
| 65 | ** Usage: %fossil update ?VERSION? ?FILES...? |
| @@ -67,12 +97,14 @@ | |
| 97 | int nChng; /* Number of file renames */ |
| 98 | int *aChng; /* Array of file renames */ |
| 99 | int i; /* Loop counter */ |
| 100 | int nConflict = 0; /* Number of merge conflicts */ |
| 101 | |
| 102 | if( !internalUpdate ){ |
| 103 | undo_capture_command_line(); |
| 104 | url_proxy_options(); |
| 105 | } |
| 106 | latestFlag = find_option("latest",0, 0)!=0; |
| 107 | nochangeFlag = find_option("nochange","n",0)!=0; |
| 108 | verboseFlag = find_option("verbose","v",0)!=0; |
| 109 | debugFlag = find_option("debug",0,0)!=0; |
| 110 | db_must_be_within_tree(); |
| @@ -81,13 +113,15 @@ | |
| 113 | fossil_fatal("cannot find current version"); |
| 114 | } |
| 115 | if( !nochangeFlag && db_exists("SELECT 1 FROM vmerge") ){ |
| 116 | fossil_fatal("cannot update an uncommitted merge"); |
| 117 | } |
| 118 | if( !nochangeFlag && !internalUpdate ) autosync(AUTOSYNC_PULL); |
| 119 | |
| 120 | if( internalUpdate ){ |
| 121 | tid = internalUpdate; |
| 122 | }else if( g.argc>=3 ){ |
| 123 | if( strcmp(g.argv[2], "current")==0 ){ |
| 124 | /* If VERSION is "current", then use the same algorithm to find the |
| 125 | ** target as if VERSION were omitted. */ |
| 126 | }else if( strcmp(g.argv[2], "latest")==0 ){ |
| 127 | /* If VERSION is "latest", then use the same algorithm to find the |
| @@ -145,11 +179,11 @@ | |
| 179 | } |
| 180 | |
| 181 | if( !verboseFlag && (tid==vid)) return; /* Nothing to update */ |
| 182 | db_begin_transaction(); |
| 183 | vfile_check_signature(vid, 1, 0); |
| 184 | if( !nochangeFlag && !internalUpdate ) undo_begin(); |
| 185 | load_vfile_from_rid(tid); |
| 186 | |
| 187 | /* |
| 188 | ** The record.fn field is used to match files against each other. The |
| 189 | ** FV table contains one row for each each unique filename in |
| @@ -369,14 +403,15 @@ | |
| 403 | show_common_info(tid, "updated-to:", 1, 0); |
| 404 | |
| 405 | /* Report on conflicts |
| 406 | */ |
| 407 | if( nConflict && !nochangeFlag ){ |
| 408 | if( internalUpdate ){ |
| 409 | internalConflictCnt = nConflict; |
| 410 | }else{ |
| 411 | printf("WARNING: merge conflicts - see messages above for details.\n"); |
| 412 | } |
| 413 | } |
| 414 | |
| 415 | /* |
| 416 | ** Clean up the mid and pid VFILE entries. Then commit the changes. |
| 417 | */ |
| @@ -392,11 +427,11 @@ | |
| 427 | }else{ |
| 428 | /* A subset of files have been checked out. Keep the current |
| 429 | ** checkout unchanged. */ |
| 430 | db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid); |
| 431 | } |
| 432 | if( !internalUpdate ) undo_finish(); |
| 433 | db_end_transaction(0); |
| 434 | } |
| 435 | } |
| 436 | |
| 437 | |
| @@ -520,18 +555,27 @@ | |
| 555 | } |
| 556 | |
| 557 | if( errCode==2 ){ |
| 558 | fossil_warning("file not in repository: %s", zFile); |
| 559 | }else{ |
| 560 | char *zFull = mprintf("%/%/", g.zLocalRoot, zFile); |
| 561 | undo_save(zFile); |
| 562 | blob_write_to_file(&record, zFull); |
| 563 | printf("REVERTED: %s\n", zFile); |
| 564 | if( zRevision==0 ){ |
| 565 | sqlite3_int64 mtime = file_mtime(zFull); |
| 566 | db_multi_exec( |
| 567 | "UPDATE vfile" |
| 568 | " SET mtime=%lld, chnged=0, deleted=0," |
| 569 | " pathname=coalesce(origname,pathname), origname=NULL" |
| 570 | " WHERE pathname=%Q", |
| 571 | mtime, zFile |
| 572 | ); |
| 573 | } |
| 574 | free(zFull); |
| 575 | } |
| 576 | blob_reset(&record); |
| 577 | } |
| 578 | db_finalize(&q); |
| 579 | undo_finish(); |
| 580 | db_end_transaction(0); |
| 581 | } |
| 582 |