Fossil

Check-in [64b221aa]
Login

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

Overview
Comment:Only check leaves for forks on multi-child nodes. This prevents warnings from being extra verbose when a commit is made on any of the forks.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | sync-forkwarn
Files: files | file ages | folders
SHA1: 64b221aacf1365946ee1aded574bd2a7518b6176
User & Date: andybradford 2015-04-23 00:35:34
Context
2015-04-25
20:38
Add warning to "fossil sync", when a new fork is created during this sync. check-in: 560483f5 user: jan.nijtmans tags: trunk
2015-04-23
00:35
Only check leaves for forks on multi-child nodes. This prevents warnings from being extra verbose when a commit is made on any of the forks. Closed-Leaf check-in: 64b221aa user: andybradford tags: sync-forkwarn
2015-04-22
19:10
Remove unused variable check-in: 101fdfe8 user: jan.nijtmans tags: sync-forkwarn
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/merge.c.

98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123




124
125
126
127
128
129
130
    rid = db_column_int(&q, 0);
  }
  db_finalize(&q);
  return rid;
}

/*
** Check for any fork that is not a closed leaf and that was received
** with rcvid and return true if any is found.
*/
int fossil_find_any_fork(int rcvid){
  Blob sql;
  Stmt q;
  int fForkSeen = 0;

  blob_zero(&sql);
  blob_append_sql(&sql,
    "  SELECT blob.rid FROM blob"
    "    JOIN leaf ON blob.rid=leaf.rid"
    "   WHERE rcvid=%d" 
    " AND NOT %z", rcvid, leaf_is_closed_sql("leaf.rid"));
  db_prepare(&q, "%s", blob_sql_text(&sql));
  blob_reset(&sql);
  while( !fForkSeen && db_step(&q)==SQLITE_ROW ){
    int rid = db_column_int(&q, 0);
    fForkSeen = fossil_find_nearest_fork(rid, db_open_local(0))!=0;




  }
  db_finalize(&q);
  return fForkSeen;
}

/*
** COMMAND: merge







|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
>
>







98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
    rid = db_column_int(&q, 0);
  }
  db_finalize(&q);
  return rid;
}

/*
** Check content that was received with rcvid and return true if any
** fork was created.
*/
int fossil_any_has_fork(int rcvid){
  static Stmt q;
  int fForkSeen = 0;

  db_static_prepare(&q,
    "  SELECT pid FROM plink WHERE pid>0 AND isprim"
    "     AND cid IN (SELECT blob.rid FROM blob"
    "   WHERE rcvid=:rcvid)");
  db_bind_int(&q, ":rcvid", rcvid);
  while( !fForkSeen && db_step(&q)==SQLITE_ROW ){
    int pid = db_column_int(&q, 0);
    if( count_nonbranch_children(pid)>1 ){
      compute_leaves(pid,1);
      if( db_int(0, "SELECT count(*) FROM leaves")>1 ){
        int rid = db_int(0, "SELECT rid FROM leaves, event"
                            " WHERE event.objid=leaves.rid"
                            " ORDER BY event.mtime DESC LIMIT 1");
        fForkSeen = fossil_find_nearest_fork(rid, db_open_local(0))!=0;
      }
    }
  }
  db_finalize(&q);
  return fForkSeen;
}

/*
** COMMAND: merge

Changes to src/xfer.c.

1970
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 && fossil_find_any_fork(g.rcvid) ){
    fossil_warning("***** WARNING: a fork has occurred ***** use "
                   "\"fossil forks\" for more details.");
  }
  return nErr;
}







|





1970
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 && fossil_any_has_fork(g.rcvid) ){
    fossil_warning("***** WARNING: a fork has occurred ***** use "
                   "\"fossil forks\" for more details.");
  }
  return nErr;
}