Fossil SCM
Do away with the --resume flag as it is mostly redundant and can be assumed by the presence of the recorded clone_seqno. Suggested by Warren Young in [forum:4bcbb41aab2538d4|forum post 4bcbb41aab2538d4].
Commit
b0a60d8f1d3c302365b86b1d11a73134ddc80991338b9fe8663f830e07b42715
Parent
61e0ced9bfbc4a5…
1 file changed
+10
-5
+10
-5
| --- src/clone.c | ||
| +++ src/clone.c | ||
| @@ -129,11 +129,10 @@ | ||
| 129 | 129 | ** check-out |
| 130 | 130 | ** --nocompress Omit extra delta compression |
| 131 | 131 | ** --no-open Clone only. Do not open a check-out. |
| 132 | 132 | ** --once Don't remember the URI. |
| 133 | 133 | ** --private Also clone private branches |
| 134 | -** --resume Resume a failed clone | |
| 135 | 134 | ** --save-http-password Remember the HTTP password without asking |
| 136 | 135 | ** -c|--ssh-command SSH Use SSH as the "ssh" command |
| 137 | 136 | ** --ssl-identity FILENAME Use the SSL identity if requested by the server |
| 138 | 137 | ** --transport-command CMD Use CMD to move messages to the server and back |
| 139 | 138 | ** -u|--unversioned Also sync unversioned content |
| @@ -150,11 +149,11 @@ | ||
| 150 | 149 | int urlFlags = URL_PROMPT_PW | URL_REMEMBER; |
| 151 | 150 | int syncFlags = SYNC_CLONE; |
| 152 | 151 | int noCompress = find_option("nocompress",0,0)!=0; |
| 153 | 152 | int noOpen = find_option("no-open",0,0)!=0; |
| 154 | 153 | int allowNested = find_option("nested",0,0)!=0; /* Used by open */ |
| 155 | - int bResume = find_option("resume",0,0)!=0; /* Resume a failed clone */ | |
| 154 | + int bResume = 0; /* Set if a previous clone failed */ | |
| 156 | 155 | const char *zRepo = 0; /* Name of the new local repository file */ |
| 157 | 156 | const char *zWorkDir = 0; /* Open in this directory, if not zero */ |
| 158 | 157 | |
| 159 | 158 | |
| 160 | 159 | /* Also clone private branches */ |
| @@ -199,12 +198,17 @@ | ||
| 199 | 198 | if( zWorkDir==0 ){ |
| 200 | 199 | zWorkDir = mprintf("./%s", zBase); |
| 201 | 200 | } |
| 202 | 201 | fossil_free(zBase); |
| 203 | 202 | } |
| 204 | - if( -1 != file_size(zRepo, ExtFILE) && bResume==0 ){ | |
| 205 | - fossil_fatal("file already exists: %s", zRepo); | |
| 203 | + if( -1 != file_size(zRepo, ExtFILE) ){ | |
| 204 | + db_open_repository(zRepo); | |
| 205 | + bResume = db_get_int("aux-clone-seqno",0)!=0; | |
| 206 | + db_close(0); | |
| 207 | + if( !bResume ){ | |
| 208 | + fossil_fatal("file already exists: %s", zRepo); | |
| 209 | + } | |
| 206 | 210 | } |
| 207 | 211 | /* Fail before clone if open will fail because inside an open check-out */ |
| 208 | 212 | if( zWorkDir!=0 && zWorkDir[0]!=0 && !noOpen ){ |
| 209 | 213 | if( db_open_local_v2(0, allowNested) ){ |
| 210 | 214 | fossil_fatal("there is already an open tree at %s", g.zLocalRoot); |
| @@ -295,11 +299,12 @@ | ||
| 295 | 299 | } |
| 296 | 300 | db_begin_transaction(); |
| 297 | 301 | if( db_exists("SELECT 1 FROM delta WHERE srcId IN phantom") ){ |
| 298 | 302 | fossil_warning("there are unresolved deltas -" |
| 299 | 303 | " the clone is probably incomplete and unusable.\n" |
| 300 | - "It may be possible to continue clone with --resume."); | |
| 304 | + "It may be possible to resume the clone by running the" | |
| 305 | + " same command."); | |
| 301 | 306 | } |
| 302 | 307 | fossil_print("Rebuilding repository meta-data...\n"); |
| 303 | 308 | rebuild_db(1, 0); |
| 304 | 309 | if( !noCompress ){ |
| 305 | 310 | int nDelta = 0; |
| 306 | 311 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -129,11 +129,10 @@ | |
| 129 | ** check-out |
| 130 | ** --nocompress Omit extra delta compression |
| 131 | ** --no-open Clone only. Do not open a check-out. |
| 132 | ** --once Don't remember the URI. |
| 133 | ** --private Also clone private branches |
| 134 | ** --resume Resume a failed clone |
| 135 | ** --save-http-password Remember the HTTP password without asking |
| 136 | ** -c|--ssh-command SSH Use SSH as the "ssh" command |
| 137 | ** --ssl-identity FILENAME Use the SSL identity if requested by the server |
| 138 | ** --transport-command CMD Use CMD to move messages to the server and back |
| 139 | ** -u|--unversioned Also sync unversioned content |
| @@ -150,11 +149,11 @@ | |
| 150 | int urlFlags = URL_PROMPT_PW | URL_REMEMBER; |
| 151 | int syncFlags = SYNC_CLONE; |
| 152 | int noCompress = find_option("nocompress",0,0)!=0; |
| 153 | int noOpen = find_option("no-open",0,0)!=0; |
| 154 | int allowNested = find_option("nested",0,0)!=0; /* Used by open */ |
| 155 | int bResume = find_option("resume",0,0)!=0; /* Resume a failed clone */ |
| 156 | const char *zRepo = 0; /* Name of the new local repository file */ |
| 157 | const char *zWorkDir = 0; /* Open in this directory, if not zero */ |
| 158 | |
| 159 | |
| 160 | /* Also clone private branches */ |
| @@ -199,12 +198,17 @@ | |
| 199 | if( zWorkDir==0 ){ |
| 200 | zWorkDir = mprintf("./%s", zBase); |
| 201 | } |
| 202 | fossil_free(zBase); |
| 203 | } |
| 204 | if( -1 != file_size(zRepo, ExtFILE) && bResume==0 ){ |
| 205 | fossil_fatal("file already exists: %s", zRepo); |
| 206 | } |
| 207 | /* Fail before clone if open will fail because inside an open check-out */ |
| 208 | if( zWorkDir!=0 && zWorkDir[0]!=0 && !noOpen ){ |
| 209 | if( db_open_local_v2(0, allowNested) ){ |
| 210 | fossil_fatal("there is already an open tree at %s", g.zLocalRoot); |
| @@ -295,11 +299,12 @@ | |
| 295 | } |
| 296 | db_begin_transaction(); |
| 297 | if( db_exists("SELECT 1 FROM delta WHERE srcId IN phantom") ){ |
| 298 | fossil_warning("there are unresolved deltas -" |
| 299 | " the clone is probably incomplete and unusable.\n" |
| 300 | "It may be possible to continue clone with --resume."); |
| 301 | } |
| 302 | fossil_print("Rebuilding repository meta-data...\n"); |
| 303 | rebuild_db(1, 0); |
| 304 | if( !noCompress ){ |
| 305 | int nDelta = 0; |
| 306 |
| --- src/clone.c | |
| +++ src/clone.c | |
| @@ -129,11 +129,10 @@ | |
| 129 | ** check-out |
| 130 | ** --nocompress Omit extra delta compression |
| 131 | ** --no-open Clone only. Do not open a check-out. |
| 132 | ** --once Don't remember the URI. |
| 133 | ** --private Also clone private branches |
| 134 | ** --save-http-password Remember the HTTP password without asking |
| 135 | ** -c|--ssh-command SSH Use SSH as the "ssh" command |
| 136 | ** --ssl-identity FILENAME Use the SSL identity if requested by the server |
| 137 | ** --transport-command CMD Use CMD to move messages to the server and back |
| 138 | ** -u|--unversioned Also sync unversioned content |
| @@ -150,11 +149,11 @@ | |
| 149 | int urlFlags = URL_PROMPT_PW | URL_REMEMBER; |
| 150 | int syncFlags = SYNC_CLONE; |
| 151 | int noCompress = find_option("nocompress",0,0)!=0; |
| 152 | int noOpen = find_option("no-open",0,0)!=0; |
| 153 | int allowNested = find_option("nested",0,0)!=0; /* Used by open */ |
| 154 | int bResume = 0; /* Set if a previous clone failed */ |
| 155 | const char *zRepo = 0; /* Name of the new local repository file */ |
| 156 | const char *zWorkDir = 0; /* Open in this directory, if not zero */ |
| 157 | |
| 158 | |
| 159 | /* Also clone private branches */ |
| @@ -199,12 +198,17 @@ | |
| 198 | if( zWorkDir==0 ){ |
| 199 | zWorkDir = mprintf("./%s", zBase); |
| 200 | } |
| 201 | fossil_free(zBase); |
| 202 | } |
| 203 | if( -1 != file_size(zRepo, ExtFILE) ){ |
| 204 | db_open_repository(zRepo); |
| 205 | bResume = db_get_int("aux-clone-seqno",0)!=0; |
| 206 | db_close(0); |
| 207 | if( !bResume ){ |
| 208 | fossil_fatal("file already exists: %s", zRepo); |
| 209 | } |
| 210 | } |
| 211 | /* Fail before clone if open will fail because inside an open check-out */ |
| 212 | if( zWorkDir!=0 && zWorkDir[0]!=0 && !noOpen ){ |
| 213 | if( db_open_local_v2(0, allowNested) ){ |
| 214 | fossil_fatal("there is already an open tree at %s", g.zLocalRoot); |
| @@ -295,11 +299,12 @@ | |
| 299 | } |
| 300 | db_begin_transaction(); |
| 301 | if( db_exists("SELECT 1 FROM delta WHERE srcId IN phantom") ){ |
| 302 | fossil_warning("there are unresolved deltas -" |
| 303 | " the clone is probably incomplete and unusable.\n" |
| 304 | "It may be possible to resume the clone by running the" |
| 305 | " same command."); |
| 306 | } |
| 307 | fossil_print("Rebuilding repository meta-data...\n"); |
| 308 | rebuild_db(1, 0); |
| 309 | if( !noCompress ){ |
| 310 | int nDelta = 0; |
| 311 |