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].

andybradford 2023-11-24 23:51 clone-resume
Commit b0a60d8f1d3c302365b86b1d11a73134ddc80991338b9fe8663f830e07b42715
1 file changed +10 -5
+10 -5
--- src/clone.c
+++ src/clone.c
@@ -129,11 +129,10 @@
129129
** check-out
130130
** --nocompress Omit extra delta compression
131131
** --no-open Clone only. Do not open a check-out.
132132
** --once Don't remember the URI.
133133
** --private Also clone private branches
134
-** --resume Resume a failed clone
135134
** --save-http-password Remember the HTTP password without asking
136135
** -c|--ssh-command SSH Use SSH as the "ssh" command
137136
** --ssl-identity FILENAME Use the SSL identity if requested by the server
138137
** --transport-command CMD Use CMD to move messages to the server and back
139138
** -u|--unversioned Also sync unversioned content
@@ -150,11 +149,11 @@
150149
int urlFlags = URL_PROMPT_PW | URL_REMEMBER;
151150
int syncFlags = SYNC_CLONE;
152151
int noCompress = find_option("nocompress",0,0)!=0;
153152
int noOpen = find_option("no-open",0,0)!=0;
154153
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 */
156155
const char *zRepo = 0; /* Name of the new local repository file */
157156
const char *zWorkDir = 0; /* Open in this directory, if not zero */
158157
159158
160159
/* Also clone private branches */
@@ -199,12 +198,17 @@
199198
if( zWorkDir==0 ){
200199
zWorkDir = mprintf("./%s", zBase);
201200
}
202201
fossil_free(zBase);
203202
}
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
+ }
206210
}
207211
/* Fail before clone if open will fail because inside an open check-out */
208212
if( zWorkDir!=0 && zWorkDir[0]!=0 && !noOpen ){
209213
if( db_open_local_v2(0, allowNested) ){
210214
fossil_fatal("there is already an open tree at %s", g.zLocalRoot);
@@ -295,11 +299,12 @@
295299
}
296300
db_begin_transaction();
297301
if( db_exists("SELECT 1 FROM delta WHERE srcId IN phantom") ){
298302
fossil_warning("there are unresolved deltas -"
299303
" 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.");
301306
}
302307
fossil_print("Rebuilding repository meta-data...\n");
303308
rebuild_db(1, 0);
304309
if( !noCompress ){
305310
int nDelta = 0;
306311
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button