2018-08-09 03:15:20 +03:00
|
|
|
$ cat >> a.rc << EOF
|
|
|
|
> [a]
|
|
|
|
> x=1
|
|
|
|
> y=2
|
|
|
|
> %include b.rc
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ cat >> b.rc << EOF
|
|
|
|
> %include b.rc
|
|
|
|
> [b]
|
|
|
|
> z = 3
|
|
|
|
> [a]
|
|
|
|
> %unset y
|
2018-08-09 03:15:29 +03:00
|
|
|
> %include broken.rc
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ cat >> broken.rc << EOF
|
2018-08-09 03:15:20 +03:00
|
|
|
> %not-implemented
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
>>> from mercurial.rust import config
|
|
|
|
>>> cfg = config.config()
|
|
|
|
>>> cfg.readpath("a.rc", "readpath", None, None, None)
|
test-configparser: fix failure on Windows
Summary:
The test fails like:
```
--- test-configparser.t
+++ test-configparser.t.err
@@ -21,7 +21,7 @@
>>> from mercurial.rust import config
>>> cfg = config.config()
>>> cfg.readpath("a.rc", "readpath", None, None, None)
- ['"$TESTTMP/broken.rc":\n --> 1:2\n |\n1 | %not-implemented\n | ^---\n |\n = expected include or unset']
+ ['"\\\\\\\\\\\\\\\\?\\\\\\\\C:\\\\\\\\cygwin\\\\\\\\data\\\\\\\\sandcastle\\\\\\\\temp\\\\\\\\hgtests.ta2wor\\\\\\\\child187\\\\\\\\test-configparser.t\\\\\\\\broken.rc":\\n --> 1:2\\n |\\n1 | %not-implemented\\n | ^---\\n |\\n = expected include or unset']\r (esc)
>>> cfg.parse("[c]\nx=1", "parse")
[]
>>> cfg.set("d", "y", "2", "set1")
```
Not sure how `$TESTTMP` works. But let's repalce all of them to glob pattern as
an attempt to fix the test.
See https://fburl.com/sandcastle/pmirvy8a for full log.
Reviewed By: DurhamG
Differential Revision: D9281760
fbshipit-source-id: bb7319511bc8ffecba139bd608f47d7204853076
2018-08-11 04:11:09 +03:00
|
|
|
['"*broken.rc":\n --> 1:2\n |\n1 | %not-implemented\n | ^---\n |\n = expected include or unset'] (glob)
|
2018-08-09 03:15:20 +03:00
|
|
|
>>> cfg.parse("[c]\nx=1", "parse")
|
2018-08-10 07:07:00 +03:00
|
|
|
[]
|
2018-08-09 03:15:20 +03:00
|
|
|
>>> cfg.set("d", "y", "2", "set1")
|
|
|
|
>>> cfg.set("d", "x", None, "set2")
|
|
|
|
>>> for section in cfg.sections():
|
|
|
|
... print("section [%s] has names %r" % (section, cfg.names(section)))
|
|
|
|
section [a] has names ['x', 'y']
|
|
|
|
section [b] has names ['z']
|
|
|
|
section [c] has names ['x']
|
|
|
|
section [d] has names ['y', 'x']
|
|
|
|
>>> for item in ["a.x", "a.y", "b.z", "c.x", "d.x", "d.y", "e.x"]:
|
|
|
|
... section, name = item.split(".")
|
|
|
|
... print("%s = %r" % (item, cfg.get(section, name)))
|
|
|
|
... print(" sources: %r" % (cfg.sources(section, name)))
|
|
|
|
a.x = '1'
|
test-configparser: fix failure on Windows
Summary:
The test fails like:
```
--- test-configparser.t
+++ test-configparser.t.err
@@ -21,7 +21,7 @@
>>> from mercurial.rust import config
>>> cfg = config.config()
>>> cfg.readpath("a.rc", "readpath", None, None, None)
- ['"$TESTTMP/broken.rc":\n --> 1:2\n |\n1 | %not-implemented\n | ^---\n |\n = expected include or unset']
+ ['"\\\\\\\\\\\\\\\\?\\\\\\\\C:\\\\\\\\cygwin\\\\\\\\data\\\\\\\\sandcastle\\\\\\\\temp\\\\\\\\hgtests.ta2wor\\\\\\\\child187\\\\\\\\test-configparser.t\\\\\\\\broken.rc":\\n --> 1:2\\n |\\n1 | %not-implemented\\n | ^---\\n |\\n = expected include or unset']\r (esc)
>>> cfg.parse("[c]\nx=1", "parse")
[]
>>> cfg.set("d", "y", "2", "set1")
```
Not sure how `$TESTTMP` works. But let's repalce all of them to glob pattern as
an attempt to fix the test.
See https://fburl.com/sandcastle/pmirvy8a for full log.
Reviewed By: DurhamG
Differential Revision: D9281760
fbshipit-source-id: bb7319511bc8ffecba139bd608f47d7204853076
2018-08-11 04:11:09 +03:00
|
|
|
sources: [('1', ('*a.rc', 6, 7, 2), 'readpath')] (glob)
|
2018-08-09 03:15:20 +03:00
|
|
|
a.y = None
|
test-configparser: fix failure on Windows
Summary:
The test fails like:
```
--- test-configparser.t
+++ test-configparser.t.err
@@ -21,7 +21,7 @@
>>> from mercurial.rust import config
>>> cfg = config.config()
>>> cfg.readpath("a.rc", "readpath", None, None, None)
- ['"$TESTTMP/broken.rc":\n --> 1:2\n |\n1 | %not-implemented\n | ^---\n |\n = expected include or unset']
+ ['"\\\\\\\\\\\\\\\\?\\\\\\\\C:\\\\\\\\cygwin\\\\\\\\data\\\\\\\\sandcastle\\\\\\\\temp\\\\\\\\hgtests.ta2wor\\\\\\\\child187\\\\\\\\test-configparser.t\\\\\\\\broken.rc":\\n --> 1:2\\n |\\n1 | %not-implemented\\n | ^---\\n |\\n = expected include or unset']\r (esc)
>>> cfg.parse("[c]\nx=1", "parse")
[]
>>> cfg.set("d", "y", "2", "set1")
```
Not sure how `$TESTTMP` works. But let's repalce all of them to glob pattern as
an attempt to fix the test.
See https://fburl.com/sandcastle/pmirvy8a for full log.
Reviewed By: DurhamG
Differential Revision: D9281760
fbshipit-source-id: bb7319511bc8ffecba139bd608f47d7204853076
2018-08-11 04:11:09 +03:00
|
|
|
sources: [('2', ('*a.rc', 10, 11, 3), 'readpath'), (None, ('*b.rc', 29, 36, 5), 'readpath')] (glob)
|
2018-08-09 03:15:20 +03:00
|
|
|
b.z = '3'
|
test-configparser: fix failure on Windows
Summary:
The test fails like:
```
--- test-configparser.t
+++ test-configparser.t.err
@@ -21,7 +21,7 @@
>>> from mercurial.rust import config
>>> cfg = config.config()
>>> cfg.readpath("a.rc", "readpath", None, None, None)
- ['"$TESTTMP/broken.rc":\n --> 1:2\n |\n1 | %not-implemented\n | ^---\n |\n = expected include or unset']
+ ['"\\\\\\\\\\\\\\\\?\\\\\\\\C:\\\\\\\\cygwin\\\\\\\\data\\\\\\\\sandcastle\\\\\\\\temp\\\\\\\\hgtests.ta2wor\\\\\\\\child187\\\\\\\\test-configparser.t\\\\\\\\broken.rc":\\n --> 1:2\\n |\\n1 | %not-implemented\\n | ^---\\n |\\n = expected include or unset']\r (esc)
>>> cfg.parse("[c]\nx=1", "parse")
[]
>>> cfg.set("d", "y", "2", "set1")
```
Not sure how `$TESTTMP` works. But let's repalce all of them to glob pattern as
an attempt to fix the test.
See https://fburl.com/sandcastle/pmirvy8a for full log.
Reviewed By: DurhamG
Differential Revision: D9281760
fbshipit-source-id: bb7319511bc8ffecba139bd608f47d7204853076
2018-08-11 04:11:09 +03:00
|
|
|
sources: [('3', ('*b.rc', 22, 23, 3), 'readpath')] (glob)
|
2018-08-09 03:15:20 +03:00
|
|
|
c.x = '1'
|
2018-08-10 07:07:06 +03:00
|
|
|
sources: [('1', ('', 6, 7, 2), 'parse')]
|
2018-08-09 03:15:20 +03:00
|
|
|
d.x = None
|
|
|
|
sources: [(None, None, 'set2')]
|
|
|
|
d.y = '2'
|
|
|
|
sources: [('2', None, 'set1')]
|
|
|
|
e.x = None
|
|
|
|
sources: []
|
|
|
|
|
|
|
|
Section whitelist
|
|
|
|
|
|
|
|
>>> from mercurial.rust import config
|
|
|
|
>>> cfg = config.config()
|
|
|
|
>>> cfg.readpath("a.rc", "readpath", ["a"], None, None)
|
test-configparser: fix failure on Windows
Summary:
The test fails like:
```
--- test-configparser.t
+++ test-configparser.t.err
@@ -21,7 +21,7 @@
>>> from mercurial.rust import config
>>> cfg = config.config()
>>> cfg.readpath("a.rc", "readpath", None, None, None)
- ['"$TESTTMP/broken.rc":\n --> 1:2\n |\n1 | %not-implemented\n | ^---\n |\n = expected include or unset']
+ ['"\\\\\\\\\\\\\\\\?\\\\\\\\C:\\\\\\\\cygwin\\\\\\\\data\\\\\\\\sandcastle\\\\\\\\temp\\\\\\\\hgtests.ta2wor\\\\\\\\child187\\\\\\\\test-configparser.t\\\\\\\\broken.rc":\\n --> 1:2\\n |\\n1 | %not-implemented\\n | ^---\\n |\\n = expected include or unset']\r (esc)
>>> cfg.parse("[c]\nx=1", "parse")
[]
>>> cfg.set("d", "y", "2", "set1")
```
Not sure how `$TESTTMP` works. But let's repalce all of them to glob pattern as
an attempt to fix the test.
See https://fburl.com/sandcastle/pmirvy8a for full log.
Reviewed By: DurhamG
Differential Revision: D9281760
fbshipit-source-id: bb7319511bc8ffecba139bd608f47d7204853076
2018-08-11 04:11:09 +03:00
|
|
|
['"*broken.rc":\n --> 1:2\n |\n1 | %not-implemented\n | ^---\n |\n = expected include or unset'] (glob)
|
2018-08-09 03:15:20 +03:00
|
|
|
>>> print(cfg.sections())
|
|
|
|
['a']
|
|
|
|
|
|
|
|
Section remap
|
|
|
|
|
|
|
|
>>> from mercurial.rust import config
|
|
|
|
>>> cfg = config.config()
|
|
|
|
>>> cfg.readpath("a.rc", "readpath", None, {'a': 'x'}.items(), None)
|
test-configparser: fix failure on Windows
Summary:
The test fails like:
```
--- test-configparser.t
+++ test-configparser.t.err
@@ -21,7 +21,7 @@
>>> from mercurial.rust import config
>>> cfg = config.config()
>>> cfg.readpath("a.rc", "readpath", None, None, None)
- ['"$TESTTMP/broken.rc":\n --> 1:2\n |\n1 | %not-implemented\n | ^---\n |\n = expected include or unset']
+ ['"\\\\\\\\\\\\\\\\?\\\\\\\\C:\\\\\\\\cygwin\\\\\\\\data\\\\\\\\sandcastle\\\\\\\\temp\\\\\\\\hgtests.ta2wor\\\\\\\\child187\\\\\\\\test-configparser.t\\\\\\\\broken.rc":\\n --> 1:2\\n |\\n1 | %not-implemented\\n | ^---\\n |\\n = expected include or unset']\r (esc)
>>> cfg.parse("[c]\nx=1", "parse")
[]
>>> cfg.set("d", "y", "2", "set1")
```
Not sure how `$TESTTMP` works. But let's repalce all of them to glob pattern as
an attempt to fix the test.
See https://fburl.com/sandcastle/pmirvy8a for full log.
Reviewed By: DurhamG
Differential Revision: D9281760
fbshipit-source-id: bb7319511bc8ffecba139bd608f47d7204853076
2018-08-11 04:11:09 +03:00
|
|
|
['"*broken.rc":\n --> 1:2\n |\n1 | %not-implemented\n | ^---\n |\n = expected include or unset'] (glob)
|
2018-08-09 03:15:20 +03:00
|
|
|
>>> print(cfg.sections())
|
|
|
|
['x', 'b']
|
|
|
|
|
|
|
|
Config whitelist
|
|
|
|
|
|
|
|
>>> from mercurial.rust import config
|
|
|
|
>>> cfg = config.config()
|
|
|
|
>>> cfg.readpath("a.rc", "readpath", None, None, [('a', 'y')])
|
test-configparser: fix failure on Windows
Summary:
The test fails like:
```
--- test-configparser.t
+++ test-configparser.t.err
@@ -21,7 +21,7 @@
>>> from mercurial.rust import config
>>> cfg = config.config()
>>> cfg.readpath("a.rc", "readpath", None, None, None)
- ['"$TESTTMP/broken.rc":\n --> 1:2\n |\n1 | %not-implemented\n | ^---\n |\n = expected include or unset']
+ ['"\\\\\\\\\\\\\\\\?\\\\\\\\C:\\\\\\\\cygwin\\\\\\\\data\\\\\\\\sandcastle\\\\\\\\temp\\\\\\\\hgtests.ta2wor\\\\\\\\child187\\\\\\\\test-configparser.t\\\\\\\\broken.rc":\\n --> 1:2\\n |\\n1 | %not-implemented\\n | ^---\\n |\\n = expected include or unset']\r (esc)
>>> cfg.parse("[c]\nx=1", "parse")
[]
>>> cfg.set("d", "y", "2", "set1")
```
Not sure how `$TESTTMP` works. But let's repalce all of them to glob pattern as
an attempt to fix the test.
See https://fburl.com/sandcastle/pmirvy8a for full log.
Reviewed By: DurhamG
Differential Revision: D9281760
fbshipit-source-id: bb7319511bc8ffecba139bd608f47d7204853076
2018-08-11 04:11:09 +03:00
|
|
|
['"*broken.rc":\n --> 1:2\n |\n1 | %not-implemented\n | ^---\n |\n = expected include or unset'] (glob)
|
2018-08-09 03:15:20 +03:00
|
|
|
>>> print(cfg.get('a', 'y'))
|
|
|
|
None
|
|
|
|
>>> print(cfg.get('a', 'x'))
|
|
|
|
1
|
|
|
|
|
2018-08-09 03:15:25 +03:00
|
|
|
Clone
|
|
|
|
|
|
|
|
>>> from mercurial.rust import config
|
|
|
|
>>> cfg1 = config.config()
|
|
|
|
>>> cfg1.set("a", "x", "1", "set1")
|
|
|
|
>>> cfg2 = cfg1.clone()
|
|
|
|
>>> cfg2.set("b", "y", "2", "set2")
|
|
|
|
>>> print(cfg2.sections())
|
|
|
|
['a', 'b']
|
|
|
|
>>> print(cfg1.sections())
|
|
|
|
['a']
|