[hooks] fix notification message for vcsfile 2 draft
authorJulien Cristau <julien.cristau@logilab.fr>
Tue, 28 Jul 2015 19:15:00 +0200
changeset 1837 c3ef7db6f89b
parent 1836 82663d2caa1b
[hooks] fix notification message for vcsfile 2 - branching and obsolescence mean a range of revision numbers isn't enough to get a log - we don't store revision numbers anymore anyway XXX untested
hooks.py
--- a/hooks.py	Mon Jul 27 15:29:27 2015 +0200
+++ b/hooks.py	Tue Jul 28 19:15:00 2015 +0200
@@ -291,21 +291,14 @@
                 lrev1 = prevexec.repository_revision(env.repository)
                 lrev2 = entity.repository_revision(env.repository)
                 if lrev1 and lrev2:
-                    for rev in self._cw.execute(
-                        'Any REV, REVA, REVD, REVR, REVC ORDERBY REV '
-                        'WHERE REV from_repository R, R eid %(r)s, REV branch %(branch)s, '
-                        'REV revision > %(lrev1)s, REV revision <= %(lrev2)s, '
-                        'REV author REVA, REV description REVD, '
-                        'REV revision REVR, REV changeset REVC',
-                        {'r': env.repository.eid,
-                         'branch': lrev2.branch or env.repository.default_branch(),
-                         'lrev1': lrev1.revision, 'lrev2': lrev2.revision}).entities():
-                        msg = text_cut(rev.description)
-                        vcsrepochanges.append('  - %s by %s:%s' % (
-                            rev.dc_title(), rev.author, msg))
+                    with vcsrepo.cw_adapt_to('VCSRepo') as hgrepo:
+                        vcsrepochanges.append(hgrepo.log(
+                            revrange='only(%s, %s)' % (lrev2.changeset, lrev1.changeset),
+                            template='{node|short}  {date|isodate}  {author|person}\n  {desc|firstline}\n\n'
+                            ))
                     if vcsrepochanges:
                         vcschanges.append('* in repository %s: \n%s' % (
-                            env.repository.dc_title(), '\n'.join(vcsrepochanges)))
+                            vcsrepo.dc_title(), '\n'.join(vcsrepochanges)))
         if vcschanges:
             ctx['vcschanges'] = '\n'.join(vcschanges)
         else: