Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG0a10f142299d: py3: suppress the output from .write() calls in few tests
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | tests/test-fileset.t (12 lines) | |||
M | tests/test-import-git.t (2 lines) | |||
M | tests/test-parse-date.t (4 lines) | |||
M | tests/test-revlog.t (6 lines) | |||
M | tests/test-symlink-placeholder.t (6 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Pulkit Goyal | May 19 2018, 9:13 AM |
Status | Author | Revision | |
---|---|---|---|
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit | ||
Closed | pulkit |
a1 | a1 | ||||
a2 | a2 | ||||
b1 | b1 | ||||
b2 | b2 | ||||
c1 | c1 | ||||
Test files properties | Test files properties | ||||
>>> open('bin', 'wb').write(b'\0a') | >>> open('bin', 'wb').write(b'\0a') and None | ||||
$ fileset 'binary()' | $ fileset 'binary()' | ||||
$ fileset 'binary() and unknown()' | $ fileset 'binary() and unknown()' | ||||
bin | bin | ||||
$ echo '^bin$' >> .hgignore | $ echo '^bin$' >> .hgignore | ||||
$ fileset 'binary() and ignored()' | $ fileset 'binary() and ignored()' | ||||
bin | bin | ||||
$ hg add bin | $ hg add bin | ||||
$ fileset 'binary()' | $ fileset 'binary()' | ||||
#if no-windows | #if no-windows | ||||
$ echo foo > con.xml | $ echo foo > con.xml | ||||
$ fileset 'not portable()' | $ fileset 'not portable()' | ||||
con.xml | con.xml | ||||
$ hg --config ui.portablefilenames=ignore add con.xml | $ hg --config ui.portablefilenames=ignore add con.xml | ||||
#endif | #endif | ||||
>>> open('1k', 'wb').write(b' '*1024) | >>> open('1k', 'wb').write(b' '*1024) and None | ||||
>>> open('2k', 'wb').write(b' '*2048) | >>> open('2k', 'wb').write(b' '*2048) and None | ||||
$ hg add 1k 2k | $ hg add 1k 2k | ||||
$ fileset 'size("bar")' | $ fileset 'size("bar")' | ||||
hg: parse error: couldn't parse size: bar | hg: parse error: couldn't parse size: bar | ||||
[255] | [255] | ||||
$ fileset '(1k, 2k)' | $ fileset '(1k, 2k)' | ||||
hg: parse error: can't use a list in this context | hg: parse error: can't use a list in this context | ||||
(see hg help "filesets.x or y") | (see hg help "filesets.x or y") | ||||
[255] | [255] | ||||
sub | sub | ||||
sub2 | sub2 | ||||
$ fileset -r4 'subrepo("sub")' | $ fileset -r4 'subrepo("sub")' | ||||
sub | sub | ||||
$ fileset -r4 'b2 or c1' | $ fileset -r4 'b2 or c1' | ||||
b2 | b2 | ||||
c1 | c1 | ||||
>>> open('dos', 'wb').write("dos\r\n") | >>> open('dos', 'wb').write(b"dos\r\n") and None | ||||
>>> open('mixed', 'wb').write("dos\r\nunix\n") | >>> open('mixed', 'wb').write(b"dos\r\nunix\n") and None | ||||
>>> open('mac', 'wb').write("mac\r") | >>> open('mac', 'wb').write(b"mac\r") and None | ||||
$ hg add dos mixed mac | $ hg add dos mixed mac | ||||
(remove a1, to examine safety of 'eol' on removed files) | (remove a1, to examine safety of 'eol' on removed files) | ||||
$ rm a1 | $ rm a1 | ||||
$ fileset 'eol(dos)' | $ fileset 'eol(dos)' | ||||
dos | dos | ||||
mixed | mixed |
> GIT binary patch | > GIT binary patch | ||||
> literal 5 | > literal 5 | ||||
> Mc$`b*O5$Pw00T?_*Z=?k | > Mc$`b*O5$Pw00T?_*Z=?k | ||||
> | > | ||||
> EOF | > EOF | ||||
>>> fp = open('binary.diff', 'rb') | >>> fp = open('binary.diff', 'rb') | ||||
>>> data = fp.read() | >>> data = fp.read() | ||||
>>> fp.close() | >>> fp.close() | ||||
>>> open('binary.diff', 'wb').write(data.replace(b'\n', b'\r\n')) | >>> open('binary.diff', 'wb').write(data.replace(b'\n', b'\r\n')) and None | ||||
$ rm binary2 | $ rm binary2 | ||||
$ hg import --no-commit binary.diff | $ hg import --no-commit binary.diff | ||||
applying binary.diff | applying binary.diff | ||||
$ cd .. | $ cd .. | ||||
Consecutive import with renames (issue2459) | Consecutive import with renames (issue2459) | ||||
Wed Feb 01 13:00:30 2006 +0000 | Wed Feb 01 13:00:30 2006 +0000 | ||||
Test issue 3764 (interpreting 'today' and 'yesterday') | Test issue 3764 (interpreting 'today' and 'yesterday') | ||||
$ echo "hello" >> a | $ echo "hello" >> a | ||||
>>> import datetime | >>> import datetime | ||||
>>> today = datetime.date.today().strftime("%b %d") | >>> today = datetime.date.today().strftime("%b %d") | ||||
>>> yesterday = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%b %d") | >>> yesterday = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%b %d") | ||||
>>> dates = open('dates', 'w') | >>> dates = open('dates', 'w') | ||||
>>> dates.write(today + '\n') | >>> dates.write(today + '\n') and None | ||||
>>> dates.write(yesterday + '\n') | >>> dates.write(yesterday + '\n') and None | ||||
>>> dates.close() | >>> dates.close() | ||||
$ hg ci -d "`sed -n '1p' dates`" -m "today is a good day to code" | $ hg ci -d "`sed -n '1p' dates`" -m "today is a good day to code" | ||||
$ hg log -d today --template '{desc}\n' | $ hg log -d today --template '{desc}\n' | ||||
today is a good day to code | today is a good day to code | ||||
$ echo "goodbye" >> a | $ echo "goodbye" >> a | ||||
$ hg ci -d "`sed -n '2p' dates`" -m "the time traveler's code" | $ hg ci -d "`sed -n '2p' dates`" -m "the time traveler's code" | ||||
$ hg log -d yesterday --template '{desc}\n' | $ hg log -d yesterday --template '{desc}\n' | ||||
the time traveler's code | the time traveler's code |
$ hg init empty-repo | $ hg init empty-repo | ||||
$ cd empty-repo | $ cd empty-repo | ||||
Flags on revlog version 0 are rejected | Flags on revlog version 0 are rejected | ||||
>>> with open('.hg/store/00changelog.i', 'wb') as fh: | >>> with open('.hg/store/00changelog.i', 'wb') as fh: | ||||
... fh.write(b'\x00\x01\x00\x00') | ... fh.write(b'\x00\x01\x00\x00') and None | ||||
$ hg log | $ hg log | ||||
abort: unknown flags (0x01) in version 0 revlog 00changelog.i! | abort: unknown flags (0x01) in version 0 revlog 00changelog.i! | ||||
[255] | [255] | ||||
Unknown flags on revlog version 1 are rejected | Unknown flags on revlog version 1 are rejected | ||||
>>> with open('.hg/store/00changelog.i', 'wb') as fh: | >>> with open('.hg/store/00changelog.i', 'wb') as fh: | ||||
... fh.write(b'\x00\x04\x00\x01') | ... fh.write(b'\x00\x04\x00\x01') and None | ||||
$ hg log | $ hg log | ||||
abort: unknown flags (0x04) in version 1 revlog 00changelog.i! | abort: unknown flags (0x04) in version 1 revlog 00changelog.i! | ||||
[255] | [255] | ||||
Unknown version is rejected | Unknown version is rejected | ||||
>>> with open('.hg/store/00changelog.i', 'wb') as fh: | >>> with open('.hg/store/00changelog.i', 'wb') as fh: | ||||
... fh.write(b'\x00\x00\x00\x02') | ... fh.write(b'\x00\x00\x00\x02') and None | ||||
$ hg log | $ hg log | ||||
abort: unknown version (2) in revlog 00changelog.i! | abort: unknown version (2) in revlog 00changelog.i! | ||||
[255] | [255] | ||||
$ cd .. | $ cd .. | ||||
Test for CVE-2016-3630 | Test for CVE-2016-3630 |
$ rm b | $ rm b | ||||
$ touch b | $ touch b | ||||
$ hg --config extensions.n=$TESTTMP/nolink.py st --debug | $ hg --config extensions.n=$TESTTMP/nolink.py st --debug | ||||
ignoring suspect symlink placeholder "b" | ignoring suspect symlink placeholder "b" | ||||
Write binary data to the placeholder: | Write binary data to the placeholder: | ||||
>>> open('b', 'w').write('this is a binary\0') | >>> open('b', 'w').write('this is a binary\0') and None | ||||
$ hg --config extensions.n=$TESTTMP/nolink.py st --debug | $ hg --config extensions.n=$TESTTMP/nolink.py st --debug | ||||
ignoring suspect symlink placeholder "b" | ignoring suspect symlink placeholder "b" | ||||
Write a long string to the placeholder: | Write a long string to the placeholder: | ||||
>>> open('b', 'w').write('this' * 1000) | >>> open('b', 'w').write('this' * 1000) and None | ||||
$ hg --config extensions.n=$TESTTMP/nolink.py st --debug | $ hg --config extensions.n=$TESTTMP/nolink.py st --debug | ||||
ignoring suspect symlink placeholder "b" | ignoring suspect symlink placeholder "b" | ||||
Commit shouldn't succeed: | Commit shouldn't succeed: | ||||
$ hg --config extensions.n=$TESTTMP/nolink.py ci -m1 | $ hg --config extensions.n=$TESTTMP/nolink.py ci -m1 | ||||
nothing changed | nothing changed | ||||
[1] | [1] | ||||
Write a valid string to the placeholder: | Write a valid string to the placeholder: | ||||
>>> open('b', 'w').write('this') | >>> open('b', 'w').write('this') and None | ||||
$ hg --config extensions.n=$TESTTMP/nolink.py st --debug | $ hg --config extensions.n=$TESTTMP/nolink.py st --debug | ||||
M b | M b | ||||
$ hg --config extensions.n=$TESTTMP/nolink.py ci -m1 | $ hg --config extensions.n=$TESTTMP/nolink.py ci -m1 | ||||
$ hg manifest tip --verbose | $ hg manifest tip --verbose | ||||
644 a | 644 a | ||||
644 @ b | 644 @ b | ||||
$ cd .. | $ cd .. |