hgext/convert/common.py
branchstable
changeset 16190 9479c28a22bf
parent 16118 d554a3dcae5a
child 16265 7887b976650a
equal deleted inserted replaced
16189:41bef17e6ad8 16190:9479c28a22bf
   383         except IOError, err:
   383         except IOError, err:
   384             if err.errno != errno.ENOENT:
   384             if err.errno != errno.ENOENT:
   385                 raise
   385                 raise
   386             return
   386             return
   387         for i, line in enumerate(fp):
   387         for i, line in enumerate(fp):
       
   388             line = line.splitlines()[0].rstrip()
       
   389             if not line:
       
   390                 # Ignore blank lines
       
   391                 continue
   388             try:
   392             try:
   389                 key, value = line.splitlines()[0].rstrip().rsplit(' ', 1)
   393                 key, value = line.rsplit(' ', 1)
   390             except ValueError:
   394             except ValueError:
   391                 raise util.Abort(
   395                 raise util.Abort(
   392                     _('syntax error in %s(%d): key/value pair expected')
   396                     _('syntax error in %s(%d): key/value pair expected')
   393                     % (self.path, i + 1))
   397                     % (self.path, i + 1))
   394             if key not in self:
   398             if key not in self:
   416     """Parse a splicemap, return a child/parents dictionary."""
   420     """Parse a splicemap, return a child/parents dictionary."""
   417     m = {}
   421     m = {}
   418     try:
   422     try:
   419         fp = open(path, 'r')
   423         fp = open(path, 'r')
   420         for i, line in enumerate(fp):
   424         for i, line in enumerate(fp):
       
   425             line = line.splitlines()[0].rstrip()
       
   426             if not line:
       
   427                 # Ignore blank lines
       
   428                 continue
   421             try:
   429             try:
   422                 child, parents = line.splitlines()[0].rstrip().split(' ', 1)
   430                 child, parents = line.split(' ', 1)
   423                 parents = parents.replace(',', ' ').split()
   431                 parents = parents.replace(',', ' ').split()
   424             except ValueError:
   432             except ValueError:
   425                 raise util.Abort(_('syntax error in %s(%d): child parent1'
   433                 raise util.Abort(_('syntax error in %s(%d): child parent1'
   426                                    '[,parent2] expected') % (path, i + 1))
   434                                    '[,parent2] expected') % (path, i + 1))
   427             pp = []
   435             pp = []