Show More
@@ -2501,6 +2501,64 b' Currently recognised values are:' | |||
|
2501 | 2501 | """ |
|
2502 | 2502 | |
|
2503 | 2503 | [[items]] |
|
2504 | section = "usage" | |
|
2505 | name = "resources" | |
|
2506 | default = "default" | |
|
2507 | documentation = """How aggressive Mercurial can be with resource usage: | |
|
2508 | ||
|
2509 | Currently recognised values are: | |
|
2510 | - default: the default value currently is equivalent to medium, | |
|
2511 | - high: allows for higher cpu, memory and disk-space usage to improve the performance of some operations. | |
|
2512 | - medium: aims at a moderate resource usage, | |
|
2513 | - low: reduces resources usage when possible, decreasing overall performance. | |
|
2514 | ||
|
2515 | For finer configuration, see also `usage.resources.cpu`, | |
|
2516 | `usage.resources.disk` and `usage.resources.memory`. | |
|
2517 | """ | |
|
2518 | ||
|
2519 | [[items]] | |
|
2520 | section = "usage" | |
|
2521 | name = "resources.cpu" | |
|
2522 | default = "default" | |
|
2523 | documentation = """How aggressive Mercurial can be in terms of cpu usage: | |
|
2524 | ||
|
2525 | Currently recognised values are: | |
|
2526 | - default: the default value, inherits the value from `usage.resources`, | |
|
2527 | - high: allows for more aggressive cpu usage, improving storage quality and | |
|
2528 | the performance of some operations at the expense of machine load | |
|
2529 | - medium: aims at a moderate cpu usage, | |
|
2530 | - low: reduces cpu usage when possible, potentially at the expense of | |
|
2531 | slower operations, increased storage and exchange payload. | |
|
2532 | ||
|
2533 | """ | |
|
2534 | ||
|
2535 | [[items]] | |
|
2536 | section = "usage" | |
|
2537 | name = "resources.disk" | |
|
2538 | default = "default" | |
|
2539 | documentation = """How aggressive Mercurial can be in terms of disk usage: | |
|
2540 | ||
|
2541 | Currently recognised values are: | |
|
2542 | - default: the default value, inherits the value from `usage.resources`, | |
|
2543 | - high: allows for more disk space usage where it can improve the performance, | |
|
2544 | - medium: aims at a moderate disk usage, | |
|
2545 | - low: reduces disk usage when possible, decreasing performance in some occasion. | |
|
2546 | """ | |
|
2547 | ||
|
2548 | [[items]] | |
|
2549 | section = "usage" | |
|
2550 | name = "resources.memory" | |
|
2551 | default = "default" | |
|
2552 | documentation = """How aggressive Mercurial can be in terms of memory usage: | |
|
2553 | ||
|
2554 | Currently recognised values are: | |
|
2555 | - default: the default value, inherits the value from `usage.resources`, | |
|
2556 | - high: allows for more aggressive memory usage to improve overall performance, | |
|
2557 | - medium: aims at a moderate memory usage, | |
|
2558 | - low: reduces memory usage when possible at the cost of overall performance. | |
|
2559 | """ | |
|
2560 | ||
|
2561 | [[items]] | |
|
2504 | 2562 | section = "verify" |
|
2505 | 2563 | name = "skipflags" |
|
2506 | 2564 | default = 0 |
@@ -3005,6 +3005,52 b' User interface controls.' | |||
|
3005 | 3005 | Currently recognised values are: |
|
3006 | 3006 | - default: an all purpose repository |
|
3007 | 3007 | |
|
3008 | ``resources`` | |
|
3009 | How aggressive Mercurial can be with resource usage: | |
|
3010 | ||
|
3011 | Currently recognised values are: | |
|
3012 | - default: the default value currently is equivalent to medium, | |
|
3013 | - high: allows for higher cpu, memory and disk-space usage to improve | |
|
3014 | performance of some operations. | |
|
3015 | - medium: aims at a moderate resource usage, | |
|
3016 | - low: reduces resources usage when possible, decreasing overall | |
|
3017 | performance. | |
|
3018 | ||
|
3019 | For finer configuration, see also `usage.resources.cpu`, | |
|
3020 | `usage.resources.disk` and `usage.resources.memory`. | |
|
3021 | ||
|
3022 | ``resources.cpu`` | |
|
3023 | How aggressive Mercurial can be in terms of cpu usage: | |
|
3024 | ||
|
3025 | Currently recognised values are: | |
|
3026 | - default: the default value, inherits the value from `usage.resources`, | |
|
3027 | - high: allows for more aggressive cpu usage, improving storage quality and | |
|
3028 | the performance of some operations at the expense of machine load | |
|
3029 | - medium: aims at a moderate cpu usage, | |
|
3030 | - low: reduces cpu usage when possible, potentially at the expense of | |
|
3031 | slower operations, increased storage and exchange payload. | |
|
3032 | ||
|
3033 | ``resources.disk`` | |
|
3034 | How aggressive Mercurial can be in terms of disk usage: | |
|
3035 | ||
|
3036 | Currently recognised values are: | |
|
3037 | - default: the default value, inherits the value from `usage.resources`, | |
|
3038 | - high: allows for more disk space usage where it can improve performance, | |
|
3039 | - medium: aims at a moderate disk usage, | |
|
3040 | - low: reduces disk usage when possible, decreasing performance in some | |
|
3041 | occasion. | |
|
3042 | ||
|
3043 | ``resources.memory`` | |
|
3044 | How aggressive Mercurial can be in terms of memory usage: | |
|
3045 | ||
|
3046 | Currently recognised values are: | |
|
3047 | - default: the default value, inherits the value from `usage.resources`, | |
|
3048 | - high: allows for more aggressive memory usage to improve overall | |
|
3049 | performance, | |
|
3050 | - medium: aims at a moderate memory usage, | |
|
3051 | - low: reduces memory usage when possible at the cost of overall | |
|
3052 | performance. | |
|
3053 | ||
|
3008 | 3054 | |
|
3009 | 3055 | ``command-templates`` |
|
3010 | 3056 | --------------------- |
@@ -2325,3 +2325,34 b' def ismember(ui, username, userlist):' | |||
|
2325 | 2325 | schemes. |
|
2326 | 2326 | """ |
|
2327 | 2327 | return userlist == [b'*'] or username in userlist |
|
2328 | ||
|
2329 | ||
|
2330 | RESOURCE_HIGH = 3 | |
|
2331 | RESOURCE_MEDIUM = 2 | |
|
2332 | RESOURCE_LOW = 1 | |
|
2333 | RESOURCE_DEFAULT = 0 | |
|
2334 | ||
|
2335 | RESOURCE_MAPPING = { | |
|
2336 | b'default': RESOURCE_DEFAULT, | |
|
2337 | b'low': RESOURCE_LOW, | |
|
2338 | b'medium': RESOURCE_MEDIUM, | |
|
2339 | b'high': RESOURCE_HIGH, | |
|
2340 | } | |
|
2341 | ||
|
2342 | DEFAULT_RESOURCE = RESOURCE_MEDIUM | |
|
2343 | ||
|
2344 | ||
|
2345 | def get_resource_profile(ui, dimension=None): | |
|
2346 | """return the resource profile for a dimension | |
|
2347 | ||
|
2348 | If no dimension is specified, the generic value is returned""" | |
|
2349 | generic_name = ui.config(b'usage', b'resources') | |
|
2350 | value = RESOURCE_MAPPING.get(generic_name, RESOURCE_DEFAULT) | |
|
2351 | if value == RESOURCE_DEFAULT: | |
|
2352 | value = DEFAULT_RESOURCE | |
|
2353 | if dimension is not None: | |
|
2354 | sub_name = ui.config(b'usage', b'resources.%s' % dimension) | |
|
2355 | sub_value = RESOURCE_MAPPING.get(sub_name, RESOURCE_DEFAULT) | |
|
2356 | if sub_value != RESOURCE_DEFAULT: | |
|
2357 | value = sub_value | |
|
2358 | return value |
General Comments 0
You need to be logged in to leave comments.
Login now