Patchwork D3893: ui: make the large file warning limit fully configurable

login
register
mail settings
Submitter phabricator
Date July 9, 2018, 12:12 p.m.
Message ID <854db0a70b8b7bb2c208003b6b61c62c@localhost.localdomain>
Download mbox | patch
Permalink /patch/32698/
State Not Applicable
Headers show

Comments

phabricator - July 9, 2018, 12:12 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGa936d1368fc5: ui: make the large file warning limit fully configurable (authored by joerg.sonnenberger, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3893?vs=9469&id=9475

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

AFFECTED FILES
  mercurial/configitems.py
  mercurial/context.py
  mercurial/help/config.txt
  tests/test-largefiles.t

CHANGE DETAILS




To: joerg.sonnenberger, #hg-reviewers
Cc: av6, yuja, mercurial-devel

Patch

diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -1860,6 +1860,8 @@ 
   $ hg add --normal new-largefile
   new-largefile: up to 69 MB of RAM may be required to manage this file
   (use 'hg revert new-largefile' to cancel the pending addition)
+  $ hg revert new-largefile
+  $ hg --config ui.large-file-limit=22M add --normal new-largefile
 
 Test explicit commit of switch between normal and largefile - make sure both
 the add and the remove is committed.
diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt
--- a/mercurial/help/config.txt
+++ b/mercurial/help/config.txt
@@ -2138,6 +2138,11 @@ 
     Possible values are 'text' and 'curses'.
     This config overrides the interface specified by ui.interface.
 
+``large-file-limit``
+    Largest file size that gives no memory use warning.
+    Possible values are integers or 0 to disable the check.
+    (default: 10000000)
+
 ``logtemplate``
     Template string for commands that print changesets.
 
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1341,7 +1341,8 @@ 
                     ui.warn(_("%s does not exist!\n") % uipath(f))
                     rejected.append(f)
                     continue
-                if st.st_size > 10000000:
+                limit = ui.configbytes('ui', 'large-file-limit')
+                if limit != 0 and st.st_size > limit:
                     ui.warn(_("%s: up to %d MB of RAM may be required "
                               "to manage this file\n"
                               "(use 'hg revert %s' to cancel the "
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -1090,6 +1090,9 @@ 
 coreconfigitem('ui', 'interface.chunkselector',
     default=None,
 )
+coreconfigitem('ui', 'large-file-limit',
+    default=10000000,
+)
 coreconfigitem('ui', 'logblockedtimes',
     default=False,
 )