dolthub / doltpy

A Python API for Dolt
Apache License 2.0
55 stars 13 forks source link

Merge commit breaks log() parsing #96

Closed louisrigot closed 3 years ago

louisrigot commented 3 years ago

Having a merge commit in the dolt log breaks log() parsing, since there's an extra "Merge:" line between "commit" and "Author:" in the output.

Stacktrace (sanitized)

  File "venv/lib/python3.8/site-packages/doltpy/core/dolt.py", line 500, in log
    date = datetime.strptime(output[i + date_offset].split(':', maxsplit=1)[1].lstrip(),
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/_strptime.py", line 568, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/_strptime.py", line 349, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data 'author <author@domain.local>' does not match format '%a %b %d %H:%M:%S %z %Y'

dolt log output (sanitized)

commit 53lmlmpumo499i5puf12ip875taql2ad
Merge: 48l4ovo7c2mrqkagi9io1g3eam1s5m0b 0puirbrqe5sgtjrr8j2ka3dabeo6nk58
Author: author <author@domain.local>
Date:   Thu Oct 01 21:17:20 +0200 2020

    Merged PR #1

[...]