mercurial/sparse.py
changeset 38862 1ff45c518e6f
parent 38861 49505ec24e8f
child 39527 9db856446298
equal deleted inserted replaced
38861:49505ec24e8f 38862:1ff45c518e6f
    54             if line:
    54             if line:
    55                 profiles.add(line)
    55                 profiles.add(line)
    56         elif line == '[include]':
    56         elif line == '[include]':
    57             if havesection and current != includes:
    57             if havesection and current != includes:
    58                 # TODO pass filename into this API so we can report it.
    58                 # TODO pass filename into this API so we can report it.
    59                 raise error.Abort(_('%s config cannot have includes '
    59                 raise error.Abort(_('%(action)s config cannot have includes '
    60                                     'after excludes') % action)
    60                                     'after excludes') % {'action': action})
    61             havesection = True
    61             havesection = True
    62             current = includes
    62             current = includes
    63             continue
    63             continue
    64         elif line == '[exclude]':
    64         elif line == '[exclude]':
    65             havesection = True
    65             havesection = True
    66             current = excludes
    66             current = excludes
    67         elif line:
    67         elif line:
    68             if current is None:
    68             if current is None:
    69                 raise error.Abort(_('%s config entry outside of '
    69                 raise error.Abort(_('%(action)s config entry outside of '
    70                                     'section: %s') % (action, line),
    70                                     'section: %(line)s')
       
    71                                   % {'action': action, 'line': line},
    71                                   hint=_('add an [include] or [exclude] line '
    72                                   hint=_('add an [include] or [exclude] line '
    72                                          'to declare the entry type'))
    73                                          'to declare the entry type'))
    73 
    74 
    74             if line.strip().startswith('/'):
    75             if line.strip().startswith('/'):
    75                 ui.warn(_('warning: %s profile cannot use'
    76                 ui.warn(_('warning: %(action)s profile cannot use'
    76                           ' paths starting with /, ignoring %s\n')
    77                           ' paths starting with /, ignoring %(line)s\n')
    77                         % (action, line))
    78                         % {'action': action, 'line': line})
    78                 continue
    79                 continue
    79             current.add(line)
    80             current.add(line)
    80 
    81 
    81     return includes, excludes, profiles
    82     return includes, excludes, profiles
    82 
    83