Changeset 1384 in tailor for vcpx/repository/darcs/source.py
- Timestamp:
- 06/13/07 01:06:24 (6 years ago)
- Hash name:
- 20070612230624-8c5d4-1b78b236e353451e151e39ec5f87f65fd57781f3
- File:
-
- 1 edited
-
vcpx/repository/darcs/source.py (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
vcpx/repository/darcs/source.py
r1371 r1384 125 125 126 126 def changesets_from_darcschanges(changes, unidiff=False, repodir=None, 127 chunksize=2**15 ):127 chunksize=2**15, replace_badchars=None): 128 128 """ 129 129 Parse XML output of ``darcs changes``. … … 136 136 137 137 csets = changesets_from_darcschanges_unsafe(changes, unidiff, 138 repodir, chunksize) 138 repodir, chunksize, 139 replace_badchars) 139 140 for cs in csets: 140 141 yield cs 141 142 142 143 def changesets_from_darcschanges_unsafe(changes, unidiff=False, repodir=None, 143 chunksize=2**15 ):144 chunksize=2**15, replace_badchars=None): 144 145 """ 145 146 Do the real work of parsing the change log, including tags. … … 241 242 parser.setErrorHandler(ErrorHandler()) 242 243 243 chunk = changes.read(chunksize) 244 def fixup_badchars(s, map): 245 if not map: 246 return s 247 248 ret = [map.get(c, c) for c in s] 249 return "".join(ret) 250 251 chunk = fixup_badchars(changes.read(chunksize), replace_badchars) 244 252 while chunk: 245 253 parser.feed(chunk) … … 247 255 yield cs 248 256 handler.changesets = [] 249 chunk = changes.read(chunksize)257 chunk = fixup_badchars(changes.read(chunksize), replace_badchars) 250 258 parser.close() 251 259 for cs in handler.changesets: … … 309 317 # my ($date, $author) = ($1, $2); 310 318 # but that assumes the two spaces as separator, so I find the 311 # following solution easier and by any chance faster too. 319 # following solution easier and by any chance faster too. 312 320 pieces = l.rstrip().split(' ') 313 321 assert len(pieces)>1, "Cannot parse %r as a patch timestamp" % l … … 418 426 "--xml-output", "--summ") 419 427 changes = ExternalCommand(cwd=self.repository.basedir, command=cmd) 420 last = changesets_from_darcschanges(changes.execute(stdout=PIPE)[0]) 428 last = changesets_from_darcschanges(changes.execute(stdout=PIPE)[0], 429 replace_badchars=self.repository.replace_badchars) 421 430 try: 422 431 changeset.entries.extend(last.next().entries) … … 470 479 output and output.read() or '')) 471 480 472 csets = changesets_from_darcschanges(output )481 csets = changesets_from_darcschanges(output, replace_badchars=self.repository.replace_badchars) 473 482 changeset = csets.next() 474 483 … … 532 541 (str(changes), changes.exit_status, output.read())) 533 542 534 last = changesets_from_darcschanges(output )543 last = changesets_from_darcschanges(output, replace_badchars=self.repository.replace_badchars) 535 544 536 545 return last.next()
Note: See TracChangeset
for help on using the changeset viewer.
