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


Ignore:
Timestamp:
11/17/06 21:26:28 (7 years ago)
Author:
lele@…
Hash name:
20061117202628-97f81-28bb52da1a60d829d5d448a89c0582df31067129
Message:

Don't assume the timestamp in darcs log is exactly 28 chars long

File:
1 edited

Legend:

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

    r1260 r1295  
    295295                #    Sun Jan  2 00:24:04 UTC 2005  lele@nautilus.homeip.net 
    296296                # we used to split on the double space before the email, 
    297                 # but in this case this is wrong. Waiting for xml output, 
    298                 # is it really sane asserting date's length to 28 chars? 
    299                 date = l[:28] 
    300                 author = l[30:-1] 
     297                # but in this case this is wrong. Then we assumed the date 
     298                # part to be exactly 28 chars long, but what about timezone 
     299                # names like 'CEST'? Waiting for xml output... 
     300                # We still assume there are *two* spaces before the email. 
     301                # The alternative is using some sort of a regex: Aaron Kaplan 
     302                # kindly suggested his own perl snippet 
     303                #    /^(... ... .\d .\d:\d\d:\d\d ...?. \d\d\d\d)  (.*)/ || die; 
     304                #    my ($date, $author) = ($1, $2); 
     305                # but that assumes the two spaces as separator, so I find the 
     306                # following solution easier and by any chance faster too.                 
     307                pieces = l.split('  ') 
     308                assert len(pieces)>1, "Cannot parse %r as a patch timestamp" % l 
     309                author = pieces.pop() 
     310                date = ' '.join(pieces) 
    301311                y,m,d,hh,mm,ss,d1,d2,d3 = strptime(date, "%a %b %d %H:%M:%S %Z %Y") 
    302312                date = datetime(y,m,d,hh,mm,ss,0,UTC) 
Note: See TracChangeset for help on using the changeset viewer.