hgext/convert/filemap.py
changeset 36589 41c0e7b7869c
parent 36588 5374a22d014a
child 41179 77088fa862df
equal deleted inserted replaced
36588:5374a22d014a 36589:41c0e7b7869c
     9 import posixpath
     9 import posixpath
    10 
    10 
    11 from mercurial.i18n import _
    11 from mercurial.i18n import _
    12 from mercurial import (
    12 from mercurial import (
    13     error,
    13     error,
       
    14     pycompat,
    14 )
    15 )
    15 from . import common
    16 from . import common
    16 SKIPREV = common.SKIPREV
    17 SKIPREV = common.SKIPREV
    17 
    18 
    18 def rpairs(path):
    19 def rpairs(path):
    65                 return 1
    66                 return 1
    66             if (name.startswith('/') or
    67             if (name.startswith('/') or
    67                 name.endswith('/') or
    68                 name.endswith('/') or
    68                 '//' in name):
    69                 '//' in name):
    69                 self.ui.warn(_('%s:%d: superfluous / in %s %r\n') %
    70                 self.ui.warn(_('%s:%d: superfluous / in %s %r\n') %
    70                              (lex.infile, lex.lineno, listname, name))
    71                              (lex.infile, lex.lineno, listname,
       
    72                               pycompat.bytestr(name)))
    71                 return 1
    73                 return 1
    72             return 0
    74             return 0
    73         lex = common.shlexer(
    75         lex = common.shlexer(
    74             filepath=path, wordchars='!@#$%^&*()-=+[]{}|;:,./<>?')
    76             filepath=path, wordchars='!@#$%^&*()-=+[]{}|;:,./<>?')
    75         cmd = lex.get_token()
    77         cmd = lex.get_token()
    90                 self.rename[src] = dest
    92                 self.rename[src] = dest
    91             elif cmd == 'source':
    93             elif cmd == 'source':
    92                 errs += self.parse(normalize(lex.get_token()))
    94                 errs += self.parse(normalize(lex.get_token()))
    93             else:
    95             else:
    94                 self.ui.warn(_('%s:%d: unknown directive %r\n') %
    96                 self.ui.warn(_('%s:%d: unknown directive %r\n') %
    95                              (lex.infile, lex.lineno, cmd))
    97                              (lex.infile, lex.lineno, pycompat.bytestr(cmd)))
    96                 errs += 1
    98                 errs += 1
    97             cmd = lex.get_token()
    99             cmd = lex.get_token()
    98         return errs
   100         return errs
    99 
   101 
   100     def lookup(self, name, mapping):
   102     def lookup(self, name, mapping):