Fossil

Check-in [ec264714]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Attempt to resume a clone during the next sync or pull by tracking a failed clone operation.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | clone-resume
Files: files | file ages | folders
SHA3-256: ec26471439ec529446d9f125a7a0761fa3cdcb971baed11fde546ab13b0af88e
User & Date: andybradford 2019-10-09 14:52:29
Context
2019-10-24
14:30
Merge in latest from main line. Leaf check-in: f882d5cb user: andybradford tags: clone-resume
2019-10-09
14:52
Attempt to resume a clone during the next sync or pull by tracking a failed clone operation. check-in: ec264714 user: andybradford tags: clone-resume
2019-10-08
16:00
Increase the version number to 2.11 for the next release cycle. check-in: 10fb90fc user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/clone.c.

181
182
183
184
185
186
187

188
189
190
191
192
193
194
...
205
206
207
208
209
210
211
212
213
214
215
216


217


218
219
220
221
222
223
224
...
232
233
234
235
236
237
238




239
240
241
242
243
244
245
    db_open_config(0,0);
    db_begin_transaction();
    db_record_repository_filename(g.argv[3]);
    db_initial_setup(0, 0, zDefaultUser);
    user_select();
    db_set("content-schema", CONTENT_SCHEMA, 0);
    db_set("aux-schema", AUX_SCHEMA_MAX, 0);

    db_set("rebuilt", get_version(), 0);
    db_unset("hash-policy", 0);
    remember_or_get_http_auth(zHttpAuth, urlFlags & URL_REMEMBER, g.argv[2]);
    url_remember();
    if( g.zSSLIdentity!=0 ){
      /* If the --ssl-identity option was specified, store it as a setting */
      Blob fn;
................................................................................
    url_enable_proxy(0);
    clone_ssh_db_set_options();
    url_get_password_if_needed();
    g.xlinkClusterOnly = 1;
    nErr = client_sync(syncFlags,CONFIGSET_ALL,0);
    g.xlinkClusterOnly = 0;
    verify_cancel();
    db_end_transaction(0);
    db_close(1);
    if( nErr ){
      file_delete(g.argv[3]);
      fossil_fatal("server returned an error - clone aborted");


    }


    db_open_repository(g.argv[3]);
  }
  db_begin_transaction();
  fossil_print("Rebuilding repository meta-data...\n");
  rebuild_db(0, 1, 0);
  if( !noCompress ){
    fossil_print("Extra delta compression... "); fflush(stdout);
................................................................................
     db_multi_exec("PRAGMA page_size=8192;");
  }
  db_multi_exec("VACUUM");
  fossil_print("\nproject-id: %s\n", db_get("project-code", 0));
  fossil_print("server-id:  %s\n", db_get("server-code", 0));
  zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
  fossil_print("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword);




}

/*
** If user chooses to use HTTP Authentication over unencrypted HTTP,
** remember decision.  Otherwise, if the URL is being changed and no
** preference has been indicated, err on the safe side and revert the
** decision. Set the global preference if the URL is not being changed.







>







 







<
<

<
|
>
>

>
>







 







>
>
>
>







181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
...
206
207
208
209
210
211
212


213

214
215
216
217
218
219
220
221
222
223
224
225
226
...
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
    db_open_config(0,0);
    db_begin_transaction();
    db_record_repository_filename(g.argv[3]);
    db_initial_setup(0, 0, zDefaultUser);
    user_select();
    db_set("content-schema", CONTENT_SCHEMA, 0);
    db_set("aux-schema", AUX_SCHEMA_MAX, 0);
    db_set("aux-clone-incomplete", "1", 0);
    db_set("rebuilt", get_version(), 0);
    db_unset("hash-policy", 0);
    remember_or_get_http_auth(zHttpAuth, urlFlags & URL_REMEMBER, g.argv[2]);
    url_remember();
    if( g.zSSLIdentity!=0 ){
      /* If the --ssl-identity option was specified, store it as a setting */
      Blob fn;
................................................................................
    url_enable_proxy(0);
    clone_ssh_db_set_options();
    url_get_password_if_needed();
    g.xlinkClusterOnly = 1;
    nErr = client_sync(syncFlags,CONFIGSET_ALL,0);
    g.xlinkClusterOnly = 0;
    verify_cancel();


    if( nErr ){

      fossil_warning("server returned an error - clone incomplete");
    }else{
      db_set("aux-clone-finished", "0", 0);
    }
    db_end_transaction(0);
    db_close(1);
    db_open_repository(g.argv[3]);
  }
  db_begin_transaction();
  fossil_print("Rebuilding repository meta-data...\n");
  rebuild_db(0, 1, 0);
  if( !noCompress ){
    fossil_print("Extra delta compression... "); fflush(stdout);
................................................................................
     db_multi_exec("PRAGMA page_size=8192;");
  }
  db_multi_exec("VACUUM");
  fossil_print("\nproject-id: %s\n", db_get("project-code", 0));
  fossil_print("server-id:  %s\n", db_get("server-code", 0));
  zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
  fossil_print("admin-user: %s (password is \"%s\")\n", g.zLogin, zPassword);
  if( nErr ){
    fossil_warning("clone operation had errors. "
                   "Run \"fossil pull\" to complete clone.");
  }
}

