| | @@ -62,17 +62,23 @@ |
| 62 | 62 | ** The ~/.fossil file records the location of all repositories for a |
| 63 | 63 | ** user. This command performs certain operations on all repositories |
| 64 | 64 | ** that can be useful before or after a period of disconnection operation. |
| 65 | 65 | ** Available operations are: |
| 66 | 66 | ** |
| 67 | | -** list Display the location of all repositories |
| 67 | +** list Display the location of all repositories |
| 68 | +** |
| 69 | +** pull Run a "pull" operation on all repositories |
| 70 | +** |
| 71 | +** push Run a "push" on all repositories |
| 72 | +** |
| 73 | +** rebuild Rebuild on all repositories |
| 68 | 74 | ** |
| 69 | | -** pull Run a "pull" operation on all repositories |
| 75 | +** sync Run a "sync" on all repositories |
| 70 | 76 | ** |
| 71 | | -** push Run a "push" on all repositories |
| 72 | | -** |
| 73 | | -** sync Run a "sync" on all repositories |
| 77 | +** Respositories are automatically added to the set of known repositories |
| 78 | +** when one of the following commands against the repository: clone, info, |
| 79 | +** pull, push, or sync |
| 74 | 80 | */ |
| 75 | 81 | void all_cmd(void){ |
| 76 | 82 | int n; |
| 77 | 83 | Stmt q; |
| 78 | 84 | const char *zCmd; |
| | @@ -80,31 +86,33 @@ |
| 80 | 86 | char *zFossil; |
| 81 | 87 | char *zQFilename; |
| 82 | 88 | int nMissing; |
| 83 | 89 | |
| 84 | 90 | if( g.argc<3 ){ |
| 85 | | - usage("list|pull|push|sync"); |
| 91 | + usage("list|pull|push|rebuild|sync"); |
| 86 | 92 | } |
| 87 | 93 | n = strlen(g.argv[2]); |
| 88 | 94 | db_open_config(); |
| 89 | | - db_prepare(&q, "SELECT substr(name, 6) FROM global_config" |
| 90 | | - " WHERE substr(name, 1, 5)=='repo:' ORDER BY 1"); |
| 91 | 95 | zCmd = g.argv[2]; |
| 92 | 96 | if( strncmp(zCmd, "list", n)==0 ){ |
| 93 | 97 | zCmd = "list"; |
| 94 | 98 | }else if( strncmp(zCmd, "push", n)==0 ){ |
| 95 | | - zCmd = "push"; |
| 99 | + zCmd = "push -autourl -R"; |
| 96 | 100 | }else if( strncmp(zCmd, "pull", n)==0 ){ |
| 97 | | - zCmd = "pull"; |
| 101 | + zCmd = "pull -autourl -R"; |
| 102 | + }else if( strncmp(zCmd, "rebuild", n)==0 ){ |
| 103 | + zCmd = "rebuild"; |
| 98 | 104 | }else if( strncmp(zCmd, "sync", n)==0 ){ |
| 99 | | - zCmd = "sync"; |
| 105 | + zCmd = "sync -autourl -R"; |
| 100 | 106 | }else{ |
| 101 | 107 | fossil_fatal("\"all\" subcommand should be one of: " |
| 102 | 108 | "list push pull sync"); |
| 103 | 109 | } |
| 104 | 110 | zFossil = quoteFilename(g.argv[0]); |
| 105 | 111 | nMissing = 0; |
| 112 | + db_prepare(&q, "SELECT substr(name, 6) FROM global_config" |
| 113 | + " WHERE substr(name, 1, 5)=='repo:' ORDER BY 1"); |
| 106 | 114 | while( db_step(&q)==SQLITE_ROW ){ |
| 107 | 115 | const char *zFilename = db_column_text(&q, 0); |
| 108 | 116 | if( access(zFilename, 0) ){ |
| 109 | 117 | nMissing++; |
| 110 | 118 | continue; |
| | @@ -112,12 +120,11 @@ |
| 112 | 120 | if( zCmd[0]=='l' ){ |
| 113 | 121 | printf("%s\n", zFilename); |
| 114 | 122 | continue; |
| 115 | 123 | } |
| 116 | 124 | zQFilename = quoteFilename(zFilename); |
| 117 | | - zSyscmd = mprintf("%s %s -R %s -autourl", |
| 118 | | - zFossil, zCmd, zQFilename); |
| 125 | + zSyscmd = mprintf("%s %s %s", zFossil, zCmd, zQFilename); |
| 119 | 126 | printf("%s\n", zSyscmd); |
| 120 | 127 | fflush(stdout); |
| 121 | 128 | system(zSyscmd); |
| 122 | 129 | free(zSyscmd); |
| 123 | 130 | free(zQFilename); |
| | @@ -135,9 +142,10 @@ |
| 135 | 142 | char *zRepo = mprintf("repo:%s", zFilename); |
| 136 | 143 | db_unset(zRepo, 1); |
| 137 | 144 | free(zRepo); |
| 138 | 145 | } |
| 139 | 146 | } |
| 140 | | - db_finalize(&q); |
| 147 | + db_reset(&q); |
| 141 | 148 | db_end_transaction(0); |
| 142 | 149 | } |
| 150 | + db_finalize(&q); |
| 143 | 151 | } |
| 144 | 152 | |