Fossil

Changes On Branch eab553c77ed059fa
Login

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

Changes In Branch sync-forkwarn Through [eab553c77e] Excluding Merge-Ins

This is equivalent to a diff from 97f976785d to eab553c77e

2015-04-19
18:26
Merge trunk. More to-the-point message in case of fork warnings after sync. check-in: cf59ea3165 user: jan.nijtmans tags: sync-forkwarn
2015-04-17
09:50
Cherry-pick [http://www.sqlite.org/src/info/e018f4bf1f27f7838342940ad89a12d7f1536e8e|e018f4bf1f]: Fix a potential one-byte buffer overread in the command-line shell. Add (undocumented) -backslash option to "fossil sqlite" check-in: af52f2912a user: jan.nijtmans tags: trunk
00:11
Merge in new feature from trunk. check-in: eab553c77e user: andybradford tags: sync-forkwarn
2015-04-16
23:46
Allow fossil_find_nearest_fork to be used on repository that is not open. check-in: 97f976785d user: andybradford tags: trunk
08:53
Remove unnecessary variable determination in src/descendants.c, and some unnecessary end-of-line spacing. check-in: 10f5fc6986 user: jan.nijtmans tags: trunk
2015-04-14
00:42
Remove unused code from previous fork warning method. check-in: bc1e943fec user: andybradford tags: sync-forkwarn
2015-04-13
03:38
Use better fork detection mechanism and disable checking during push since it may not have a complete sync and issue warning prematurely. check-in: d0e2f1bd3e user: andybradford tags: sync-forkwarn

Changes to src/leaf.c.
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
  if( db_step(&q)==SQLITE_ROW ){
    nNonBranch = db_column_int(&q, 0);
  }
  db_reset(&q);
  return nNonBranch;
}


/*
** Recompute the entire LEAF table.
**
** This can be expensive (5 seconds or so) for a really large repository.
** So it is only done for things like a rebuild.
*/
void leaf_rebuild(void){







<







71
72
73
74
75
76
77

78
79
80
81
82
83
84
  if( db_step(&q)==SQLITE_ROW ){
    nNonBranch = db_column_int(&q, 0);
  }
  db_reset(&q);
  return nNonBranch;
}


/*
** Recompute the entire LEAF table.
**
** This can be expensive (5 seconds or so) for a really large repository.
** So it is only done for things like a rebuild.
*/
void leaf_rebuild(void){
132
133
134
135
136
137
138









139
140
141
142
143
144
145
  }else{
    db_static_prepare(&addLeaf, "INSERT OR IGNORE INTO leaf VALUES(:rid)");
    db_bind_int(&addLeaf, ":rid", rid);
    db_step(&addLeaf);
    db_reset(&addLeaf);
  }
}










/*
** Return an SQL expression (stored in memory obtained from fossil_malloc())
** that is true if the SQL variable named "zVar" contains the rid with
** a CLOSED tag.  In other words, return true if the leaf is closed.
**
** The result can be prefaced with a NOT operator to get all leaves that







>
>
>
>
>
>
>
>
>







131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
  }else{
    db_static_prepare(&addLeaf, "INSERT OR IGNORE INTO leaf VALUES(:rid)");
    db_bind_int(&addLeaf, ":rid", rid);
    db_step(&addLeaf);
    db_reset(&addLeaf);
  }
}

/*
** Check for a fork against rid and set g.fForkSeen
*/
void fork_check(int rid){
  if( is_a_leaf(rid) && fossil_find_nearest_fork(rid, 0) ){
    g.forkSeen = 1;
  }
}

/*
** Return an SQL expression (stored in memory obtained from fossil_malloc())
** that is true if the SQL variable named "zVar" contains the rid with
** a CLOSED tag.  In other words, return true if the leaf is closed.
**
** The result can be prefaced with a NOT operator to get all leaves that
169
170
171
172
173
174
175
176
177
178
179
180
181



182
183
184
  while( db_step(&parentsOf)==SQLITE_ROW ){
    bag_insert(&needToCheck, db_column_int(&parentsOf, 0));
  }
  db_reset(&parentsOf);
}

/*
** Do all pending leaf checks.
*/
void leaf_do_pending_checks(void){
  int rid;
  for(rid=bag_first(&needToCheck); rid; rid=bag_next(&needToCheck,rid)){
    leaf_check(rid);



  }
  bag_clear(&needToCheck);
}







|





>
>
>



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
  while( db_step(&parentsOf)==SQLITE_ROW ){
    bag_insert(&needToCheck, db_column_int(&parentsOf, 0));
  }
  db_reset(&parentsOf);
}

