Commit Graph

3105 Commits

Author SHA1 Message Date
timeless
b2cc060f3a serve: use single quotes in use warning 2016-09-20 23:47:02 +00:00
timeless
dd077e79ae bundle: use single quotes in use warning 2016-09-20 23:46:15 +00:00
timeless
872aae0d97 push: update help hint to point to config.paths section 2016-09-20 20:12:38 +00:00
Mathias De Maré
109af2a941 config: add template support
V2:
- Limit escaping to plain formatting only
- Use the formatter consistently (no more ui.debug)
- Always include 'name' and 'value'

V3:
- Always convert 'value' to string (this also makes sure we handle functions)
- Keep real debug message as ui.debug for now
- Add additional tests.
  Note: I'm not quite sure about the best approach to handling
  the 'print the full config' case.
  For me, it printed the 'ui.promptecho' key at the end.
  I went with globs there as that at least tests the json display reliably.

Example output:
[
 {
  "name": "ui.username",
  "source": "/home/mathias/.hgrc:2",
  "value": "Mathias De Maré <mathias.demare@gmail.com>"
 }
]
2016-08-29 07:07:15 +02:00
Mathias De Maré
ba1cc0ec1c formatter: introduce isplain() to replace (the inverse of) __nonzero__() (API)
V2: also remove and replace __nonzero__
2016-08-29 17:19:09 +02:00
Yuya Nishihara
daaa5c994b debugrevspec: add option to verify optimized result
This provides a convenient way to diff "hg debugrevspec" outputs generated
with/without --no-optimized option.
2016-08-21 13:16:21 +09:00
Yuya Nishihara
845ca229f7 debugrevspec: add option to skip optimize() and evaluate unoptimized tree
This will help debugging optimizer bugs.

Maybe '--no-optimized' can be changed to '--optimized' (default: True) when
flags series landed.
2016-08-21 12:40:02 +09:00
Yuya Nishihara
c883bfb39b revset: remove showwarning option from expandaliases()
Now all callers pass showwarning=ui.warn, so we no longer need the option to
suppress warnings.
2016-09-08 22:44:10 +09:00
Yuya Nishihara
8c0043a25b debugrevspec: evaluate tree built by itself
Prepares for new option to evaluate an unoptimized tree.

Since a revset expression is no longer parsed twice, alias warnings should
be displayed at the first parsing stages. That's why showwarning=ui.warn is
added.
2016-08-21 12:45:43 +09:00
Yuya Nishihara
94a7c74fda debugrevspec: deprecate --optimize option
This option has been superseded by '--show-stage NAME', and will cause
confusion in future patches.
2016-08-21 12:36:23 +09:00
Yuya Nishihara
edc60dd7e4 debugrevspec: add option to print parsed tree at given stages
"-p <stage>" is useful for investigating parsing stages. With -p option, a
transformed tree is printed no matter if it is changed or not, which allows
us to know valid stage names by "-p all".
2016-08-21 12:33:57 +09:00
Yuya Nishihara
86024cfc0d debugrevspec: transform and print parsed tree by stages
Prepares for adding new option to print transformed tree at each stage.
2016-08-21 12:04:08 +09:00
Yuya Nishihara
654d08a915 debugrevspec: build parsed tree even if no --verbose specified
Prepares for evaluating unoptimized tree. The output is suppressed by
ui.note() anyway.
2016-08-21 11:50:54 +09:00
Yuya Nishihara
c0d8e08ed6 revset: make analyze() a separate step from optimize()
This will allow us to evaluate unoptimized tree and compare the result with
optimized one.

The private _analyze() function isn't renamed since I'll add more parameters
to it.
2016-08-21 11:29:57 +09:00
Ryan McElroy
78bbaf76bd discovery: explicitly check for None in outgoing init
c8fefe878a71 introduced default params for discovery.outgoing(), but it used a
falsy check instead of an explicit check for None. The result is that callers
that passed in an empty list would have that list overridden by the defaults,
which is not the expected behavior.

This was discovered by changes to the test-pushrebase.t test in Facebook's
repository of mercurial extensions.
2016-09-06 09:43:25 -07:00
Hannes Oldenburg
e760d0c60b commands: remove unecessary copying of list in graft() 2016-09-05 08:29:36 +00:00
Yuya Nishihara
fd192b732a debugextensions: hide "ships-with-hg-core" magic string (BC)
Since we have "bundled" flag, we no longer need to rephrase "ships-with-hg-core"
to show as "internal".
2016-08-26 23:31:17 +09:00
Yuya Nishihara
1e5148d260 debugextensions: show ships-with-hg-core state as a separate field
This is less magical than rephrasing ships-with-hg-core as internal, and
we can distinguish "internal" liar. "tested with: internal" will be hidden
by the next patch.
2016-08-31 23:22:07 +09:00
Pulkit Goyal
8b4f697218 py3: remove use of *L syntax
The int in Python 3 behaves as long so no need of L's in py3.
Moreover we dont need long here.
2016-09-01 02:29:46 +05:30
Martin von Zweigbergk
2fbf01764c util: rename checkcase() to fscasesensitive() (API)
I always read the name "checkcase(path)" as "do we need to check for
case folding at this path", but it's actually (I think) meant to be
read "check if the file system cares about case at this path". I'm
clearly not the only one confused by this as the dirstate has this
property:

  def _checkcase(self):
      return not util.checkcase(self._join('.hg'))

