D2904: templatefuncs: add mailmap template function

yuja (Yuya Nishihara) phabricator at mercurial-scm.org
Fri Mar 30 08:50:01 EDT 2018


yuja requested changes to this revision.
yuja added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> templatefuncs.py:186
> +
> +        if not repo.wvfs.exists('.mailmap'):
> +            return author

Nit: `.exists()` isn't needed. `tryread()` handles it.

> templatefuncs.py:189
> +
> +        data = repo.wvfs.tryread('.mailmap')
> +

Still reading the file no matter if it is cached or not. This should be:

  if 'mailmap' not in cache:
      data = repo.wvfs.tryread(...)
      cache['mailmap'] = parsemailmap(data)

> templatefuncs.py:194
> +
> +    except (error.ManifestLookupError, IOError):
> +        # Return the plain author if no mailmap file is found

Nit: try-except isn't needed thanks to `tryread()`.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2904

To: sheehan, #hg-reviewers, yuja
Cc: yuja, mercurial-devel


More information about the Mercurial-devel mailing list