/*
** Do all pending leaf and fork checks.
*/
void leaf_do_pending_checks(void){
  int rid;
  for(rid=bag_first(&needToCheck); rid; rid=bag_next(&needToCheck,rid)){
    leaf_check(rid);
  }
  for(rid=bag_first(&needToCheck); rid; rid=bag_next(&needToCheck,rid)){
    fork_check(rid);
  }
  bag_clear(&needToCheck);
}
Changes to src/main.c.
172
173
174
175
176
177
178

179
180
181
182
183
184
185
  FILE *httpIn;           /* Accept HTTP input from here */
  FILE *httpOut;          /* Send HTTP output here */
  int xlinkClusterOnly;   /* Set when cloning.  Only process clusters */
  int fTimeFormat;        /* 1 for UTC.  2 for localtime.  0 not yet selected */
  int *aCommitFile;       /* Array of files to be committed */
  int markPrivate;        /* All new artifacts are private if true */
  int clockSkewSeen;      /* True if clocks on client and server out of sync */

  int wikiFlags;          /* Wiki conversion flags applied to %W */
  char isHTTP;            /* True if server/CGI modes, else assume CLI. */
  char javascriptHyperlink; /* If true, set href= using script, not HTML */
  Blob httpHeader;        /* Complete text of the HTTP request header */
  UrlData url;            /* Information about current URL */
  const char *zLogin;     /* Login name.  NULL or "" if not logged in. */
  const char *zSSLIdentity;  /* Value of --ssl-identity option, filename of







>







172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
  FILE *httpIn;           /* Accept HTTP input from here */
  FILE *httpOut;          /* Send HTTP output here */
  int xlinkClusterOnly;   /* Set when cloning.  Only process clusters */
  int fTimeFormat;        /* 1 for UTC.  2 for localtime.  0 not yet selected */
  int *aCommitFile;       /* Array of files to be committed */
  int markPrivate;        /* All new artifacts are private if true */
  int clockSkewSeen;      /* True if clocks on client and server out of sync */
  int forkSeen;           /* True if an unhandled fork was seen during sync */
  int wikiFlags;          /* Wiki conversion flags applied to %W */
  char isHTTP;            /* True if server/CGI modes, else assume CLI. */
  char javascriptHyperlink; /* If true, set href= using script, not HTML */
  Blob httpHeader;        /* Complete text of the HTTP request header */
  UrlData url;            /* Information about current URL */
  const char *zLogin;     /* Login name.  NULL or "" if not logged in. */
  const char *zSSLIdentity;  /* Value of --ssl-identity option, filename of
Changes to src/xfer.c.
1450
1451
1452
1453
1454
1455
1456

1457
1458
1459
1460
1461
1462
1463
  transport_stats(0, 0, 1);
  socket_global_init();
  memset(&xfer, 0, sizeof(xfer));
  xfer.pIn = &recv;
  xfer.pOut = &send;
  xfer.mxSend = db_get_int("max-upload", 250000);
  xfer.maxTime = -1;

  if( syncFlags & SYNC_PRIVATE ){
    g.perm.Private = 1;
    xfer.syncPrivate = 1;
  }

  blobarray_zero(xfer.aToken, count(xfer.aToken));
  blob_zero(&send);







>







1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
  transport_stats(0, 0, 1);
  socket_global_init();
  memset(&xfer, 0, sizeof(xfer));
  xfer.pIn = &recv;
  xfer.pOut = &send;
  xfer.mxSend = db_get_int("max-upload", 250000);
  xfer.maxTime = -1;
  g.forkSeen = 0;
  if( syncFlags & SYNC_PRIVATE ){
    g.perm.Private = 1;
    xfer.syncPrivate = 1;
  }

  blobarray_zero(xfer.aToken, count(xfer.aToken));
  blob_zero(&send);
1970
1971
1972
1973
1974
1975
1976



1977
1978
  transport_global_shutdown(&g.url);
  if( nErr && go==2 ){
    db_multi_exec("DROP TABLE onremote");
    manifest_crosslink_end(MC_PERMIT_HOOKS);
    content_enable_dephantomize(1);
    db_end_transaction(0);
  }



  return nErr;
}







>
>
>


1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
  transport_global_shutdown(&g.url);
  if( nErr && go==2 ){
    db_multi_exec("DROP TABLE onremote");
    manifest_crosslink_end(MC_PERMIT_HOOKS);
    content_enable_dephantomize(1);
    db_end_transaction(0);
  }
  if( (syncFlags & SYNC_CLONE)==0 && g.forkSeen ){
    fossil_warning("***** WARNING: a fork has occurred *****");
  }
  return nErr;
}