comparison tests/test-commit-interactive.t @ 41454:d1d3094b54f9

patch: handle 0 context lines (diff.unified=0) when parsing patches Previously, if there were no context lines, we would just keep updating the ranges and the hunk, but not actually storing the hunk (just overwriting it each time). Thus a diff like this: $ hg diff --config diff.unified=0 diff --git a/bar b/bar --- a/bar +++ b/bar @@ -1,0 +2,1 @@ 1 +change1 @@ -3,0 +5,1 @@ 3 +change2 would come out of the parser like this (change1 is lost): bar: @@ -3,0 +5,1 @@ 3 +change2 This had some really weird side effects for things like commit --interactive, split, etc. Differential Revision: https://phab.mercurial-scm.org/D5743
author Kyle Lippincott <spectral@google.com>
date Mon, 28 Jan 2019 18:00:14 -0800
parents 89ba51c3e4f1
children 3a01ce246ece
comparison
equal deleted inserted replaced
41453:1a4a41d39dfc 41454:d1d3094b54f9
1805 1805
1806 $ hg debugstate | grep ' subdir/f1$' 1806 $ hg debugstate | grep ' subdir/f1$'
1807 n 0 -1 unset subdir/f1 1807 n 0 -1 unset subdir/f1
1808 $ hg status -A subdir/f1 1808 $ hg status -A subdir/f1
1809 M subdir/f1 1809 M subdir/f1
1810
1811 Test diff.unified=0
1812
1813 $ hg init $TESTTMP/b
1814 $ cd $TESTTMP/b
1815 $ cat > foo <<EOF
1816 > 1
1817 > 2
1818 > 3
1819 > 4
1820 > 5
1821 > EOF
1822 $ hg ci -qAm initial
1823 $ cat > foo <<EOF
1824 > 1
1825 > change1
1826 > 2
1827 > 3
1828 > change2
1829 > 4
1830 > 5
1831 > EOF
1832 $ printf 'y\ny\ny\n' | hg ci -im initial --config diff.unified=0
1833 diff --git a/foo b/foo
1834 2 hunks, 2 lines changed
1835 examine changes to 'foo'? [Ynesfdaq?] y
1836
1837 @@ -1,0 +2,1 @@ 1
1838 +change1
1839 record change 1/2 to 'foo'? [Ynesfdaq?] y
1840
1841 @@ -3,0 +5,1 @@ 3
1842 +change2
1843 record change 2/2 to 'foo'? [Ynesfdaq?] y
1844