diff --git a/eden/scm/sapling/commands/subtree.py b/eden/scm/sapling/commands/subtree.py index ad7cdc786f1b2..c22dc05160eb6 100644 --- a/eden/scm/sapling/commands/subtree.py +++ b/eden/scm/sapling/commands/subtree.py @@ -434,8 +434,22 @@ def prefetch(repo, path, fileids): file_count += len(fileids) if file_count > limit: support = ui.config("ui", "supportcontact") - hint = _("contact %s for help") % support if support else "" - raise error.Abort(_("subtree copy includes too many files"), hint=hint) + help_hint = _("contact %s for help") % support if support else None + override_hint = _( + "use '--config subtree.copy-max-file-count=N' cautiously to override" + ) + hint = ( + _("%s or %s") % (help_hint, override_hint) + if help_hint + else override_hint + ) + raise error.Abort( + _( + "subtree copy includes too many files (%d), exceeding configured limit (%d)" + ) + % (file_count, limit), + hint=hint, + ) path_to_fileids[path] = fileids new_files = [] diff --git a/eden/scm/tests/test-subtree.t b/eden/scm/tests/test-subtree.t index 9e3fc102008d7..0c3dd312bb663 100644 --- a/eden/scm/tests/test-subtree.t +++ b/eden/scm/tests/test-subtree.t @@ -146,11 +146,12 @@ abort when subtree copy too many files > # drawdag.defaultfiles=false > EOS $ hg subtree cp -r $A --from-path foo --to-path bar --config subtree.copy-max-file-count=1 - abort: subtree copy includes too many files + abort: subtree copy includes too many files (2), exceeding configured limit (1) + (use '--config subtree.copy-max-file-count=N' cautiously to override) [255] $ hg subtree cp -r $A --from-path foo --to-path bar --config subtree.copy-max-file-count=1 --config ui.supportcontact="Sapling Team" - abort: subtree copy includes too many files - (contact Sapling Team for help) + abort: subtree copy includes too many files (2), exceeding configured limit (1) + (contact Sapling Team for help or use '--config subtree.copy-max-file-count=N' cautiously to override) [255]