Fossil SCM
Add option --empty to the "[/help?cmd=open | fossil open]" command. See: [https://www.mail-archive.com/[email protected]/msg14359.html]
Commit
640626fdbfbb38b5be8418c8042ecf87b7410ae4
Parent
e5d4c3ae68b6b92…
2 files changed
+19
-12
+1
M
src/db.c
+19
-12
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -1989,23 +1989,28 @@ | ||
| 1989 | 1989 | ** If VERSION is specified then that version is checked out. Otherwise |
| 1990 | 1990 | ** the latest version is checked out. No files other than "manifest" |
| 1991 | 1991 | ** and "manifest.uuid" are modified if the --keep option is present. |
| 1992 | 1992 | ** |
| 1993 | 1993 | ** Options: |
| 1994 | +** --empty Initialize checkout as being empty, but still connected | |
| 1995 | +** with the local repository. If you commit this checkout, | |
| 1996 | +** it will become a new "initial" commit in the repository. | |
| 1994 | 1997 | ** --keep Only modify the manifest and manifest.uuid files |
| 1995 | 1998 | ** --nested Allow opening a repository inside an opened checkout |
| 1996 | 1999 | ** |
| 1997 | 2000 | ** See also: close |
| 1998 | 2001 | */ |
| 1999 | 2002 | void cmd_open(void){ |
| 2003 | + int emptyFlag; | |
| 2000 | 2004 | int keepFlag; |
| 2001 | 2005 | int allowNested; |
| 2002 | 2006 | char **oldArgv; |
| 2003 | 2007 | int oldArgc; |
| 2004 | 2008 | static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0 }; |
| 2005 | 2009 | |
| 2006 | 2010 | url_proxy_options(); |
| 2011 | + emptyFlag = find_option("empty",0,0)!=0; | |
| 2007 | 2012 | keepFlag = find_option("keep",0,0)!=0; |
| 2008 | 2013 | allowNested = find_option("nested",0,0)!=0; |
| 2009 | 2014 | if( g.argc!=3 && g.argc!=4 ){ |
| 2010 | 2015 | usage("REPOSITORY-FILENAME ?VERSION?"); |
| 2011 | 2016 | } |
| @@ -2030,22 +2035,24 @@ | ||
| 2030 | 2035 | db_lset_int("checkout", 0); |
| 2031 | 2036 | oldArgv = g.argv; |
| 2032 | 2037 | oldArgc = g.argc; |
| 2033 | 2038 | azNewArgv[0] = g.argv[0]; |
| 2034 | 2039 | g.argv = azNewArgv; |
| 2035 | - g.argc = 3; | |
| 2036 | - if( oldArgc==4 ){ | |
| 2037 | - azNewArgv[g.argc-1] = oldArgv[3]; | |
| 2038 | - }else if( !db_exists("SELECT 1 FROM event WHERE type='ci'") ){ | |
| 2039 | - azNewArgv[g.argc-1] = "--latest"; | |
| 2040 | - }else{ | |
| 2041 | - azNewArgv[g.argc-1] = db_get("main-branch", "trunk"); | |
| 2042 | - } | |
| 2043 | - if( keepFlag ){ | |
| 2044 | - azNewArgv[g.argc++] = "--keep"; | |
| 2045 | - } | |
| 2046 | - checkout_cmd(); | |
| 2040 | + if( !emptyFlag){ | |
| 2041 | + g.argc = 3; | |
| 2042 | + if( oldArgc==4 ){ | |
| 2043 | + azNewArgv[g.argc-1] = oldArgv[3]; | |
| 2044 | + }else if( !db_exists("SELECT 1 FROM event WHERE type='ci'") ){ | |
| 2045 | + azNewArgv[g.argc-1] = "--latest"; | |
| 2046 | + }else{ | |
| 2047 | + azNewArgv[g.argc-1] = db_get("main-branch", "trunk"); | |
| 2048 | + } | |
| 2049 | + if( keepFlag ){ | |
| 2050 | + azNewArgv[g.argc++] = "--keep"; | |
| 2051 | + } | |
| 2052 | + checkout_cmd(); | |
| 2053 | + } | |
| 2047 | 2054 | g.argc = 2; |
| 2048 | 2055 | info_cmd(); |
| 2049 | 2056 | } |
| 2050 | 2057 | |
| 2051 | 2058 | /* |
| 2052 | 2059 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1989,23 +1989,28 @@ | |
| 1989 | ** If VERSION is specified then that version is checked out. Otherwise |
| 1990 | ** the latest version is checked out. No files other than "manifest" |
| 1991 | ** and "manifest.uuid" are modified if the --keep option is present. |
| 1992 | ** |
| 1993 | ** Options: |
| 1994 | ** --keep Only modify the manifest and manifest.uuid files |
| 1995 | ** --nested Allow opening a repository inside an opened checkout |
| 1996 | ** |
| 1997 | ** See also: close |
| 1998 | */ |
| 1999 | void cmd_open(void){ |
| 2000 | int keepFlag; |
| 2001 | int allowNested; |
| 2002 | char **oldArgv; |
| 2003 | int oldArgc; |
| 2004 | static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0 }; |
| 2005 | |
| 2006 | url_proxy_options(); |
| 2007 | keepFlag = find_option("keep",0,0)!=0; |
| 2008 | allowNested = find_option("nested",0,0)!=0; |
| 2009 | if( g.argc!=3 && g.argc!=4 ){ |
| 2010 | usage("REPOSITORY-FILENAME ?VERSION?"); |
| 2011 | } |
| @@ -2030,22 +2035,24 @@ | |
| 2030 | db_lset_int("checkout", 0); |
| 2031 | oldArgv = g.argv; |
| 2032 | oldArgc = g.argc; |
| 2033 | azNewArgv[0] = g.argv[0]; |
| 2034 | g.argv = azNewArgv; |
| 2035 | g.argc = 3; |
| 2036 | if( oldArgc==4 ){ |
| 2037 | azNewArgv[g.argc-1] = oldArgv[3]; |
| 2038 | }else if( !db_exists("SELECT 1 FROM event WHERE type='ci'") ){ |
| 2039 | azNewArgv[g.argc-1] = "--latest"; |
| 2040 | }else{ |
| 2041 | azNewArgv[g.argc-1] = db_get("main-branch", "trunk"); |
| 2042 | } |
| 2043 | if( keepFlag ){ |
| 2044 | azNewArgv[g.argc++] = "--keep"; |
| 2045 | } |
| 2046 | checkout_cmd(); |
| 2047 | g.argc = 2; |
| 2048 | info_cmd(); |
| 2049 | } |
| 2050 | |
| 2051 | /* |
| 2052 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1989,23 +1989,28 @@ | |
| 1989 | ** If VERSION is specified then that version is checked out. Otherwise |
| 1990 | ** the latest version is checked out. No files other than "manifest" |
| 1991 | ** and "manifest.uuid" are modified if the --keep option is present. |
| 1992 | ** |
| 1993 | ** Options: |
| 1994 | ** --empty Initialize checkout as being empty, but still connected |
| 1995 | ** with the local repository. If you commit this checkout, |
| 1996 | ** it will become a new "initial" commit in the repository. |
| 1997 | ** --keep Only modify the manifest and manifest.uuid files |
| 1998 | ** --nested Allow opening a repository inside an opened checkout |
| 1999 | ** |
| 2000 | ** See also: close |
| 2001 | */ |
| 2002 | void cmd_open(void){ |
| 2003 | int emptyFlag; |
| 2004 | int keepFlag; |
| 2005 | int allowNested; |
| 2006 | char **oldArgv; |
| 2007 | int oldArgc; |
| 2008 | static char *azNewArgv[] = { 0, "checkout", "--prompt", 0, 0, 0 }; |
| 2009 | |
| 2010 | url_proxy_options(); |
| 2011 | emptyFlag = find_option("empty",0,0)!=0; |
| 2012 | keepFlag = find_option("keep",0,0)!=0; |
| 2013 | allowNested = find_option("nested",0,0)!=0; |
| 2014 | if( g.argc!=3 && g.argc!=4 ){ |
| 2015 | usage("REPOSITORY-FILENAME ?VERSION?"); |
| 2016 | } |
| @@ -2030,22 +2035,24 @@ | |
| 2035 | db_lset_int("checkout", 0); |
| 2036 | oldArgv = g.argv; |
| 2037 | oldArgc = g.argc; |
| 2038 | azNewArgv[0] = g.argv[0]; |
| 2039 | g.argv = azNewArgv; |
| 2040 | if( !emptyFlag){ |
| 2041 | g.argc = 3; |
| 2042 | if( oldArgc==4 ){ |
| 2043 | azNewArgv[g.argc-1] = oldArgv[3]; |
| 2044 | }else if( !db_exists("SELECT 1 FROM event WHERE type='ci'") ){ |
| 2045 | azNewArgv[g.argc-1] = "--latest"; |
| 2046 | }else{ |
| 2047 | azNewArgv[g.argc-1] = db_get("main-branch", "trunk"); |
| 2048 | } |
| 2049 | if( keepFlag ){ |
| 2050 | azNewArgv[g.argc++] = "--keep"; |
| 2051 | } |
| 2052 | checkout_cmd(); |
| 2053 | } |
| 2054 | g.argc = 2; |
| 2055 | info_cmd(); |
| 2056 | } |
| 2057 | |
| 2058 | /* |
| 2059 |
+1
| --- www/changes.wiki | ||
| +++ www/changes.wiki | ||
| @@ -7,10 +7,11 @@ | ||
| 7 | 7 | * The [/reports] page now requires Read ("o") permissions. The "byweek" |
| 8 | 8 | report now properly propagates the selected year through the event type |
| 9 | 9 | filter links. |
| 10 | 10 | * The [/help/info | info command] now shows leaf status of the checkout. |
| 11 | 11 | * Add support for tunneling https through a http proxy (Ticket [e854101c4f]). |
| 12 | + * Add option --empty to the "[/help?cmd=open | fossil open]" command. | |
| 12 | 13 | |
| 13 | 14 | <h2>Changes For Version 1.28 (2014-01-27)</h2> |
| 14 | 15 | * Enhance [/help?cmd=/reports | /reports] to support event type filtering. |
| 15 | 16 | * When cloning a repository, the user name passed via the URL (if any) |
| 16 | 17 | is now used as the default local admin user's name. |
| 17 | 18 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -7,10 +7,11 @@ | |
| 7 | * The [/reports] page now requires Read ("o") permissions. The "byweek" |
| 8 | report now properly propagates the selected year through the event type |
| 9 | filter links. |
| 10 | * The [/help/info | info command] now shows leaf status of the checkout. |
| 11 | * Add support for tunneling https through a http proxy (Ticket [e854101c4f]). |
| 12 | |
| 13 | <h2>Changes For Version 1.28 (2014-01-27)</h2> |
| 14 | * Enhance [/help?cmd=/reports | /reports] to support event type filtering. |
| 15 | * When cloning a repository, the user name passed via the URL (if any) |
| 16 | is now used as the default local admin user's name. |
| 17 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -7,10 +7,11 @@ | |
| 7 | * The [/reports] page now requires Read ("o") permissions. The "byweek" |
| 8 | report now properly propagates the selected year through the event type |
| 9 | filter links. |
| 10 | * The [/help/info | info command] now shows leaf status of the checkout. |
| 11 | * Add support for tunneling https through a http proxy (Ticket [e854101c4f]). |
| 12 | * Add option --empty to the "[/help?cmd=open | fossil open]" command. |
| 13 | |
| 14 | <h2>Changes For Version 1.28 (2014-01-27)</h2> |
| 15 | * Enhance [/help?cmd=/reports | /reports] to support event type filtering. |
| 16 | * When cloning a repository, the user name passed via the URL (if any) |
| 17 | is now used as the default local admin user's name. |
| 18 |