mdiff: adjust hunk offsets with --ignore-blank-lines (
issue3234)
When diffing the following documents with --ignore-blank-lines (-B):
$ cat > a <<EOF
>
>
>
> b
> x
> d
> EOF
and:
$ cat > b <<EOF
> b
> y
> d
> EOF
the context lines are taken from the first document, even if the lines differ
(with -w or -b) or if the number of lines differ (with -B). In the second case,
we have to adjust the hunk new lines offsets or we end with inconsistent diffs
like (see the @@ offsets):
diff -r
0e66aa54f318 a
--- a/a
+++ b/a
@@ -1,4 +1,3 @@
b
-x
+y
d
Note that having different context lines in a and b means the diff can be
applied but is not invertible.
Reported by Nicholas Riley <com-selenic@sabi.net>
syntax: glob
*.elc
*.orig
*.rej
*~
*.mergebackup
*.o
*.so
*.dll
*.pyd
*.pyc
*.pyo
*$py.class
*.swp
*.prof
\#*\#
.\#*
tests/.coverage*
tests/annotated
tests/*.err
tests/htmlcov
build
contrib/hgsh/hgsh
dist
doc/*.[0-9]
doc/*.[0-9].gendoc.txt
doc/*.[0-9].{x,ht}ml
MANIFEST
MANIFEST.in
patches
mercurial/__version__.py
mercurial.egg-info
Output/Mercurial-*.exe
.DS_Store
tags
cscope.*
i18n/hg.pot
locale/*/LC_MESSAGES/hg.mo
hgext/__index__.py
# files installed with a local --pure build
mercurial/base85.py
mercurial/bdiff.py
mercurial/diffhelpers.py
mercurial/mpatch.py
mercurial/osutil.py
mercurial/parsers.py
syntax: regexp
^\.pc/
^\.(pydev)?project
# hackable windows distribution additions
^hg-python26/
^hg.exe$
^hg.py$