"Fossies" - the Fresh Open Source Software Archive

Member "PURELIB/trac/upgrades/db29.py" (27 Aug 2019, 1594 Bytes) of package /windows/misc/Trac-1.4.win32.exe:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "db29.py": 1.3.5_vs_1.3.6.

    1 # -*- coding: utf-8 -*-
    2 #
    3 # Copyright (C) 2012-2019 Edgewall Software
    4 # All rights reserved.
    5 #
    6 # This software is licensed as described in the file COPYING, which
    7 # you should have received as part of this distribution. The terms
    8 # are also available at https://trac.edgewall.org/wiki/TracLicense.
    9 #
   10 # This software consists of voluntary contributions made by many
   11 # individuals. For the exact contribution history, see the revision
   12 # history and logs, available at https://trac.edgewall.org/.
   13 
   14 from trac.util import backup_config_file
   15 
   16 
   17 _svn_components = [
   18     'svn_fs.SubversionConnector',
   19     'svn_prop.SubversionMergePropertyDiffRenderer',
   20     'svn_prop.SubversionMergePropertyRenderer',
   21     'svn_prop.SubversionPropertyRenderer',
   22 ]
   23 _old_path = 'trac.versioncontrol.'
   24 _new_path = 'tracopt.versioncontrol.svn.'
   25 
   26 
   27 def do_upgrade(env, version, cursor):
   28     """Automatically enable tracopt.versioncontrol.svn.* components,
   29     unless they were explicitly disabled or the new svn components are
   30     already enabled.
   31     """
   32     enable = [c for c in _svn_components
   33               if env.is_component_enabled(_old_path + c) and
   34               not env.is_component_enabled(_new_path + c)]
   35     if not enable:
   36         return
   37     backup_config_file(env, '.tracopt-svn.bak')
   38     for c in enable:
   39         env.config.set('components', _new_path + c, 'enabled')
   40     env.config.save()
   41     env.log.info("Enabled components %r to cope with the move from %s to %s.",
   42                  enable,
   43                  _old_path.replace('.', '/'), _new_path.replace('.', '/'))