diff hgext/largefiles/overrides.py @ 15227:a7686abf73a6

largefiles: factor out lfutil.getminsize()
author Greg Ward <greg@gerg.ca>
date Tue, 11 Oct 2011 21:11:01 -0400
parents 7c604d8c7e83
children 89e19ca2a90e
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Tue Oct 11 14:01:24 2011 +0200
+++ b/hgext/largefiles/overrides.py	Tue Oct 11 21:11:01 2011 -0400
@@ -16,6 +16,7 @@
 from mercurial.i18n import _
 from mercurial.node import hex
 from hgext import rebase
+import lfutil
 
 try:
     from mercurial import scmutil
@@ -64,16 +65,8 @@
 # version of add.
 def override_add(orig, ui, repo, *pats, **opts):
     large = opts.pop('large', None)
-
-    lfsize = opts.pop('lfsize', None)
-    if not lfsize and lfutil.islfilesrepo(repo):
-        lfsize = ui.config(lfutil.longname, 'size', default='10')
-    if lfsize:
-        try:
-            lfsize = int(lfsize)
-        except ValueError:
-            raise util.Abort(_('largefiles: size must be an integer, was %s\n')
-                             % lfsize)
+    lfsize = lfutil.getminsize(
+        ui, lfutil.islfilesrepo(repo), opts.pop('lfsize', None))
 
     lfmatcher = None
     if os.path.exists(repo.wjoin(lfutil.shortname)):