##// END OF EJS Templates
phabricator: add a small language to query Differential Revisions...
phabricator: add a small language to query Differential Revisions Previously, `phabread` can only be used to read a single patch, or a single stack of patches. In the future, we want to have more complex queries like filtering with status (open, accepted, closed, etc), or maybe more complex like filtering by reviewers etc. The command line flag approach won't scale with that. Besides, we might want to have other commands to update Differential Revision status in batch, like accepting a stack using a single command. Therefore, this patch adds a small language. It has basic set operations: `&`, `+`, `-` and an ancestor operator to support `--stack`. Test Plan: Try querying this Phabricator instance: hg phabread 1+2 # 1, 2 hg phabread D2+D1 # 2, 1 hg phabread ':118-115+:2-1' # 114, 116, 117, 118, 2 hg phabread '((:118-(D115+117)))&:117' # 114, 116 hg phabread ':2&:117' --debug # differential.query is called only once Make sure the output is expected and prefetch works. Differential Revision: https://phab.mercurial-scm.org/D125

File last commit:

r33778:db6b666c default
r33831:53954177 default
Show More
map-cmdline.default
82 lines | 3.2 KiB | text/plain | TextLexer
# Base templates. Due to name clashes with existing keywords, we have
# to replace some keywords with 'lkeyword', for 'labelled keyword'
changeset = '{cset}{branches}{bookmarks}{tags}{parents}{user}{ldate}{ltroubles}{summary}\n'
changeset_quiet = '{lnode}'
changeset_verbose = '{cset}{branches}{bookmarks}{tags}{parents}{user}{ldate}{ltroubles}{lfiles}{lfile_copies_switch}{description}\n'
changeset_debug = '{fullcset}{branches}{bookmarks}{tags}{lphase}{parents}{manifest}{user}{ldate}{ltroubles}{lfile_mods}{lfile_adds}{lfile_dels}{lfile_copies_switch}{extras}{description}\n'
# File templates
lfiles = '{if(files,
label("ui.note log.files",
"files: {files}\n"))}'
lfile_mods = '{if(file_mods,
label("ui.debug log.files",
"files: {file_mods}\n"))}'
lfile_adds = '{if(file_adds,
label("ui.debug log.files",
"files+: {file_adds}\n"))}'
lfile_dels = '{if(file_dels,
label("ui.debug log.files",
"files-: {file_dels}\n"))}'
lfile_copies_switch = '{if(file_copies_switch,
label("ui.note log.copies",
"copies: {file_copies_switch
% ' {name} ({source})'}\n"))}'
# General templates
_instability_label = 'instability.{instability}'
_troubles_labels = '{if(instabilities, "changeset.unstable {instabilities%_instability_label}")}'
_obsolete_label = '{if(obsolete, "changeset.obsolete")}'
_cset_labels = '{separate(" ", "log.changeset", "changeset.{phase}", "{_obsolete_label}", "{_troubles_labels}")}'
cset = '{label("{_cset_labels}",
"changeset: {rev}:{node|short}")}\n'
lphase = '{label("log.phase",
"phase: {phase}")}\n'
fullcset = '{label("{_cset_labels}",
"changeset: {rev}:{node}")}\n'
parent = '{label("log.parent changeset.{phase}",
"parent: {rev}:{node|formatnode}")}\n'
lnode = '{label("log.node",
"{rev}:{node|short}")}\n'
manifest = '{label("ui.debug log.manifest",
"manifest: {rev}:{node}")}\n'
branch = '{label("log.branch",
"branch: {branch}")}\n'
tag = '{label("log.tag",
"tag: {tag}")}\n'
bookmark = '{label("log.bookmark",
"bookmark: {bookmark}")}\n'
user = '{label("log.user",
"user: {author}")}\n'
summary = '{if(desc|strip, "{label('log.summary',
'summary: {desc|firstline}')}\n")}'
ldate = '{label("log.date",
"date: {date|date}")}\n'
ltroubles = '{if(instabilities, "{label('log.instability',
'instability: {join(instabilities, ", ")}')}\n")}'
extra = '{label("ui.debug log.extra",
"extra: {key}={value|stringescape}")}\n'
description = '{if(desc|strip, "{label('ui.note log.description',
'description:')}
{label('ui.note log.description',
'{desc|strip}')}\n\n")}'
status = '{status} {path}\n{if(copy, " {copy}\n")}'