Mercurial > hg > mercurial-crew
view contrib/python-hook-examples.py @ 18397:ecf4f79cc600
stream_in: write the remote branchcache for a usage as wide as possible
Writing cache for unfiltered repo only is barely useful, Most repo user are now
at least use the `hidden` filter. This changeset now assigns the remote cache
for a filter as low as possible for a wider reuse as possible.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Wed, 16 Jan 2013 00:12:01 +0100 (2013-01-15) |
parents | a8d13ee0ce68 |
children |
line wrap: on
line source
''' Examples of useful python hooks for Mercurial. ''' from mercurial import patch, util def diffstat(ui, repo, **kwargs): '''Example usage: [hooks] commit.diffstat = python:/path/to/this/file.py:diffstat changegroup.diffstat = python:/path/to/this/file.py:diffstat ''' if kwargs.get('parent2'): return node = kwargs['node'] first = repo[node].p1().node() if 'url' in kwargs: last = repo['tip'].node() else: last = node diff = patch.diff(repo, first, last) ui.write(patch.diffstat(util.iterlines(diff)))