Fossil

Diff
Login

Differences From Artifact [6cfa508393]:

To Artifact [dcf2e26774]:


152
153
154
155
156
157
158

159
160
161
162
163
164
165
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166







+







  int syncFlags = SYNC_CLONE;
  int noCompress = find_option("nocompress",0,0)!=0;
  int noOpen = find_option("no-open",0,0)!=0;
  int allowNested = find_option("nested",0,0)!=0; /* Used by open */
  int nResumeSeqno = 0;       /* Last seqno from which to resume clone */
  const char *zNewProjCode;   /* New Project code obtained during clone */
  const char *zOldProjCode;   /* Old project code stored in resuming clone */
  const char *zCloneCode;     /* server-code for the source of the clone */
  const char *zRepo = 0;      /* Name of the new local repository file */
  const char *zWorkDir = 0;   /* Open in this directory, if not zero */


  /* Also clone private branches */
  if( find_option("private",0,0)!=0 ) syncFlags |= SYNC_PRIVATE;
  if( find_option("once",0,0)!=0) urlFlags &= ~URL_REMEMBER;
239
240
241
242
243
244
245

246

247
248
249
250
251
252
253
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256







+

+







  }else{
    db_close_config();
    if( nResumeSeqno>1 ){
      db_open_repository(zRepo);
      db_open_config(0,0);
      db_begin_transaction();
      zOldProjCode = db_get("project-code",0);
      zCloneCode = db_get("aux-clone-code",0);
      if( zOldProjCode==0 ) fossil_fatal("project-id missing from repository");
      if( zCloneCode==0 ) fossil_fatal("clone-code missing from repository");
      fossil_print("Resuming clone of project-id %s\n",zOldProjCode);
      db_create_default_users(1, zDefaultUser);
      if( zDefaultUser ) g.zLogin = zDefaultUser;
      user_select();
    }else{
      db_create_repository(zRepo);
      db_open_repository(zRepo);
304
305
306
307
308
309
310




311
312
313
314
315
316
317

318



319
320
321
322
323
324
325
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325

326
327
328
329
330
331
332
333
334
335







+
+
+
+







+
-
+
+
+







      zNewProjCode = db_get("project-code",0);
      if( zOldProjCode!=0 && zOldProjCode[0]!=0
          && fossil_strcmp(zOldProjCode, zNewProjCode)!=0 ){
        fossil_fatal("project-id changed\nwas %s\nis  %s"
               "\nrolling back changes",
               zOldProjCode, zNewProjCode);
      }
      if( zCloneCode!=0 && zCloneCode[0]!=0
          && fossil_strcmp(zCloneCode, db_get("aux-clone-code",0))!=0 ){
        fossil_fatal("clone resume from different server not allowed");
      }
    }
    if( nErr ){
      fossil_warning("server returned an error - clone incomplete");
    }else if( sync_interrupted()==1 ){
      fossil_warning("clone was interrupted");
    }else{
      db_unprotect(PROTECT_CONFIG);
      db_multi_exec(
      db_multi_exec("DELETE FROM config WHERE name = 'aux-clone-seqno';");
        "DELETE FROM config WHERE name = 'aux-clone-seqno';"
        "DELETE FROM config WHERE name = 'aux-clone-code';"
      );
      db_protect_pop();
    }
    db_end_transaction(0);
    db_close(1);
    db_open_repository(zRepo);
#if !defined(_WIN32)
    signal(SIGINT, SIG_DFL);