Maybe we should even inverse the function and call it fscasefolding()
since that's what all callers care about?
2016-08-30 09:22:53 -07:00
Yuya Nishihara
9695a817e8 version: change "place" field of extension to "bundled" flag
The name "place" sounds odd. We can simply expose raw boolean values instead
of switching external/internal literals.
2016-08-26 23:38:52 +09:00
Yuya Nishihara
228026b4ee extensions: use ismoduleinternal() thoroughly
"ships-with-hg-core" would be long enough to typo.
2016-08-27 00:00:28 +09:00
Yuya Nishihara
e42d0fb100 formatter: add context manager interface for convenience
And port "hg files" to test it.

As you can see, extra indent is necessary to port to this API. I don't think
we should switch every fm.formatter() call to "with" statement.
2016-08-29 00:00:05 +09:00
Yuya Nishihara
23829625a1 grep: add formatter support
Several fields are renamed to be consistent with the annotate command, which
doesn't mean the last call for the name unification [1]. Actually, I'd rather
rename line_number to linenumber, linenum, lineno or line, but I want to
port the grep command to formatter first.

 [1]: https://www.mercurial-scm.org/wiki/GenericTemplatingPlan#Dictionary

I don't have any better name for the list of matched/unmatched texts, so
they are just called as "texts".
2016-08-18 15:13:56 +09:00
Yuya Nishihara
bc268d1d3a grep: build list of all columns regardless of display options
These columns should always be available in JSON or template outputs. The
"change" column is excluded because it has no useful data unless --all is
specified.
2016-08-18 14:52:06 +09:00
Yuya Nishihara
69e3fa3cab grep: build list of columns without "grep." label prefix
Prepares for formatter support. We need field names without "grep.".
2016-08-18 14:23:29 +09:00
Yuya Nishihara
18d54828a3 grep: factor out function that prints matched line with labels
Prepares for formatter support.
2016-08-18 14:09:49 +09:00
Yuya Nishihara
1e04cbab83 grep: refactor loop that yields matched text with label
As preparation for formatter support, this and the next patch split
linestate.__iter__() into two functions, line scanner and displayer.

New code uses regexp.search(str, pos) in place of regexp.search(substr),
which appears to fix a bug of highlighting.
2016-08-18 14:03:25 +09:00
liscju
6bdf778d3e files: change documentation to match its behaviour (issue5276)
Documentation gave the usage pattern as '[OPTION]... [PATTERN]...'
when the command match given files as relpaths by default.
2016-07-05 09:37:07 +02:00
Augie Fackler
4e1c384d0a extensions: change magic "shipped with hg" string
I've caught multiple extensions in the wild lying about being
'internal', so it's time to move the goalposts on people. Goalpost
moving will continue until third party extensions stop trying to
defeat the system.
2016-08-23 11:26:08 -04:00
Yuya Nishihara
3e1f2a73cd version: add formatter support
The license message isn't exported, which I don't think is useful and I
couldn't find a way to restructure it for JSON or template outputs.
2016-08-25 01:00:26 -04:00
Yuya Nishihara
161bc66818 version: factor out mapping of internal/external labels
Prepares for formatter support, where translation should be disabled
conditionally.
2016-08-16 16:09:12 +09:00
Yuya Nishihara
e723a6d369 version: always build list of extension versions
This patch just moves "if ui.verbose:" to the inner loop, as preparation
for formatter support.
2016-08-16 16:03:09 +09:00
Pierre-Yves David
1b40b7e1c5 getchangegroup: take an 'outgoing' object as argument (API)
There is various version of this function that differ mostly by the way they
define the bundled set. The flexibility is now available in the outgoing object
itself so we move the complexity into the caller themself. This will allow use
to remove a good share of the similar function to obtains a changegroup in the
'changegroup.py' module.

An important side effect is that we stop calling 'computeoutgoing' in
'getchangegroup'. This is fine as code that needs such argument processing
is actually going through the 'exchange' module which already all this function
itself.
2016-08-09 17:00:38 +02:00
Yuya Nishihara
7105924c83 debugobsolete: add formatter support (issue5134)
It appears that computing index isn't cheap if --rev is specified. That's
why "index" field is available only if --index is specified.

I've named marker.flags() as "flag" because "flags" implies a list or dict
in template world.

Thanks to Piotr Listkiewicz for the initial implementation of this patch.
2016-08-15 16:07:55 +09:00
Pierre-Yves David
70ca03c859 debugbuilddag: take wlock to cover '.hg/localtags'
This debug command can write local tags. local tags are in the .hg directory and
should be covered by the 'wlock'. This is now covered.
2016-08-07 17:15:19 +02:00
Gregory Szorc
efb3c4ff63 help: don't try to render a section on sub-topics
This patch subtly changes the behavior of the parsing of "X.Y" values
to not set the "section" variable when rendering a known sub-topic.
Previously, "section" would be the same as the sub-topic name. This
required the sub-topic RST to have a section named the same as the
sub-topic name.

