Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Add the --keep option to the "open" and "checkout" commands. Added the --latest option to "checkout". These changes allow one to shift the baseline version and repository of a checkout without changing any files in the checkout. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
915bfd99fec69f978f199412bdb2c3da |
| User & Date: | drh 2009-05-28 02:44:39.000 |
References
|
2009-07-22
| ||
| 18:23 | • Ticket [607bc372c6] Segmentation fault fossil open ../clone.fsl status still Fixed with 1 other change artifact: 39736d38ab user: drh | |
| 12:47 | • Fixed ticket [607bc372c6]. artifact: 0ebb6e6e6b user: drh | |
|
2009-06-07
| ||
| 12:01 | • New ticket [95ab8f02c3] Bus error in SQLite under Solaris 9 (sparc). artifact: ebf4da05db user: chi | |
Context
|
2009-06-01
| ||
| 16:13 | minor help text correction for 'wiki' command check-in: 5e8fb35db1 user: stephan tags: trunk | |
|
2009-05-28
| ||
| 02:44 | Add the --keep option to the "open" and "checkout" commands. Added the --latest option to "checkout". These changes allow one to shift the baseline version and repository of a checkout without changing any files in the checkout. check-in: 915bfd99fe user: drh tags: trunk | |
|
2009-05-27
| ||
| 02:45 | changed title of admin/behavior page to be consistent with the other pages check-in: 7b32e45bd7 user: erik tags: trunk | |
Changes
Changes to src/checkout.c.
| ︙ | ︙ | |||
133 134 135 136 137 138 139 | manifest_clear(&m); } /* ** COMMAND: checkout ** COMMAND: co ** | | | | > > > > > | | > > | > > | > > > > > > > > > > > > | | | > | | | < > | | | | | | | | > > > > > > > > > > > > > > > > > > > | < | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 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 |
manifest_clear(&m);
}
/*
** COMMAND: checkout
** COMMAND: co
**
** Usage: %fossil checkout VERSION ?-f|--force? ?--keep?
**
** Check out a version specified on the command-line. This command
** will abort if there are edited files in the current checkout unless
** the --force option appears on the command-line. The --keep option
** leaves files on disk unchanged, except the manifest and manifest.uuid
** files.
**
** The --latest flag can be used in place of VERSION to checkout the
** latest version in the repository.
**
** See also the "update" command.
*/
void checkout_cmd(void){
int forceFlag; /* Force checkout even if edits exist */
int keepFlag; /* Do not change any files on disk */
int latestFlag; /* Checkout the latest version */
char *zVers; /* Version to checkout */
int vid, prior;
Blob cksum1, cksum1b, cksum2;
db_must_be_within_tree();
db_begin_transaction();
forceFlag = find_option("force","f",0)!=0;
keepFlag = find_option("keep",0,0)!=0;
latestFlag = find_option("latest",0,0)!=0;
if( (latestFlag!=0 && g.argc!=2) || (latestFlag==0 && g.argc!=3) ){
usage("VERSION|--latest ?--force? ?--keep?");
}
if( !forceFlag && unsaved_changes()==1 ){
fossil_fatal("there are unsaved changes in the current checkout");
}
if( forceFlag ){
db_multi_exec("DELETE FROM vfile");
prior = 0;
}else{
prior = db_lget_int("checkout",0);
}
if( latestFlag ){
compute_leaves(db_lget_int("checkout",0), 1);
zVers = db_text(0, "SELECT uuid FROM leaves, event, blob"
" WHERE event.objid=leaves.rid AND blob.rid=leaves.rid"
" ORDER BY event.mtime DESC");
if( zVers==0 ){
fossil_fatal("cannot local \"latest\" checkout");
}
}else{
zVers = g.argv[2];
}
vid = load_vfile(zVers);
if( prior==vid ){
return;
}
if( !keepFlag ){
uncheckout(prior);
}
db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid);
if( !keepFlag ){
vfile_to_disk(vid, 0, 1);
}
manifest_to_disk(vid);
db_lset_int("checkout", vid);
undo_reset();
db_multi_exec("DELETE FROM vmerge");
if( !keepFlag ){
vfile_aggregate_checksum_manifest(vid, &cksum1, &cksum1b);
vfile_aggregate_checksum_disk(vid, &cksum2);
if( blob_compare(&cksum1, &cksum2) ){
printf("WARNING: manifest checksum does not agree with disk\n");
}
if( blob_compare(&cksum1, &cksum1b) ){
printf("WARNING: manifest checksum does not agree with manifest\n");
}
}
db_end_transaction(0);
}
/*
** Unlink the local database file
*/
void unlink_local_database(void){
static const char *azFile[] = {
"%s_FOSSIL_",
"%s_FOSSIL_-journal",
"%s.fos",
"%s.fos-journal",
};
int i;
for(i=0; i<sizeof(azFile)/sizeof(azFile[0]); i++){
char *z = mprintf(azFile[i], g.zLocalRoot);
unlink(z);
free(z);
}
}
/*
** COMMAND: close
**
** Usage: %fossil close ?-f|--force?
**
** The opposite of "open". Close the current database connection.
** Require a -f or --force flag if there are unsaved changed in the
** current check-out.
*/
void close_cmd(void){
int forceFlag = find_option("force","f",0)!=0;
db_must_be_within_tree();
if( !forceFlag && unsaved_changes()==1 ){
fossil_fatal("there are unsaved changes in the current checkout");
}
db_close();
unlink_local_database();
}
|
Changes to src/db.c.
| ︙ | ︙ | |||
1241 1242 1243 1244 1245 1246 1247 | ); blob_reset(&full); } /* ** COMMAND: open ** | | > > > > > | > | | > > > > > > > > > | | 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 |
);
blob_reset(&full);
}
/*
** COMMAND: open
**
** Usage: %fossil open FILENAME ?VERSION? ?--keep?
**
** Open a connection to the local repository in FILENAME. A checkout
** for the repository is created with its root at the working directory.
** If VERSION is specified then that version is checked out. Otherwise
** the latest version is checked out. No files other than "manifest"
** and "manifest.uuid" are modified if the --keep option is present.
**
** See also the "close" command.
*/
void cmd_open(void){
Blob path;
int vid;
int keepFlag;
static char *azNewArgv[] = { 0, "checkout", "--latest", 0, 0, 0 };
url_proxy_options();
keepFlag = find_option("keep",0,0)!=0;
if( g.argc!=3 && g.argc!=4 ){
usage("REPOSITORY-FILENAME ?VERSION?");
}
if( db_open_local() ){
fossil_panic("already within an open tree rooted at %s", g.zLocalRoot);
}
file_canonical_name(g.argv[2], &path);
db_open_repository(blob_str(&path));
db_init_database("./_FOSSIL_", zLocalSchema, (char*)0);
db_open_local();
db_lset("repository", blob_str(&path));
db_record_repository_filename(blob_str(&path));
vid = db_int(0, "SELECT pid FROM plink y"
" WHERE NOT EXISTS(SELECT 1 FROM plink x WHERE x.cid=y.pid)");
if( vid==0 ){
db_lset_int("checkout", 1);
}else{
char **oldArgv = g.argv;
int oldArgc = g.argc;
db_lset_int("checkout", vid);
azNewArgv[0] = g.argv[0];
g.argv = azNewArgv;
g.argc = 3;
if( oldArgc==4 ){
azNewArgv[g.argc-1] = oldArgv[3];
}
if( keepFlag ){
azNewArgv[g.argc++] = "--keep";
}
checkout_cmd();
g.argc = 2;
info_cmd();
}
}
/*
** Print the value of a setting named zName
|
| ︙ | ︙ |