Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
mercurial-devel
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mercurial
mercurial-devel
Commits
9311cd5c
Commit
9311cd5c
authored
11 years ago
by
Bryan O'Sullivan
Browse files
Options
Downloads
Patches
Plain Diff
ui: use util.sizetoint in configbytes
parent
1d08df65
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mercurial/ui.py
+7
-13
7 additions, 13 deletions
mercurial/ui.py
with
7 additions
and
13 deletions
mercurial/ui.py
+
7
−
13
View file @
9311cd5c
...
...
@@ -6,7 +6,7 @@
# GNU General Public License version 2 or any later version.
from
i18n
import
_
import
errno
,
getpass
,
os
,
re
,
socket
,
sys
,
tempfile
,
traceback
import
errno
,
getpass
,
os
,
socket
,
sys
,
tempfile
,
traceback
import
config
,
scmutil
,
util
,
error
,
formatter
class
ui
(
object
):
...
...
@@ -284,7 +284,7 @@
ConfigError
:
foo
.
invalid
is
not
a
byte
quantity
(
'
somevalue
'
)
"""
orig
=
string
=
self
.
config
(
section
,
name
)
if
orig
is
None
:
value
=
self
.
config
(
section
,
name
)
if
value
is
None
:
if
not
isinstance
(
default
,
str
):
return
default
...
...
@@ -289,10 +289,4 @@
if
not
isinstance
(
default
,
str
):
return
default
orig
=
string
=
default
multiple
=
1
m
=
re
.
match
(
r
'
([^kmbg]+?)\s*([kmg]?)b?$
'
,
string
,
re
.
I
)
if
m
:
string
,
key
=
m
.
groups
()
key
=
key
.
lower
()
multiple
=
dict
(
k
=
1024
,
m
=
1048576
,
g
=
1073741824
).
get
(
key
,
1
)
value
=
default
try
:
...
...
@@ -298,4 +292,4 @@
try
:
return
int
(
float
(
string
)
*
multipl
e
)
except
Valu
eError
:
return
util
.
sizetoint
(
valu
e
)
except
error
.
Pars
eError
:
raise
error
.
ConfigError
(
_
(
"
%s.%s is not a byte quantity (
'
%s
'
)
"
)
...
...
@@ -301,5 +295,5 @@
raise
error
.
ConfigError
(
_
(
"
%s.%s is not a byte quantity (
'
%s
'
)
"
)
%
(
section
,
name
,
orig
))
%
(
section
,
name
,
value
))
def
configlist
(
self
,
section
,
name
,
default
=
None
,
untrusted
=
False
):
"""
parse a configuration element as a list of comma/space separated
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment