mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 01:07:15 +03:00
f86c1f069f
Summary: There is an existing template "diffstat" which gives a minimal and not very useful output containing the overall number of files that changed, total number of lines inserted for all associated files, and total number of lines deleted for all associated files. On the other hand, the output from the command line option "stat" is much more descriptive. Therefore, users end up using commands of the form hg log -r . -T '{author}{date}' --stat When they would have preferred something like hg log -r . -T '{author}{date}{stat}' This change adds the template "stat" which will allow for the desired behavior. Test Plan: # Added a new test test-template-stat.t # Ran arc unit Reviewers: #sourcecontrol, quark Reviewed By: quark Subscribers: akushner, medson, mjpieters, quark, rmerizalde Differential Revision: https://phabricator.intern.facebook.com/D5521665 Tasks: 12422741 Signature: t1:5521665:1501287682:2afaea56b3dc863c52e6300c6bc482ae132a6a61
74 lines
2.1 KiB
Perl
74 lines
2.1 KiB
Perl
$ cat >> $HGRCPATH << EOF
|
|
> [extensions]
|
|
> stat=$TESTDIR/../hgext3rd/stat.py
|
|
> EOF
|
|
|
|
Setup repo
|
|
|
|
$ hg init repo
|
|
$ cd repo
|
|
|
|
Test template stat
|
|
|
|
$ hg log -r . -T '{stat}'
|
|
|
|
$ $PYTHON $TESTDIR/seq.py 50 > a
|
|
$ hg add a
|
|
$ $PYTHON $TESTDIR/seq.py 26 75 > b
|
|
$ hg add b
|
|
$ hg commit -m "Added a and b with 50 lines each"
|
|
$ hg log -r . -T '{stat}'
|
|
a | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
b | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
2 files changed, 100 insertions(+), 0 deletions(-)
|
|
|
|
$ COLUMNS=20 hg log -r . -T '{stat}'
|
|
a | 50 +++++++++++
|
|
b | 50 +++++++++++
|
|
2 files changed, 100 insertions(+), 0 deletions(-)
|
|
|
|
$ $PYTHON $TESTDIR/seq.py 50 > b
|
|
$ $PYTHON $TESTDIR/seq.py 26 75 > a
|
|
$ hg commit -m "Swapped the files"
|
|
$ hg log -r . -T '{stat}'
|
|
a | 50 +++++++++++++++++++++++++-------------------------
|
|
b | 50 +++++++++++++++++++++++++-------------------------
|
|
2 files changed, 50 insertions(+), 50 deletions(-)
|
|
|
|
$ COLUMNS=20 hg log -r . -T '{stat}'
|
|
a | 50 +++++-----
|
|
b | 50 +++++-----
|
|
2 files changed, 50 insertions(+), 50 deletions(-)
|
|
|
|
$ mkdir dir
|
|
$ $PYTHON $TESTDIR/seq.py 50 > dir/a
|
|
$ hg add dir/a
|
|
$ hg commit -m "Added file with 50 lines inside directory dir"
|
|
$ hg log -r . -T '{stat}'
|
|
dir/a | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
1 files changed, 50 insertions(+), 0 deletions(-)
|
|
|
|
$ COLUMNS=20 hg log -r . -T '{stat}'
|
|
dir/a | 50 ++++++++++
|
|
1 files changed, 50 insertions(+), 0 deletions(-)
|
|
|
|
$ $PYTHON $TESTDIR/seq.py 41 60 > dir/a
|
|
$ hg commit -m "Modified file inside directory dir"
|
|
$ hg log -r . -T '{stat}'
|
|
dir/a | 50 ++++++++++----------------------------------------
|
|
1 files changed, 10 insertions(+), 40 deletions(-)
|
|
|
|
$ COLUMNS=20 hg log -r . -T '{stat}'
|
|
dir/a | 50 ++--------
|
|
1 files changed, 10 insertions(+), 40 deletions(-)
|
|
|
|
$ $PYTHON << EOF
|
|
> with open('binary', 'wb') as f:
|
|
> f.write(b'\x00\x01\x02\x00' * 10)
|
|
> EOF
|
|
$ hg add binary
|
|
$ hg commit -m "Added binary file"
|
|
$ hg log -r . -T '{stat}'
|
|
binary | Bin
|
|
1 files changed, 0 insertions(+), 0 deletions(-)
|