[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

authorJulien Cristau <julien.cristau@logilab.fr>
changesetc3ef7db6f89b
branchdefault
phasedraft
hiddenno
parent revision#82663d2caa1b [views] fix crash in rss view
child revision<not specified>
files modified by this revision
hooks.py
# HG changeset patch
# User Julien Cristau <julien.cristau@logilab.fr>
# Date 1438103700 -7200
# Tue Jul 28 19:15:00 2015 +0200
# Node ID c3ef7db6f89b7e2c42c3717d9ba8c8326d8e57cd
# Parent 82663d2caa1b8518bd5498d71d6587bc4aec1afe
[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

diff --git a/hooks.py b/hooks.py
@@ -289,25 +289,18 @@
1                  vcsrepo = env.repository
2                  vcsrepochanges = []
3                  lrev1 = prevexec.repository_revision(env.repository)
4                  lrev2 = entity.repository_revision(env.repository)
5                  if lrev1 and lrev2:
6 -                    for rev in self._cw.execute(
7 -                        'Any REV, REVA, REVD, REVR, REVC ORDERBY REV '
8 -                        'WHERE REV from_repository R, R eid %(r)s, REV branch %(branch)s, '
9 -                        'REV revision > %(lrev1)s, REV revision <= %(lrev2)s, '
10 -                        'REV author REVA, REV description REVD, '
11 -                        'REV revision REVR, REV changeset REVC',
12 -                        {'r': env.repository.eid,
13 -                         'branch': lrev2.branch or env.repository.default_branch(),
14 -                         'lrev1': lrev1.revision, 'lrev2': lrev2.revision}).entities():
15 -                        msg = text_cut(rev.description)
16 -                        vcsrepochanges.append('  - %s by %s:%s' % (
17 -                            rev.dc_title(), rev.author, msg))
18 +                    with vcsrepo.cw_adapt_to('VCSRepo') as hgrepo:
19 +                        vcsrepochanges.append(hgrepo.log(
20 +                            revrange='only(%s, %s)' % (lrev2.changeset, lrev1.changeset),
21 +                            template='{node|short}  {date|isodate}  {author|person}\n  {desc|firstline}\n\n'
22 +                            ))
23                      if vcsrepochanges:
24                          vcschanges.append('* in repository %s: \n%s' % (
25 -                            env.repository.dc_title(), '\n'.join(vcsrepochanges)))
26 +                            vcsrepo.dc_title(), '\n'.join(vcsrepochanges)))
27          if vcschanges:
28              ctx['vcschanges'] = '\n'.join(vcschanges)
29          else:
30              ctx['vcschanges'] = self._cw._('* no change found in known repositories')
31          return ctx