Ticket #756 (new enhancement)
trac-admin initenv might prompt for a wiki-default path
| Reported by: | eblotml@… | Owned by: | daniel |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.0 |
| Component: | admin/console | Version: | devel |
| Severity: | normal | Keywords: | |
| Cc: |
Description
Trac-admin prompts for default template path, but not for default wiki page path.
The following patch supports wiki-default path on command line and prompts for such a path when initenv command is invoked.
Proposed patch
Index: scripts/trac-admin
===================================================================
--- scripts/trac-admin (revision 915)
+++ scripts/trac-admin (working copy)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python
# -*- coding: iso8859-1 -*-
__author__ = 'Daniel Lundin <daniel@edgewall.com>, Jonas Borgström <jonas@edgewall.com>'
__copyright__ = 'Copyright (c) 2004 Edgewall Software'
@@ -427,7 +427,7 @@
## Initenv
_help_initenv = [('initenv', 'Create and initialize a new environment interactively'),
- ('initenv <projectname> <repospath> <templatepath>',
+ ('initenv <projectname> <repospath> <templatepath> <wikipath>',
'Create and initialize a new environment from arguments')]
def do_initdb(self, line):
@@ -460,6 +460,13 @@
dt = trac.siteconfig.__default_templates_dir__
prompt = 'Templates directory [%s]> ' % dt
returnvals.append(raw_input(prompt) or dt)
+ print
+ print ' Please enter location of Trac initial wiki pages.'
+ print ' Default is the location of the site-wide wiki pages installed with Trac.'
+ print
+ dw = trac.siteconfig.__default_wiki_dir__
+ prompt = 'Wiki pages directory [%s]> ' % dw
+ returnvals.append(raw_input(prompt) or dw)
return returnvals
def do_initenv(self, line):
@@ -470,18 +477,21 @@
project_name = None
repository_dir = None
templates_dir = None
+ wiki_dir = None
if len(arg) == 1:
returnvals = self.get_initenv_args()
project_name = returnvals[0]
repository_dir = returnvals[1]
templates_dir = returnvals[2]
- elif len(arg)!= 3:
+ wiki_dir = returnvals[3]
+ elif len(arg)!= 4:
print 'Wrong number of arguments to initenv %d' % len(arg)
return
else:
project_name = arg[0]
repository_dir = arg[1]
templates_dir = arg[2]
+ wiki_dir = arg[3]
from svn import util, repos, core
core.apr_initialize()
pool = core.svn_pool_create(None)
@@ -498,6 +508,9 @@
or not os.access(os.path.join(templates_dir, 'ticket.cs'), os.F_OK):
print templates_dir, "doesn't look like a Trac templates directory"
return
+ if not os.access(os.path.join(wiki_dir, 'WikiStart'), os.F_OK):
+ print wiki_dir, "doesn't seem to contain initial Wiki pages"
+ return
try:
print 'Creating and Initializing Project'
self.env_create()
@@ -516,7 +529,7 @@
# Add a few default wiki pages
print ' Installing wiki pages'
cursor = cnx.cursor()
- self._do_wiki_load(trac.siteconfig.__default_wiki_dir__,cursor)
+ self._do_wiki_load(wiki_dir,cursor)
print ' Indexing repository'
sync.sync(cnx, rep, fs_ptr, pool)
Attachments
Change History
Note: See
TracTickets for help on using
tickets.


