Differences From:
File
src/db.c
part of check-in
[29900f98f6]
- Print the current status (including the current branch) after moving
to the end branch in the "open" command.
by
drh on
2009-01-29 03:36:00.
[view]
To:
File
src/db.c
part of check-in
[915bfd99fe]
- 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.
by
drh on
2009-05-28 02:44:39.
[view]
@@ -1244,21 +1244,27 @@
/*
** COMMAND: open
**
-** Usage: %fossil open FILENAME
+** 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;
- static char *azNewArgv[] = { 0, "update", "--latest", 0 };
+ int keepFlag;
+ static char *azNewArgv[] = { 0, "checkout", "--latest", 0, 0, 0 };
url_proxy_options();
- if( g.argc!=3 ){
- usage("REPOSITORY-FILENAME");
+ 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);
}
@@ -1272,12 +1278,21 @@
" 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;
- update_cmd();
+ if( oldArgc==4 ){
+ azNewArgv[g.argc-1] = oldArgv[3];
+ }
+ if( keepFlag ){
+ azNewArgv[g.argc++] = "--keep";
+ }
+ checkout_cmd();
g.argc = 2;
info_cmd();
}
}