##// END OF EJS Templates
exchange: move disabling of rev-branch-cache bundle part out of narrow...
exchange: move disabling of rev-branch-cache bundle part out of narrow I'm attempting to refactor changegroup code in order to better support alternate storage backends. The narrow extension is performing a lot of monkeypatching to this code and it is making it difficult to reason about how everything works. I'm reasonably certain I would be unable to abstract storage without requiring extensive rework of narrow. I believe it is less effort to move narrow code into core so it can be accounted for when changegroup code is refactored. So I'll be doing that. The first part of this is integrating the disabling of the cache:rev-branch-cache bundle2 part into core. This doesn't seem like it is related to changegroup, but narrow's modifications to changegroup are invasive and also require taking its code for bundle generation and exchange into core in order for the changegroup code to work. Differential Revision: https://phab.mercurial-scm.org/D4007

File last commit:

r37593:230eb959 default
r38813:ab765bc4 default
Show More
test-import-eol.t
173 lines | 3.6 KiB | text/troff | Tads3Lexer
/ tests / test-import-eol.t
Nicolas Dumazet
tests: unify test-qimport-eol
r11808 $ cat > makepatch.py <<EOF
Yuya Nishihara
diffhelpers: be more tolerant for stripped empty lines of CRLF ending...
r37593 > import sys
> f = open(sys.argv[2], 'wb')
Nicolas Dumazet
tests: unify test-qimport-eol
r11808 > w = f.write
Pulkit Goyal
py3: replace file() with open() in test-import-eol.t...
r36043 > w(b'test message\n')
> w(b'diff --git a/a b/a\n')
> w(b'--- a/a\n')
> w(b'+++ b/a\n')
> w(b'@@ -1,5 +1,5 @@\n')
> w(b' a\n')
> w(b'-bbb\r\n')
> w(b'+yyyy\r\n')
> w(b' cc\r\n')
Yuya Nishihara
diffhelpers: be more tolerant for stripped empty lines of CRLF ending...
r37593 > w({'empty:lf': b' \n',
> 'empty:crlf': b' \r\n',
> 'empty:stripped-lf': b'\n',
> 'empty:stripped-crlf': b'\r\n'}[sys.argv[1]])
Pulkit Goyal
py3: replace file() with open() in test-import-eol.t...
r36043 > w(b' d\n')
> w(b'-e\n')
> w(b'\ No newline at end of file\n')
> w(b'+z\r\n')
> w(b'\ No newline at end of file\r\n')
Nicolas Dumazet
tests: unify test-qimport-eol
r11808 > EOF
$ hg init repo
$ cd repo
$ echo '\.diff' > .hgignore
Test different --eol values
Pulkit Goyal
py3: replace file() with open() in test-import-eol.t...
r36043 $ $PYTHON -c 'open("a", "wb").write(b"a\nbbb\ncc\n\nd\ne")'
Nicolas Dumazet
tests: unify test-qimport-eol
r11808 $ hg ci -Am adda
adding .hgignore
adding a
Yuya Nishihara
diffhelpers: be more tolerant for stripped empty lines of CRLF ending...
r37593 $ $PYTHON ../makepatch.py empty:lf eol.diff
$ $PYTHON ../makepatch.py empty:crlf eol-empty-crlf.diff
$ $PYTHON ../makepatch.py empty:stripped-lf eol-empty-stripped-lf.diff
$ $PYTHON ../makepatch.py empty:stripped-crlf eol-empty-stripped-crlf.diff
Nicolas Dumazet
tests: unify test-qimport-eol
r11808
invalid eol
$ hg --config patch.eol='LFCR' import eol.diff
applying eol.diff
Martin Geisler
Merge with stable
r12070 abort: unsupported line endings type: LFCR
Matt Mackall
tests: add exit codes to unified tests
r12316 [255]
Nicolas Dumazet
tests: unify test-qimport-eol
r11808 $ hg revert -a
force LF
$ hg --traceback --config patch.eol='LF' import eol.diff
applying eol.diff
Yuya Nishihara
diffhelpers: be more tolerant for stripped empty lines of CRLF ending...
r37593 $ hg id
9e4ef7b3d4af tip
Mads Kiilerich
tests: use (esc) instead of other kinds of string escaping
r12943 $ cat a
a
yyyy
cc
d
e (no-eol)
Nicolas Dumazet
tests: unify test-qimport-eol
r11808 $ hg st
Yuya Nishihara
diffhelpers: be more tolerant for stripped empty lines of CRLF ending...
r37593 (test empty-line variants: all of them should generate the same revision)
$ hg up -qC 0
$ hg --config patch.eol='LF' import eol-empty-crlf.diff
applying eol-empty-crlf.diff
$ hg id
9e4ef7b3d4af tip
$ hg up -qC 0
$ hg --config patch.eol='LF' import eol-empty-stripped-lf.diff
applying eol-empty-stripped-lf.diff
$ hg id
9e4ef7b3d4af tip
$ hg up -qC 0
$ hg --config patch.eol='LF' import eol-empty-stripped-crlf.diff
applying eol-empty-stripped-crlf.diff
$ hg id
9e4ef7b3d4af tip
Nicolas Dumazet
tests: unify test-qimport-eol
r11808
force CRLF
$ hg up -C 0
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg --traceback --config patch.eol='CRLF' import eol.diff
applying eol.diff
Mads Kiilerich
tests: use (esc) instead of other kinds of string escaping
r12943 $ cat a
a\r (esc)
yyyy\r (esc)
cc\r (esc)
\r (esc)
d\r (esc)
e (no-eol)
Nicolas Dumazet
tests: unify test-qimport-eol
r11808 $ hg st
auto EOL on LF file
$ hg up -C 0
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg --traceback --config patch.eol='auto' import eol.diff
applying eol.diff
Mads Kiilerich
tests: use (esc) instead of other kinds of string escaping
r12943 $ cat a
a
yyyy
cc
d
e (no-eol)
Nicolas Dumazet
tests: unify test-qimport-eol
r11808 $ hg st
auto EOL on CRLF file
Pulkit Goyal
py3: replace file() with open() in test-import-eol.t...
r36043 $ $PYTHON -c 'open("a", "wb").write(b"a\r\nbbb\r\ncc\r\n\r\nd\r\ne")'
Nicolas Dumazet
tests: unify test-qimport-eol
r11808 $ hg commit -m 'switch EOLs in a'
$ hg --traceback --config patch.eol='auto' import eol.diff
applying eol.diff
Mads Kiilerich
tests: use (esc) instead of other kinds of string escaping
r12943 $ cat a
a\r (esc)
yyyy\r (esc)
cc\r (esc)
\r (esc)
d\r (esc)
e (no-eol)
Nicolas Dumazet
tests: unify test-qimport-eol
r11808 $ hg st
auto EOL on new file or source without any EOL
Pulkit Goyal
py3: replace file() with open() in test-import-eol.t...
r36043 $ $PYTHON -c 'open("noeol", "wb").write(b"noeol")'
Nicolas Dumazet
tests: unify test-qimport-eol
r11808 $ hg add noeol
$ hg commit -m 'add noeol'
Pulkit Goyal
py3: replace file() with open() in test-import-eol.t...
r36043 $ $PYTHON -c 'open("noeol", "wb").write(b"noeol\r\nnoeol\n")'
$ $PYTHON -c 'open("neweol", "wb").write(b"neweol\nneweol\r\n")'
Nicolas Dumazet
tests: unify test-qimport-eol
r11808 $ hg add neweol
$ hg diff --git > noeol.diff
$ hg revert --no-backup noeol neweol
$ rm neweol
$ hg --traceback --config patch.eol='auto' import -m noeol noeol.diff
applying noeol.diff
Mads Kiilerich
tests: use (esc) instead of other kinds of string escaping
r12943 $ cat noeol
noeol\r (esc)
noeol
$ cat neweol
neweol
neweol\r (esc)
Nicolas Dumazet
tests: unify test-qimport-eol
r11808 $ hg st
Test --eol and binary patches
Pulkit Goyal
py3: replace file() with open() in test-import-eol.t...
r36043 $ $PYTHON -c 'open("b", "wb").write(b"a\x00\nb\r\nd")'
Nicolas Dumazet
tests: unify test-qimport-eol
r11808 $ hg ci -Am addb
adding b
Pulkit Goyal
py3: replace file() with open() in test-import-eol.t...
r36043 $ $PYTHON -c 'open("b", "wb").write(b"a\x00\nc\r\nd")'
Nicolas Dumazet
tests: unify test-qimport-eol
r11808 $ hg diff --git > bin.diff
$ hg revert --no-backup b
binary patch with --eol
$ hg import --config patch.eol='CRLF' -m changeb bin.diff
applying bin.diff
Mads Kiilerich
tests: use (esc) instead of other kinds of string escaping
r12943 $ cat b
a\x00 (esc)
c\r (esc)
d (no-eol)
Nicolas Dumazet
tests: unify test-qimport-eol
r11808 $ hg st
$ cd ..