Fossil

Diff
Login

Differences From Artifact [c776b3bd01]:

To Artifact [fdcc320716]:


73
74
75
76
77
78
79

80
81
82
83
84
85
86
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87







+







    fprintf(stderr, "%s: %s\n", g.argv[0], z);
  }
  db_force_rollback();
  exit(1);
}

static int nBegin = 0;      /* Nesting depth of BEGIN */
static int isNewRepo = 0;   /* True if the repository is newly created */
static int doRollback = 0;  /* True to force a rollback */
static int nCommitHook = 0; /* Number of commit hooks */
static struct sCommitHook {
  int (*xHook)(void);  /* Functions to call at db_end_transaction() */
  int sequence;        /* Call functions in sequence order */
} aHook[5];

122
123
124
125
126
127
128




129
130
131
132
133
134
135
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140







+
+
+
+







    db_multi_exec(doRollback ? "ROLLBACK" : "COMMIT");
    doRollback = 0;
  }
}
void db_force_rollback(void){
  if( nBegin ){
    sqlite3_exec(g.db, "ROLLBACK", 0, 0, 0);
    if( isNewRepo ){
      db_close();
      unlink(g.zRepositoryName);
    }
  }
  nBegin = 0;
}

/*
** Install a commit hook.  Hooks are installed in sequence order.
** It is an error to install the same commit hook more than once.
728
729
730
731
732
733
734

735
736
737
738
739
740
741
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747







+







void db_create_repository(const char *zFilename){
  db_init_database(
     zFilename,
     zRepositorySchema1,
     zRepositorySchema2,
     (char*)0
  );
  isNewRepo = 1;
}

/*
** Fill an empty repository database with the basic information for a
** repository. This function is shared between 'create_repository_cmd'
** ('new') and 'reconstruct_cmd' ('reconstruct'), both of which create
** new repositories.
802
803
804
805
806
807
808

809
810
811
812
813
814
815
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822







+







  }
}

/*
** COMMAND: new
**
** Usage: %fossil new FILENAME
**
** Create a repository for a new project in the file named FILENAME.
** This command is distinct from "clone".  The "clone" command makes
** a copy of an existing project.  This command starts a new project.
*/
void create_repository_cmd(void){
  if( g.argc!=3 ){
    usage("REPOSITORY-NAME");
1111
1112
1113
1114
1115
1116
1117
1118

1119

1120
1121

1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1118
1119
1120
1121
1122
1123
1124

1125
1126
1127
1128
1129
1130
1131


1132
1133
1134
1135
1136
1137
1138







-
+

+


+

-
-







**
**    gdiff-command    External command to run when performing a graphical
**                     diff. If undefined, text diff will be used.
*/
void setting_cmd(void){
  static const char *azName[] = {
    "autosync",
    "pgp-command",
    "diff-command",
    "editor",
    "gdiff-command",
    "localauth",
    "omitsign",
    "pgp-command",
    "proxy",
    "diff-command",
    "gdiff-command",
  };
  int i;
  int globalFlag = find_option("global","g",0)!=0;
  int unsetFlag = g.argv[1][0]=='u';
  db_find_and_open_repository(0);
  if( !g.repositoryOpen ){
    db_open_config();