Fossil

Check-in [620783ca]
Login

Check-in [620783ca]

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

Overview
Comment:Remove the --empty and --docker options from "fossil init". The creation of incompatible Fossil repositories is prohibited.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 620783cae23d28bd73959006af71f859e8b7333e
User & Date: drh 2015-03-13 14:01:22
References
2020-07-03
13:52
Partially backout [620783cae23d28bd73959006af71f859e8b7333e|620783cae2] (adapted to current coding style): This brings back the --empty option there once was. ... (Closed-Leaf check-in: 971a5f51 user: jan.nijtmans tags: no-initial-commit)
Context
2020-07-03
13:52
Partially backout [620783cae23d28bd73959006af71f859e8b7333e|620783cae2] (adapted to current coding style): This brings back the --empty option there once was. ... (Closed-Leaf check-in: 971a5f51 user: jan.nijtmans tags: no-initial-commit)
2015-03-14
13:20
Version 1.32 ... (check-in: 6c40678e user: drh tags: trunk, release, version-1.32)
2015-03-13
20:18
Merged the latest changes from trunk. ... (check-in: bcf2bd23 user: zakero tags: skin-xekri)
16:14
Initial contribution of the Blitz skin (two variants) ... (Closed-Leaf check-in: 5d3eb177 user: jmoger tags: skin-blitz)
14:01
Remove the --empty and --docker options from "fossil init". The creation of incompatible Fossil repositories is prohibited. ... (check-in: 620783ca user: drh tags: trunk)
13:34
Create a change log for the 1.32 release. ... (check-in: 7b074869 user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/db.c.

1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
** default users "anonymous", "nobody", "reader", "developer", and their
** associated permissions will be copied.
**
** Options:
**    --template      FILE      copy settings from repository file
**    --admin-user|-A USERNAME  select given USERNAME as admin user
**    --date-override DATETIME  use DATETIME as time of the initial check-in
**    --empty                   do not create an initial check-in
**
** See also: clone
*/
void create_repository_cmd(void){
  char *zPassword;
  const char *zTemplate;      /* Repository from which to copy settings */
  const char *zDate;          /* Date of the initial check-in */
  const char *zDefaultUser;   /* Optional name of the default user */
  int makeServerCodes;
  int makeEmptyRepository;

  zTemplate = find_option("template",0,1);
  zDate = find_option("date-override",0,1);
  zDefaultUser = find_option("admin-user","A",1);
  makeServerCodes = find_option("docker", 0, 0)==0;
  makeEmptyRepository = (find_option("empty", 0, 0)!=0) || (makeServerCodes==0);
  /* We should be done with options.. */
  verify_all_options();

  if( g.argc!=3 ){
    usage("REPOSITORY-NAME");
  }
 
  if( -1 != file_size(g.argv[2]) ){
    fossil_fatal("file already exists: %s", g.argv[2]);
  }

  db_create_repository(g.argv[2]);
  db_open_repository(g.argv[2]);
  db_open_config(0);
  if( zTemplate ) db_attach(zTemplate, "settingSrc");
  db_begin_transaction();
  if( zDate==0 && makeEmptyRepository==0 ) zDate = "now";
  db_initial_setup(zTemplate, zDate, zDefaultUser, makeServerCodes);
  db_end_transaction(0);
  if( zTemplate ) db_detach("settingSrc");
  if( makeServerCodes ){
    fossil_print("project-id: %s\n", db_get("project-code", 0));
    fossil_print("server-id:  %s\n", db_get("server-code", 0));
  }
  zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
  fossil_print("admin-user: %s (initial password is \"%s\")\n",
               g.zLogin, zPassword);
}

/*
** SQL functions for debugging.







<








<
<




<
<
















|
|


<
|
|
<







1656
1657
1658
1659
1660
1661
1662

1663
1664
1665
1666
1667
1668
1669
1670


1671
1672
1673
1674


1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694

1695
1696

1697
1698
1699
1700
1701
1702
1703
** default users "anonymous", "nobody", "reader", "developer", and their
** associated permissions will be copied.
**
** Options:
**    --template      FILE      copy settings from repository file
**    --admin-user|-A USERNAME  select given USERNAME as admin user
**    --date-override DATETIME  use DATETIME as time of the initial check-in

**
** See also: clone
*/
void create_repository_cmd(void){
  char *zPassword;
  const char *zTemplate;      /* Repository from which to copy settings */
  const char *zDate;          /* Date of the initial check-in */
  const char *zDefaultUser;   /* Optional name of the default user */



  zTemplate = find_option("template",0,1);
  zDate = find_option("date-override",0,1);
  zDefaultUser = find_option("admin-user","A",1);


  /* We should be done with options.. */
  verify_all_options();

  if( g.argc!=3 ){
    usage("REPOSITORY-NAME");
  }
 
  if( -1 != file_size(g.argv[2]) ){
    fossil_fatal("file already exists: %s", g.argv[2]);
  }

  db_create_repository(g.argv[2]);
  db_open_repository(g.argv[2]);
  db_open_config(0);
  if( zTemplate ) db_attach(zTemplate, "settingSrc");
  db_begin_transaction();
  if( zDate==0 ) zDate = "now";
  db_initial_setup(zTemplate, zDate, zDefaultUser, 1);
  db_end_transaction(0);
  if( zTemplate ) db_detach("settingSrc");

  fossil_print("project-id: %s\n", db_get("project-code", 0));
  fossil_print("server-id:  %s\n", db_get("server-code", 0));

  zPassword = db_text(0, "SELECT pw FROM user WHERE login=%Q", g.zLogin);
  fossil_print("admin-user: %s (initial password is \"%s\")\n",
               g.zLogin, zPassword);
}

/*
** SQL functions for debugging.