hgfilesize.py (8652:104bd212ae41) hgfilesize.py (8680:508bbec99e58)
1from mercurial import context
2from mercurial.i18n import _
3
4'''
5[extensions]
6hgfilesize=~/m5/incoming/util/hgfilesize.py
7
8[hooks]

--- 9 unchanged lines hidden (view full) ---

18
19 # default limit is 1 MB
20 limit = int(ui.config('limit_file_size', 'maximum_file_size', 1024*1024))
21 existing_tip = context.changectx(repo, node).rev()
22 new_tip = context.changectx(repo, 'tip').rev()
23 for rev in xrange(existing_tip, new_tip + 1):
24 ctx = context.changectx(repo, rev)
25 for f in ctx.files():
1from mercurial import context
2from mercurial.i18n import _
3
4'''
5[extensions]
6hgfilesize=~/m5/incoming/util/hgfilesize.py
7
8[hooks]

--- 9 unchanged lines hidden (view full) ---

18
19 # default limit is 1 MB
20 limit = int(ui.config('limit_file_size', 'maximum_file_size', 1024*1024))
21 existing_tip = context.changectx(repo, node).rev()
22 new_tip = context.changectx(repo, 'tip').rev()
23 for rev in xrange(existing_tip, new_tip + 1):
24 ctx = context.changectx(repo, rev)
25 for f in ctx.files():
26 if f not in ctx:
27 continue
26 fctx = ctx.filectx(f)
27 if fctx.size() > limit:
28 ui.write(_('file %s of %s is too large: %d > %d\n') % \
29 (f, ctx, fctx.size(), limit))
30 return True # This is invalid
31
32 return False # Things are OK.
28 fctx = ctx.filectx(f)
29 if fctx.size() > limit:
30 ui.write(_('file %s of %s is too large: %d > %d\n') % \
31 (f, ctx, fctx.size(), limit))
32 return True # This is invalid
33
34 return False # Things are OK.