When I made this change, the descriptions from help.internalstable
started being rendered in command line output. This didn't look correct
to me, as it didn't match the formatting of main help pages. I
corrected this by moving the top section to help.internalstable and
changing the section levels of all the "internals" topics.

The end result is that "internals" topics now match the rendering of
main topics on both the CLI and HTML. And, "internals" topics no longer
require a main section matching the name of the topic.
2016-08-06 17:04:22 -07:00
Augie Fackler
09340590e2 commands: use iter(callable, sentinel) instead of while True
This is functionally equivalent, but is a little more concise.
2016-08-05 14:00:08 -04:00
Yuya Nishihara
dbb4c18c54 debugextension: change "testedwith" to a list (BC)
It wasn't a list since the formatter couldn't process a list. We have no
such problem now and the -T option is experimental, so we can change it.
2016-03-19 17:19:03 -07:00
Yuya Nishihara
de8bc280b9 debugextensions: unindent nested if 2016-07-10 22:07:34 +09:00
Yuya Nishihara
fc753f3836 debugextensions: give short name to util.version() 2016-07-10 22:06:13 +09:00
Yuya Nishihara
c68b0f691e debugextensions: simply keep testedwith variable as a list
There should be no need to distinguish [] and None.
2016-07-10 21:59:43 +09:00
FUJIWARA Katsunori
9e475c7395 doc: fix incorrect use of rst hg role in help text 2016-08-01 06:08:27 +09:00
FUJIWARA Katsunori
7d27fc4948 doc: use field rst syntax to show keywords in debugdeltachain help correctly
List of available keywords is well formatted as a list of fields in
doc string, but is formatted as just normal text in online help
output.
2016-08-01 06:08:26 +09:00
Gábor Stefanik
8c51f3f327 graft: use opts.get() consistently
Make life easier for extension writers.
2016-07-25 17:00:42 +02:00
Denis Laxalde
399b84e4b1 annotate: handle empty files earlier
Rather than looping on funcmap and then checking for non-zero `l`
continue if the result of fctx.annotate is empty.
2016-07-11 15:45:34 +02:00
Martin von Zweigbergk
5dcec73439 debug: make debug{revlog,index,data} --dir not just a flag
The directory argument (for tree manifests) should belong to to the
--dir argument. I had mistakenly made --dir a flag. One effect of this
was that I had meant for "-m" to be optional, but instead it changed
the behavior of --dir, so with "hg debugdata -m --dir dir1 0", the -m
took over and the "dir1" got treated as a revision in the root
manifest log.
2016-06-24 11:12:41 -07:00
Martin von Zweigbergk
a785632cca debugdata: disallow trailing option with -c/-m
Before this change, "hg debugdata -c 0 foo" was allowed.
2016-06-24 11:25:55 -07:00
Gregory Szorc
9c6bc630a3 ui: path option to declare which revisions to push by default
Now that we have a mechanism for declaring path sub-options, we can
start to pile on features!

Many power users have expressed frustration that bare `hg push`
attempts to push all local revisions to the remote. This patch
introduces the "pushrev" path sub-option to control which revisions
are pushed when no "-r" argument is specified.

The value of this sub-option is a revset, naturally.

A future feature addition could potentially introduce a "pushnames"
sub-options that declares the list of names (branches, bookmarks,
topics, etc) to push by default. The entire "what to push by default"
feature should probably be considered before this patch lands.
2016-06-26 07:59:02 -07:00
FUJIWARA Katsunori
f46b49a0e3 check-code: detect "missing _() in ui message" more exactly
Before this patch, "missing _() in ui message" rule overlooks
translatable message, which starts with other than alphabet.

To detect "missing _() in ui message" more exactly, this patch
improves the regexp with assumptions below.

  - sequence consisting of below might precede "translatable message"
    in same string token

    - formatting string, which starts with '%'
    - escaped character, which starts with 'b' (as replacement of '\\'), or
    - characters other than '%', 'b' and 'x' (as replacement of alphabet)

  - any string tokens might precede a string token, which contains
    "translatable message"

This patch builds an input file, which is used to examine "missing _()
in ui message" detection, before '"$check_code" stringjoin.py' in
test-contrib-check-code.t, because this reduces amount of change churn
in subsequent patch.

This patch also applies "()" instead of "_()" on messages below to
hide false-positives:

  - messages for ui.debug() or debug commands/tools
    - contrib/debugshell.py
    - hgext/win32mbcs.py (ui.write() is used, though)
    - mercurial/commands.py
      - _debugchangegroup
      - debugindex
      - debuglocks
      - debugrevlog
      - debugrevspec
      - debugtemplate

  - untranslatable messages
    - doc/gendoc.py (ReST specific text)
    - hgext/hgk.py (permission string)
    - hgext/keyword.py (text written into configuration file)
    - mercurial/cmdutil.py (formatting strings for JSON)
2016-06-21 00:50:39 +09:00