"DELETE FROM aqueue;"
"CREATE INDEX IF NOT EXISTS aqueue_idx1 ON aqueue(pending, mtime);"
);
/* Insert the primary record */
db_multi_exec(
"INSERT INTO aqueue(rid, mtime, pending, src)"
" SELECT %d, mtime, 1, 1 FROM plink WHERE cid=%d LIMIT 1",
rid, rid
);
}
/*
** Set a secondary file. The primary file must be set first. There
** must be at least one secondary but there can be more than one if
** desired.
*/
void pivot_set_secondary(int rid){
/* Insert the primary record */
db_multi_exec(
"INSERT OR IGNORE INTO aqueue(rid, mtime, pending, src)"
" SELECT %d, mtime, 1, 0 FROM plink WHERE cid=%d",
rid, rid
);
}
/*
** Find the most recent common ancestor of the primary and one of
** the secondaries. Return its rid. Return 0 if no common ancestor

"DELETE FROM aqueue;"
"CREATE INDEX IF NOT EXISTS aqueue_idx1 ON aqueue(pending, mtime);"
);
/* Insert the primary record */
db_multi_exec(
"INSERT INTO aqueue(rid, mtime, pending, src)"
" SELECT %d, mtime, 1, 1 FROM event WHERE objid=%d AND type='ci' LIMIT 1",
rid, rid
);
}
/*
** Set a secondary file. The primary file must be set first. There
** must be at least one secondary but there can be more than one if
** desired.
*/
void pivot_set_secondary(int rid){
/* Insert the primary record */
db_multi_exec(
"INSERT OR IGNORE INTO aqueue(rid, mtime, pending, src)"
" SELECT %d, mtime, 1, 0 FROM event WHERE objid=%d AND type='ci'",
rid, rid
);
}
/*
** Find the most recent common ancestor of the primary and one of
** the secondaries. Return its rid. Return 0 if no common ancestor

** If the VERSION argument is omitted, then the leaf of the subtree
** that begins at the current version is used, if there is only a single
** leaf. VERSION can also be "current" to select the leaf of the current
** version or "latest" to select the most recent check-in.
**
** If one or more FILES are listed after the VERSION then only the
** named files are candidates to be updated. If FILES is omitted, all
** files in the current checkout are subject to be updated.
**
** The -n or --nochange option causes this command to do a "dry run". It
** prints out what would have happened but does not actually make any
** changes to the current checkout or the repository.
**
** The -v or --verbose option prints status information about unchanged
** files in addition to those file that actually do change.
................................................................................
fossil_fatal("Multiple descendants");
}
tid = db_int(0, "SELECT rid FROM leaves, event"
" WHERE event.objid=leaves.rid"
" ORDER BY event.mtime DESC");
}
if( tid==vid) return; /* Nothing to update */
db_begin_transaction();
vfile_check_signature(vid, 1);
if( !nochangeFlag ) undo_begin();
load_vfile_from_rid(tid);
/*
** The record.fn field is used to match files against each other. The
................................................................................
"UPDATE fv SET idv=%d, ridv=%d, chnged=%d WHERE fn=%Q",
id, rid, chnged, fn
);
}
db_finalize(&q);
/* If FILES appear on the command-line, remove from the "fv" table
** every entry that is not named on the command-line.
*/
if( g.argc>=4 ){
Blob sql; /* SQL statement to purge unwanted entries */
char *zSep = "("; /* Separator in the list of filenames */
Blob treename; /* Normalized filename */
int i; /* Loop counter */
blob_zero(&sql);
blob_append(&sql, "DELETE FROM fv WHERE fn NOT IN ", -1);
for(i=3; i<g.argc; i++){
file_tree_name(g.argv[i], &treename, 1);
blob_appendf(&sql, "%s'%q'", zSep, blob_str(&treename));
blob_reset(&treename);
zSep = ",";
}
blob_append(&sql, ")", -1);
db_multi_exec(blob_str(&sql));
blob_reset(&sql);
}
db_prepare(&q,
"SELECT fn, idv, ridv, idt, ridt, chnged FROM fv ORDER BY 1"
);
................................................................................
printf("***** Cannot merge binary file %s\n", zName);
}
blob_reset(&v);
blob_reset(&e);
blob_reset(&t);
blob_reset(&r);
}else if( verboseFlag ){
printf("UNCHANGED %s\n", zName);
}
free(zFullPath);
}
db_finalize(&q);
/*
** Clean up the mid and pid VFILE entries. Then commit the changes.

** If the VERSION argument is omitted, then the leaf of the subtree
** that begins at the current version is used, if there is only a single
** leaf. VERSION can also be "current" to select the leaf of the current
** version or "latest" to select the most recent check-in.
**
** If one or more FILES are listed after the VERSION then only the
** named files are candidates to be updated. If FILES is omitted, all
** files in the current checkout are subject to be updated. Using** a directory name for one of the FILES arguments is the same as** using every subdirectory and file beneath that directory.
**
** The -n or --nochange option causes this command to do a "dry run". It
** prints out what would have happened but does not actually make any
** changes to the current checkout or the repository.
**
** The -v or --verbose option prints status information about unchanged
** files in addition to those file that actually do change.
................................................................................
fossil_fatal("Multiple descendants");
}
tid = db_int(0, "SELECT rid FROM leaves, event"
" WHERE event.objid=leaves.rid"
" ORDER BY event.mtime DESC");
}
if( !verboseFlag && (tid==vid)) return; /* Nothing to update */
db_begin_transaction();
vfile_check_signature(vid, 1);
if( !nochangeFlag ) undo_begin();
load_vfile_from_rid(tid);
/*
** The record.fn field is used to match files against each other. The
................................................................................
"UPDATE fv SET idv=%d, ridv=%d, chnged=%d WHERE fn=%Q",
id, rid, chnged, fn
);
}
db_finalize(&q);
/* If FILES appear on the command-line, remove from the "fv" table
** every entry that is not named on the command-line or which is not ** in a directory named on the command-line.
*/
if( g.argc>=4 ){
Blob sql; /* SQL statement to purge unwanted entries */
Blob treename; /* Normalized filename */
int i; /* Loop counter */
const char *zSep; /* Term separator */
blob_zero(&sql);
blob_append(&sql, "DELETE FROM fv WHERE ", -1);
zSep = "";
for(i=3; i<g.argc; i++){
file_tree_name(g.argv[i], &treename, 1);
if( file_isdir(g.argv[i])==1 ){ if( blob_size(&treename)>0 ){ blob_appendf(&sql, "%sfn NOT GLOB '%b/*' ", zSep, &treename);
}else{ blob_reset(&sql);
break; } }else{ blob_appendf(&sql, "%sfn<>%B ", zSep, &treename); }
zSep = "AND ";
blob_reset(&treename);
}
db_multi_exec(blob_str(&sql));
blob_reset(&sql);
}
db_prepare(&q,
"SELECT fn, idv, ridv, idt, ridt, chnged FROM fv ORDER BY 1"
);
................................................................................
printf("***** Cannot merge binary file %s\n", zName);
}
blob_reset(&v);
blob_reset(&e);
blob_reset(&t);
blob_reset(&r);
}else if( verboseFlag ){
if( chnged ){ printf("EDITED %s\n", zName); }else{ printf("UNCHANGED %s\n", zName);
}
}
free(zFullPath);
}
db_finalize(&q);
/*
** Clean up the mid and pid VFILE entries. Then commit the changes.

This page was generated in about
0.024s by
Fossil 2.5 [55f6c765fb] 2018-02-16 16:28:38