def _parseDarcsPull(self, output): """Process 'darcs pull' output to Changesets. """ from datetime import datetime from time import strptime from sha import new from vcpx.changes import Changeset l = output.readline() while l and not (l.startswith('Would pull the following changes:') or l == 'No remote changes to pull in!\n'): l = output.readline() if l <> 'No remote changes to pull in!\n': ## Sat Jul 17 01:22:08 CEST 2004 lele@nautilus ## * Refix _getUpstreamChangesets for darcs fsep = re.compile('[ :]+') l = output.readline() while not l.startswith('Making no changes: this is a dry run.'): # Assume it's a line like # Sun Jan 2 00:24:04 UTC 2005 [email protected] # Use a regular expression matching multiple spaces or colons # to split it, and use the first 7 fields to build up a datetime. pieces = fsep.split(l.rstrip(), 8) assert len(pieces)>=7, "Cannot parse %r as a patch timestamp" % l date = ' '.join(pieces[:8]) author = pieces[8] y,m,d,hh,mm,ss,d1,d2,d3 = strptime(date, "%a %b %d %H %M %S %Z %Y") date = datetime(y,m,d,hh,mm,ss,0,UTC) l = output.readline().rstrip() assert (l.startswith(' *') or l.startswith(' UNDO:') or l.startswith(' tagged')), \ "Got %r but expected the start of the log" % l if l.startswith(' *'): name = l[4:] else: name = l[2:] changelog = [] l = output.readline() while l.startswith(' '): changelog.append(l[2:-1]) l = output.readline() cset = Changeset(name, date, author, '\n'.join(changelog)) compactdate = date.strftime("%Y%m%d%H%M%S") if name.startswith('UNDO: '): name = name[6:] inverted = 't' else: inverted = 'f' if name.startswith('tagged '): name = name[7:] if cset.tags is None: cset.tags = [name] else: cset.tags.append(name) name = "TAG " + name phash = new() phash.update(name) phash.update(author) phash.update(compactdate) phash.update(''.join(changelog)) phash.update(inverted) cset.darcs_hash = '%s-%s-%s.gz' % (compactdate, new(author).hexdigest()[:5], phash.hexdigest()) yield cset while not l.strip(): l = output.readline()
def _parseDarcsPull(self, output): """Process 'darcs pull' output to Changesets. """ from datetime import datetime from time import strptime from sha import new from vcpx.changes import Changeset l = output.readline() while l and not (l.startswith('Would pull the following changes:') or l == 'No remote changes to pull in!\n'): l = output.readline() if l <> 'No remote changes to pull in!\n': ## Sat Jul 17 01:22:08 CEST 2004 lele@nautilus ## * Refix _getUpstreamChangesets for darcs fsep = re.compile('[ :]+') l = output.readline() while not l.startswith('Making no changes: this is a dry run.'): # Assume it's a line like # Sun Jan 2 00:24:04 UTC 2005 [email protected] # Use a regular expression matching multiple spaces or colons # to split it, and use the first 7 fields to build up a datetime. pieces = fsep.split(l.rstrip(), 8) assert len( pieces) >= 7, "Cannot parse %r as a patch timestamp" % l date = ' '.join(pieces[:8]) author = pieces[8] y, m, d, hh, mm, ss, d1, d2, d3 = strptime( date, "%a %b %d %H %M %S %Z %Y") date = datetime(y, m, d, hh, mm, ss, 0, UTC) l = output.readline().rstrip() assert (l.startswith(' *') or l.startswith(' UNDO:') or l.startswith(' tagged')), \ "Got %r but expected the start of the log" % l if l.startswith(' *'): name = l[4:] else: name = l[2:] changelog = [] l = output.readline() while l.startswith(' '): changelog.append(l[2:-1]) l = output.readline() cset = Changeset(name, date, author, '\n'.join(changelog)) compactdate = date.strftime("%Y%m%d%H%M%S") if name.startswith('UNDO: '): name = name[6:] inverted = 't' else: inverted = 'f' if name.startswith('tagged '): name = name[7:] if cset.tags is None: cset.tags = [name] else: cset.tags.append(name) name = "TAG " + name phash = new() phash.update(name) phash.update(author) phash.update(compactdate) phash.update(''.join(changelog)) phash.update(inverted) cset.darcs_hash = '%s-%s-%s.gz' % (compactdate, new(author).hexdigest()[:5], phash.hexdigest()) yield cset while not l.strip(): l = output.readline()