/*
** If user chooses to use HTTP Authentication over unencrypted HTTP,
** remember decision.  Otherwise, if the URL is being changed and no
** preference has been indicated, err on the safe side and revert the
** decision. Set the global preference if the URL is not being changed.

Changes to src/sync.c.

228
229
230
231
232
233
234

235
236
237
238




239
240
241
242
243



244
245
246
247
248
249
250
...
319
320
321
322
323
324
325

326
327
328
329




330
331
332
333
334
335
336
337
338




339
340
341
342
343
344
345
**                              to ensure no content is overlooked
**
** See also: clone, config pull, push, remote-url, sync
*/
void pull_cmd(void){
  unsigned configFlags = 0;
  unsigned syncFlags = SYNC_PULL;

  if( find_option("from-parent-project",0,0)!=0 ){
    syncFlags |= SYNC_FROMPARENT;
  }
  process_sync_args(&configFlags, &syncFlags, 0);





  /* We should be done with options.. */
  verify_all_options();

  client_sync(syncFlags, configFlags, 0);



}

/*
** COMMAND: push
**
** Usage: %fossil push ?URL? ?options?
**
................................................................................
**                              to ensure no content is overlooked
**
** See also: clone, pull, push, remote-url
*/
void sync_cmd(void){
  unsigned configFlags = 0;
  unsigned syncFlags = SYNC_PUSH|SYNC_PULL;

  if( find_option("unversioned","u",0)!=0 ){
    syncFlags |= SYNC_UNVERSIONED;
  }
  process_sync_args(&configFlags, &syncFlags, 0);





  /* We should be done with options.. */
  verify_all_options();

  if( db_get_boolean("dont-push",0) ) syncFlags &= ~SYNC_PUSH;
  client_sync(syncFlags, configFlags, 0);
  if( (syncFlags & SYNC_PUSH)==0 ){
    fossil_warning("pull only: the 'dont-push' option is set");
  }




}

/*
** Handle the "fossil unversioned sync" and "fossil unversioned revert"
** commands.
*/
void sync_unversioned(unsigned syncFlags){







>




>
>
>
>




|
>
>
>







 







>




>
>
>
>





|



>
>
>
>







228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
...
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
**                              to ensure no content is overlooked
**
** See also: clone, config pull, push, remote-url, sync
*/
void pull_cmd(void){
  unsigned configFlags = 0;
  unsigned syncFlags = SYNC_PULL;
  int nErr = 0;
  if( find_option("from-parent-project",0,0)!=0 ){
    syncFlags |= SYNC_FROMPARENT;
  }
  process_sync_args(&configFlags, &syncFlags, 0);
  if( db_get_boolean("aux-clone-incomplete", 0) ){
    syncFlags |= SYNC_RESYNC;
    configFlags |= CONFIGSET_ALL;
  }

  /* We should be done with options.. */
  verify_all_options();

  nErr = client_sync(syncFlags, configFlags, 0);
  if( db_get_boolean("aux-clone-incomplete", 0) && nErr==0 ){
    db_set("aux-clone-incomplete", "0", 0);
  }
}

/*
** COMMAND: push
**
** Usage: %fossil push ?URL? ?options?
**
................................................................................
**                              to ensure no content is overlooked
**
** See also: clone, pull, push, remote-url
*/
void sync_cmd(void){
  unsigned configFlags = 0;
  unsigned syncFlags = SYNC_PUSH|SYNC_PULL;
  int nErr = 0;
  if( find_option("unversioned","u",0)!=0 ){
    syncFlags |= SYNC_UNVERSIONED;
  }
  process_sync_args(&configFlags, &syncFlags, 0);
  if( db_get_boolean("aux-clone-incomplete", 0) ){
    syncFlags |= SYNC_RESYNC;
    configFlags |= CONFIGSET_ALL;
  }

  /* We should be done with options.. */
  verify_all_options();

  if( db_get_boolean("dont-push",0) ) syncFlags &= ~SYNC_PUSH;
  nErr = client_sync(syncFlags, configFlags, 0);
  if( (syncFlags & SYNC_PUSH)==0 ){
    fossil_warning("pull only: the 'dont-push' option is set");
  }
  if( (syncFlags & SYNC_PULL)==0 &&
      db_get_boolean("aux-clone-incomplete", 0) && nErr==0 ){
    db_set("aux-clone-incomplete", "0", 0);
  }
}

/*
** Handle the "fossil unversioned sync" and "fossil unversioned revert"
** commands.
*/
void sync_unversioned(unsigned syncFlags){