Fossil

Check-in [78cf4138d9]
Login

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

Overview
Comment:Use the list of configuration properties when transfering content from the template repo to the new repo. Also transfer the ticket formats.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | newTemplate
Files: files | file ages | folders
SHA1: 78cf4138d9ab7214bc7a865d8209598fc41a50a7
User & Date: drh 2012-09-18 20:14:34.080
Context
2012-09-18
20:59
Copy the control settings into the new repository as well. Also, correct the query used to copy the system user column values. Closed-Leaf check-in: 4bab4459b6 user: mistachkin tags: newTemplate
20:14
Use the list of configuration properties when transfering content from the template repo to the new repo. Also transfer the ticket formats. check-in: 78cf4138d9 user: drh tags: newTemplate
03:21
Add experimental support for copying the initial settings of a repository from another repository. check-in: e771171c68 user: mistachkin tags: newTemplate
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/configure.c.
155
156
157
158
159
160
161






















162
163
164
165
166
167
168
      }else{
        iConfig++;
      }
    }
  }
  return 0;
}























/*
** Return the mask for the named configuration parameter if it can be
** safely exported.  Return 0 if the parameter is not safe to export.
**
** "Safe" in the previous paragraph means the permission is created to
** export the property.  In other words, the requesting side has presented







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
      }else{
        iConfig++;
      }
    }
  }
  return 0;
}

/*
** Return a pointer to a string that contains the RHS of an IN operator
** that will select CONFIG table names that are part of the configuration
** that matchines iMatch.
*/
const char *configure_inop_rhs(int iMask){
  Blob x;
  int i;
  const char *zSep = "";

  blob_zero(&x);
  blob_append(&x, "(", 1);
  for(i=0; i<count(aConfig); i++){
    if( (aConfig[i].groupMask & iMask)==0 ) continue;
    if( aConfig[i].zName[0]=='@' ) continue;
    blob_appendf(&x, "%s'%s'", zSep, aConfig[i].zName);
    zSep = ",";
  }
  blob_append(&x, ")", 1);
  return blob_str(&x);
}

/*
** Return the mask for the named configuration parameter if it can be
** safely exported.  Return 0 if the parameter is not safe to export.
**
** "Safe" in the previous paragraph means the permission is created to
** export the property.  In other words, the requesting side has presented
Changes to src/db.c.
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
  if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0);
  if( !db_is_global("localauth") ) db_set_int("localauth", 0, 0);
  db_create_default_users(0, zDefaultUser);
  user_select();

  if( zTemplate ){
    /*
    ** Copy all settings from the supplied template repository
    ** except those that are, by definition, always unique to a
    ** specific project.  The list of settings excluded by this
    ** SQL statement may need to be revised in the future.
    */
    db_multi_exec(
      "INSERT OR REPLACE INTO config"
      " SELECT name,value,mtime"
      " FROM settingSrc.config WHERE name NOT IN ("
      "       'content-schema','aux-schema',"
      "       'server-code','project-code',"
      "       'last-sync-url','last-sync-pw',"
      "       'captcha-secret','login-group-code',"
      "       'login-group-name'"
      " ) AND "
      " name NOT GLOB 'ckout:*' AND"
      " name NOT GLOB 'baseurl:*' AND"
      " name NOT GLOB 'peer-name-*' AND"
      " name NOT GLOB 'peer-repo-*';"

    );




    /*
    ** Copy the user permissions, contact information, last modified
    ** time, and photo for all the "system" users from the supplied
    ** template repository into the one being setup.  The other columns
    ** are not copied because they contain security information or other
    ** data specific to the other repository.  The list of columns copied
    ** by this SQL statement may need to be revised in the future.







|
<
<
<



|
|
<
<
<
<
<
<
<
<
<
|
>

>
>
>
>







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
  if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0);
  if( !db_is_global("localauth") ) db_set_int("localauth", 0, 0);
  db_create_default_users(0, zDefaultUser);
  user_select();

  if( zTemplate ){
    /*
    ** Copy all settings from the supplied template repository.



    */
    db_multi_exec(
      "INSERT OR REPLACE INTO config"
      " SELECT name,value,mtime FROM settingSrc.config"
      "  WHERE name IN %s"









      "    AND name NOT GLOB 'project-*';",
      configure_inop_rhs(CONFIGSET_ALL)
    );
    db_multi_exec(
      "REPLACE INTO reportfmt SELECT * FROM settingSrc.reportfmt;"
    );

    /*
    ** Copy the user permissions, contact information, last modified
    ** time, and photo for all the "system" users from the supplied
    ** template repository into the one being setup.  The other columns
    ** are not copied because they contain security information or other
    ** data specific to the other repository.  The list of columns copied
    ** by this SQL statement may need to be revised in the future.