mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 14:58:03 +03:00
move stat extension into core
Reviewed By: quark-zju Differential Revision: D39866927 fbshipit-source-id: c12c8f7ec191b876fd0a4fd75fa4b195672487b4
This commit is contained in:
parent
6ca40319ce
commit
d5f0063fd0
@ -321,7 +321,6 @@ def _preimportmodules():
|
||||
"sparse",
|
||||
"sshaskpass",
|
||||
"stablerev",
|
||||
"stat",
|
||||
"traceprof",
|
||||
"treemanifest",
|
||||
"tweakdefaults",
|
||||
|
@ -1,39 +0,0 @@
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
#
|
||||
# This software may be used and distributed according to the terms of the
|
||||
# GNU General Public License version 2.
|
||||
|
||||
from edenscm import error, patch, registrar, templatekw, util
|
||||
from edenscm.i18n import _
|
||||
|
||||
|
||||
templatefunc = registrar.templatefunc()
|
||||
|
||||
|
||||
@templatefunc("stat(style=none)", argspec="style")
|
||||
def showdiffstat(context, mapping, args):
|
||||
"""String. Return diffstat-style summary of changes.
|
||||
|
||||
If 'style' is not 'none', it could be 'status', in which case "added",
|
||||
"changed", "removed" will be shown before file names.
|
||||
"""
|
||||
if "style" in args:
|
||||
style = args["style"][1]
|
||||
else:
|
||||
style = "none"
|
||||
|
||||
repo = mapping["repo"]
|
||||
ctx = mapping["ctx"]
|
||||
revcache = mapping["revcache"]
|
||||
width = repo.ui.termwidth()
|
||||
|
||||
if style == "none":
|
||||
status = None
|
||||
elif style == "status":
|
||||
status = templatekw.getfiles(repo, ctx, revcache)
|
||||
else:
|
||||
raise error.ParseError(_("stat does not support style %r") % (style,))
|
||||
|
||||
return patch.diffstat(
|
||||
util.iterlines(ctx.diff(noprefix=False)), width=width, status=status
|
||||
)
|
@ -70,6 +70,7 @@ _ignoreextensions = {
|
||||
"releasenotes",
|
||||
"relink",
|
||||
"remoteid",
|
||||
"stat",
|
||||
"strip",
|
||||
"treedirstate",
|
||||
"uncommit",
|
||||
|
@ -25,6 +25,7 @@ from . import (
|
||||
hintutil,
|
||||
minirst,
|
||||
parser,
|
||||
patch,
|
||||
pycompat,
|
||||
registrar,
|
||||
revset as revsetmod,
|
||||
@ -1262,6 +1263,35 @@ def strip(context, mapping, args):
|
||||
return text.strip()
|
||||
|
||||
|
||||
@templatefunc("stat(style=none)", argspec="style")
|
||||
def showdiffstat(context, mapping, args):
|
||||
"""String. Return diffstat-style summary of changes.
|
||||
|
||||
If 'style' is not 'none', it could be 'status', in which case "added",
|
||||
"changed", "removed" will be shown before file names.
|
||||
"""
|
||||
if "style" in args:
|
||||
style = args["style"][1]
|
||||
else:
|
||||
style = "none"
|
||||
|
||||
repo = mapping["repo"]
|
||||
ctx = mapping["ctx"]
|
||||
revcache = mapping["revcache"]
|
||||
width = repo.ui.termwidth()
|
||||
|
||||
if style == "none":
|
||||
status = None
|
||||
elif style == "status":
|
||||
status = templatekw.getfiles(repo, ctx, revcache)
|
||||
else:
|
||||
raise error.ParseError(_("stat does not support style %r") % (style,))
|
||||
|
||||
return patch.diffstat(
|
||||
util.iterlines(ctx.diff(noprefix=False)), width=width, status=status
|
||||
)
|
||||
|
||||
|
||||
@templatefunc("sub(pattern, replacement, expression)")
|
||||
def sub(context, mapping, args):
|
||||
"""Perform text substitution
|
||||
|
@ -361,7 +361,6 @@ Test extension help:
|
||||
sparse allow sparse checkouts of the working directory
|
||||
sshaskpass ssh-askpass implementation that works with chg
|
||||
stablerev provide a way to expose the "stable" commit via a revset
|
||||
stat (no help text available)
|
||||
traceprof (no help text available)
|
||||
treemanifestserver
|
||||
tweakdefaults
|
||||
|
Loading…
Reference in New Issue
Block a user