Commit cf742bd9 authored by Aurélien Campéas's avatar Aurélien Campéas
Browse files

log: stop returning a list of names

... since we only get one at a time.
parent d4e2605c761e
......@@ -673,17 +673,17 @@ def test_history(engine, tsh):
{'author': 'aurelien.campeas@pythonian.fr',
'meta': {},
'date': pd.Timestamp('2017-02-01 00:00:00+0000', tz='UTC'),
'names': ['smallserie']
'name': 'smallserie'
},
{'author': 'aurelien.campeas@pythonian.fr',
'meta': {},
'date': pd.Timestamp('2017-02-02 00:00:00+0000', tz='UTC'),
'names': ['smallserie']
'name': 'smallserie'
},
{'author': 'aurelien.campeas@pythonian.fr',
'meta': {},
'date': pd.Timestamp('2017-02-03 00:00:00+0000', tz='UTC'),
'names': ['smallserie']
'name': 'smallserie'
}
] == [{k: v for k, v in log.items() if k != 'rev'}
for log in logs]
......
......@@ -36,13 +36,13 @@ date: {date}
def format_rev(rev):
fmt = REVFMT + '\n'
if rev.get('diff'):
fmt += 'series: {names}\n\n'
fmt += 'series: {name}\n\n'
lines = []
for ts in rev['diff'].values():
lines.append(ts.to_string())
fmt += '\n'.join(lines)
else:
fmt += 'series: {names}'
fmt += 'series: {name}'
return fmt.format(**rev)
......@@ -129,7 +129,7 @@ def log(db_uri, limit, serie, from_rev, to_rev,
for rev in tsh.log(engine, limit=limit, names=serie,
fromrev=from_rev, torev=to_rev,
fromdate=from_insertion_date, todate=to_insertion_date):
rev['names'] = ','.join(rev['names'])
# rev['name'] = ','.join(rev['names'])
print(format_rev(rev))
print()
......
......@@ -512,7 +512,7 @@ class timeseries(SeriesServices):
log.append({'rev': csetid, 'author': author,
'date': pd.Timestamp(revdate).tz_convert('utc'),
'meta': meta or {},
'names': self._changeset_series(cn, csetid)})
'name': self._changeset_series(cn, csetid)})
log.sort(key=lambda rev: rev['rev'])
return log
......@@ -715,16 +715,17 @@ class timeseries(SeriesServices):
).scalar()
def _changeset_series(self, cn, csid):
sql = ('select seriename '
f'from "{self.namespace}".registry as reg, '
f' "{self.namespace}".changeset_series as css '
'where css.serie = reg.id '
'and css.cset = %(csid)s')
q = sqlq(
'seriename'
).relation(
f'"{self.namespace}".registry as reg',
).join(
f'"{self.namespace}".changeset_series as css on css.serie = reg.id'
).where(
'css.cset = %(csid)s', csid=csid
)
return [
row.seriename
for row in cn.execute(sql, csid=csid).fetchall()
]
return q.do(cn).scalar()
def _previous_cset(self, cn, seriename, csid):
tablename = self._serie_to_tablename(cn, seriename)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment