Changeset 1317 in tailor for vcpx/repository/darcs/source.py


Ignore:
Timestamp:
02/26/07 21:46:55 (6 years ago)
Author:
lele@…
Hash name:
20070226204655-97f81-f608589c9db6f0887614c66f06d7a41517af7a14
Message:

Use line.rstrip() instead of line[:-1], to better handle non-unix newlines

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vcpx/repository/darcs/source.py

    r1314 r1317  
    311311                # but that assumes the two spaces as separator, so I find the 
    312312                # following solution easier and by any chance faster too.                 
    313                 pieces = l.split('  ') 
     313                pieces = l.rstrip().split('  ') 
    314314                assert len(pieces)>1, "Cannot parse %r as a patch timestamp" % l 
    315                 author = pieces.pop()[:-1] 
     315                author = pieces.pop() 
    316316                date = ' '.join(pieces) 
    317317                y,m,d,hh,mm,ss,d1,d2,d3 = strptime(date, "%a %b %d %H:%M:%S %Z %Y") 
    318318                date = datetime(y,m,d,hh,mm,ss,0,UTC) 
    319                 l = output.readline() 
     319                l = output.readline().rstrip() 
    320320                assert (l.startswith('  * ') or 
    321321                        l.startswith('  UNDO:') or 
    322                         l.startswith('  tagged')) 
     322                        l.startswith('  tagged')), \ 
     323                        "Got %r but expected the start of the log" % l 
    323324 
    324325                if l.startswith('  *'): 
    325                     name = l[4:-1] 
     326                    name = l[4:] 
    326327                else: 
    327                     name = l[2:-1] 
     328                    name = l[2:] 
    328329 
    329330                changelog = [] 
    330                 l = output.readline() 
     331                l = output.readline().rstrip() 
    331332                while l.startswith('  '): 
    332                     changelog.append(l[2:-1]) 
    333                     l = output.readline() 
     333                    changelog.append(l[2:]) 
     334                    l = output.readline().rstrip() 
    334335 
    335336                cset = Changeset(name, date, author, '\n'.join(changelog)) 
     
    356357                    yield cset 
    357358 
    358                 while not l.strip(): 
    359                     l = output.readline() 
     359                while not l: 
     360                    l = output.readline().strip() 
    360361 
    361362    def _applyChangeset(self, changeset): 
Note: See TracChangeset for help on using the changeset viewer.