mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 17:27:53 +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
21 lines
534 B
Python
21 lines
534 B
Python
# stat.py
|
|
#
|
|
# Copyright 2017 Facebook, Inc.
|
|
#
|
|
# This software may be used and distributed according to the terms of the
|
|
# GNU General Public License version 2 or any later version.
|
|
|
|
from mercurial import (
|
|
patch,
|
|
registrar,
|
|
util,
|
|
)
|
|
|
|
templatekeyword = registrar.templatekeyword()
|
|
|
|
@templatekeyword('stat')
|
|
def showdiffstat(repo, ctx, templ, **args):
|
|
"""String. Return diffstat-style summary of changes."""
|
|
width = repo.ui.termwidth()
|
|
return patch.diffstat(util.iterlines(ctx.diff(noprefix=False)), width=width)
|