##// END OF EJS Templates
diffstat: fix parsing of filenames with spaces...
diffstat: fix parsing of filenames with spaces The patch changes the output of "hg diff --stat" when one file whose filename has spaces has changed, making it get the full filename instead of just the substring between the last space and the end of the filename. It also changes the diffstat generated by "hg email -d" when one of the commit messages starts with "diff". Because of the regex used to parse the filename, the diffstat generated by "hg email -d" will still be not correct if a commit message starts with "diff -r ". Before the patch Mercurial has the following behavior: $ echo "foobar">"file with spaces" $ hg add "file with spaces" $ hg diff --stat spaces | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) $ hg diff --git --stat file with spaces | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) After the patch: $ echo "foobar">"file with spaces" $ hg add "file with spaces" $ hg diff --stat file with spaces | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) $ hg diff --git --stat file with spaces | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) Before the patch: $ hg add mercurial/patch.py tests/tests-diffstat.t $ hg commit -m "diffstat: fix parsing of filenames" $ hg email -d --test tip This patch series consists of 1 patches. diffstat: fix parsing of filenames [...] filenames | 0 mercurial/patch.py | 6 ++++-- tests/test-diffstat.t | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) [...] After the patch: $ hg email -d --test tip This patch series consists of 1 patches. diffstat: fix parsing of filenames [...] mercurial/patch.py | 6 ++++-- tests/test-diffstat.t | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) [...]

File last commit:

r13395:104c9ed9 default
r13395:104c9ed9 default
Show More
test-diffstat.t
65 lines | 1.2 KiB | text/troff | Tads3Lexer
$ hg init repo
$ cd repo
$ i=0; while [ "$i" -lt 213 ]; do echo a >> a; i=`expr $i + 1`; done
$ hg add a
Wide diffstat:
$ hg diff --stat
a | 213 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 213 insertions(+), 0 deletions(-)
diffstat width:
$ COLUMNS=24 hg diff --config ui.interactive=true --stat
a | 213 ++++++++++++++
1 files changed, 213 insertions(+), 0 deletions(-)
$ hg ci -m adda
$ cat >> a <<EOF
> a
> a
> a
> EOF
Narrow diffstat:
$ hg diff --stat
a | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
$ hg ci -m appenda
$ printf '\0' > b
$ hg add b
Binary diffstat:
$ hg diff --stat
b | 0
1 files changed, 0 insertions(+), 0 deletions(-)
Binary git diffstat:
$ hg diff --stat --git
b | Bin
1 files changed, 0 insertions(+), 0 deletions(-)
$ hg ci -m createb
$ printf '\0' > "file with spaces"
$ hg add "file with spaces"
Filename with spaces diffstat:
$ hg diff --stat
file with spaces | 0
1 files changed, 0 insertions(+), 0 deletions(-)
Filename with spaces git diffstat:
$ hg diff --stat --git
file with spaces | Bin
1 files changed, 0 insertions(+), 0 deletions(-)