Commit Graph

79 Commits

Author SHA1 Message Date
Matt Harbison
cf51dfbba8 identify: add template support
This is based on a patch proposed last year by Mathias De Maré[1], with a few
changes.

  - Tags and bookmarks are now formatted lists, for more flexible queries.
  - The templater is populated whether or not [-nibtB] is specified.  (Plain
    output is unchanged.)  This seems more consistent with other templated
    commands.
  - The 'id' property is a string, instead of a list.
  - The parents of 'wdir()' have their own list of attributes.

I left 'id' as a string because it seems very useful for generating version
info.  It's also a bit strange because the value and meaning changes depending
on whether or not --debug is passed (short vs full hash), whether the revision
is a merge or not (one hash or two, separated by a '+'), the working directory
or not (node vs p1node), and local or not (remote defaults to tip, and never has
'+').  The equivalent string built with {rev} seems much less useful, and I
couldn't think of a reasonable name, so I left it out.

The discussion seemed to be pointing towards having a list of nodes, with more
than one entry for a merge.  It seems simpler to give the nodes a name, and use
{node} for the actual commit probed, especially now that there is a virtual node
for 'wdir()'.

Yuya mentioned using fm.nested() in that thread, so I did for the parent nodes.
I'm not sure if the plan is to fill in all of the context attributes in these
items, or if these nested items should simply be made {p1node} and {p1rev}.

I used ':' as the tag separator for consistency with {tags} in the log
templater.  Likewise, bookmarks are separated by a space for consistency with
the corresponding log template.

[1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-August/087039.html
2017-06-24 23:09:21 -04:00
Yuya Nishihara
2fce781b0d debugrevspec: add option to suppress list of computed revisions
Test will be added later.
2017-06-10 20:14:23 +09:00
Yuya Nishihara
3299c032dd debugrevspec: add option to print representation of smartset object
It's possible by -v, but -v also prints a parsed tree. Test will be added
later.
2017-06-10 20:03:35 +09:00
Danek Duvall
9231e311ce debugbundle: add --part-type flag to emit only named part types
This removes the need in the tests for grep -A, which is not supported on
Solaris.
2017-06-05 16:19:41 -07:00
Pierre-Yves David
66c1fb799c obsolete: add a function to compute "exclusive-markers" for a set of nodes
This set will be used to select the obsmarkers to be stripped alongside the
stripped changesets. See the function docstring for details.

More advanced testing is introduced in the next changesets to keep this one
simpler. That extra testing provides more example.
2017-05-20 15:02:30 +02:00
Yuya Nishihara
eff4d5e967 cat: add formatter support
This is an example showing how formatter can handle the --output option.
git subrepo isn't supported for now.
2017-05-25 21:53:44 +09:00
Siddharth Agarwal
51c7d417b5 annotate: add a new experimental --skip option to skip revs
This option is most useful for mechanical code modifications, especially ones
that retain the same number of lines.
2017-05-24 19:39:33 -07:00
Pierre-Yves David
383c4352b9 caches: introduce a 'debugupdatecaches' command
That command make sure caches are updated. This is based on
'localrepo.updatecaches' so when we move support for new cache in that function this
command will benefit from it.
2017-05-02 21:35:06 +02:00
FUJIWARA Katsunori
0dd849cb04 debugcommands: add debugpickmergetool to examine which merge tool is chosen
Before this patch, there is no convenient way to know which merge tool
is chosen for each managed files without actual merging.
2017-05-13 03:37:50 +09:00
Matt Harbison
6d898e296f serve: add support for Mercurial subrepositories
I've been using `hg serve --web-conf ...` with a simple '/=projects/**' [paths]
configuration for awhile without issue.  Let's ditch the need for the manual
configuration in this case, and limit the repos served to the actual subrepos.

This doesn't attempt to handle the case where a new subrepo appears while the
server is running.  That could probably be handled with a hook if somebody wants
it.  But it's such a rare case, it probably doesn't matter for the temporary
serves.

The main repo is served at '/', just like a repository without subrepos.  I'm
not sure why the duplicate 'adding ...' lines appear on Linux.  They don't
appear on Windows (see 3f4ff1bdf101), so they are optional.

Subrepositories that are configured with '../path' or absolute paths are not
cloneable from the server.  (They aren't cloneable locally either, unless they
also exist at their configured source, perhaps via the share extension.)  They
are still served, so that they can be browsed, or cloned individually.  If we
care about that cloning someday, we can probably just add the extra entries to
the webconf dictionary.  Even if the entries use '../' to escape the root, only
the related subrepositories would end up in the dictionary.
2017-04-15 18:05:40 -04:00
Alexander Fomin
b6338c907a diff: add --binary option for git mode diffs
This patch adds --binary option to `hg diff` and `hg export` to allow more
control about when binary diffs are displayed in Git mode as well as some
tests to verify it behaves correctly (issue5510).
2017-04-05 15:31:08 -07:00
Kyle Lippincott
a0eab21ffc debuglabelcomplete: fix to call debugnamecomplete in new location
debugnamecomplete was moved in a9aa67ba from commands to debugcommands, but
debuglabelcomplete was not modified to call it in its new location.
2017-03-14 13:10:30 -07:00
Martin von Zweigbergk
5b3eb48725 update: accept --merge to allow merging across topo branches (issue5125) 2017-02-13 12:58:37 -08:00
Pierre-Yves David
394a984c5e color: move 'debugcolor' into the 'debugcommands' modules
This is the last bits we needed to move out of the extensions. 'hgext/color.py'
now only contains logic to changes the default color behavior to 'auto'.

However, more cleanups are on the way and we need to document the new config
directly in core.
2017-02-21 18:41:37 +01:00
Pierre-Yves David
e5d5db7cf5 color: add the definition of '--color' in core
If we want to be able to move the initialisation in core, we need core to be
aware of that '--color' flag at all time. So we now have the definition in core. That flag
is currently unprocessed without the extensions (will be fixed soon). In
addition the default value for this flag in core is 'never'. Enabling the
extensions change that default value to 'auto'.
2017-02-21 18:09:21 +01:00
Augie Fackler
3967c4ed9b pager: move more behavior into core
This moves the global flag and the --pager=yes logic into core. Only
functionality change is that users now always get a --pager flag and
can enable the pager via the flag without the extension active.

Moving the flag into core exposes a defect in the ro localization,
which will have to be corrected later.
2017-02-15 17:47:57 -05:00
Gregory Szorc
16568ee7f0 debugcommands: stub for debugupgraderepo command
Currently, if Mercurial introduces a new repository/store feature or
changes behavior of an existing feature, users must perform an
`hg clone` to create a new repository with hopefully the
correct/optimal settings. Unfortunately, even `hg clone` may not
give the correct results. For example, if you do a local `hg clone`,
you may get hardlinks to revlog files that inherit the old state.
If you `hg clone` from a remote or `hg clone --pull`, changegroup
application may bypass some optimization, such as converting to
generaldelta.

Optimizing a repository is harder than it seems and requires more
than a simple `hg` command invocation.

This commit starts the process of changing that. We introduce
`hg debugupgraderepo`, a command that performs an in-place upgrade
of a repository to use new, optimal features. The command is just
a stub right now. Features will be added in subsequent commits.

This commit does foreshadow some of the behavior of the new command,
notably that it doesn't do anything by default and that it takes
arguments that influence what actions it performs. These will be
explained more in subsequent commits.
2016-11-24 16:24:09 -08: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
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
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
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
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
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
Kostia Balytskyi
379ba461ec commands: allow debugobsolete to delete arbitrary obsmarkers
Sample usage is:
  '$ hg debugobsolete --delete 0 5'

This is a debug feature that will help people working on evolution and
obsolescense.
2016-04-01 15:12:50 -07:00
Kostia Balytskyi
35f0e5c575 debugobsolete: add an option to show marker index
A bigger picture is the ability to be delete an arbitrary marker form the
repo's obsstore. This is a useful debug ability and it needs a way to indentify
the marker one wants to delete. Having a marker's index provides such an
ability.
2016-03-23 10:50:24 -07:00
Yuya Nishihara
7d5bdcf68d templater: add debugtemplate command
This is useful for debugging template parsing. Several tests are ported to
this command.
2016-02-14 01:06:12 +09:00
timeless
c4098a81cc debuginstall: convert to formatter
commit editor now reports its editor
default template is now reported

a broken vi editor (vi not in path) is still not considered a problem (!!)
2016-03-09 18:58:51 +00:00
Jun Wu
f5397047b4 serve: rename --daemon-pipefds to --daemon-postexec (BC)
Initially we use --daemon-pipefds to pass file descriptors for synchronization.
Later, in order to support Windows, --daemon-pipefds is changed to accept a
file path to unlink instead. The name is outdated since then.

chg client is designed to use flock, which will be held before starting a
server and until the client actually connects to the server it started. The
unlink synchronization approach is not so helpful in this case.

To address the issues, this patch renames pipefds to postexec and the following
patch will allow the value of --daemon-postexec to be things like
'unlink:/path/to/file' or 'none'.
2016-02-22 16:59:08 +00:00
Ruslan Sayfutdinov
3f980f0f17 backout: commit changeset by default (BC)
Add --no-commit flag to prevent it. This should make the hg user
experience a little better. Some discussion can be found here:
http://markmail.org/message/7jm7ro2ias6hxywy
2016-01-15 13:46:33 -08:00
Gregory Szorc
3a890f3e32 commands: teach debugbundle to print bundle specification
This seems like the most logical place to put this functionality.

Test coverage over existing known bundle specs has been added.
2016-01-14 22:57:55 -08:00
timeless
308696c2c1 help: add --system flag to get help for various platform(s) 2016-01-10 08:03:58 +00:00
Yuya Nishihara
317fa85948 paths: port to generic templater
Embedded passwords are masked only in plain output because we'll want raw
values in machine-readable format such as JSON. For custom template, we can
add a filter to mask passwords (e.g. "{url|hidepassword}").

path.rawloc field is called as "url" than "path" because we have "pushurl"
sub-option. Also, "name" and "url" are not allowed as sub-options as they
conflict with the field names.
2015-12-13 22:09:57 +09:00
Gregory Szorc
d25e6f2fdc commands: add debugdeltachain command
We have debug commands for displaying overall revlog statistics
(debugrevlog) and for dumping a revlog index (debugindex). As part
of investigating various aspects of revlog behavior and performance,
I found it important to have an understanding of how revlog
delta chains behave in practice.

This patch implements a "debugdeltachain" command. For each revision
in a revlog, it dumps information about the delta chain. Which delta
chain it is part of, length of the delta chain, distance since base
revision, info about base revision, size of the delta chain, etc. The
generic formatting facility is used, which means we can templatize
output and get machine readable output like JSON.

This command has already uncovered some weird history in
mozilla-central I didn't know about. So I think it's valuable.
2015-12-05 23:37:46 -08:00
Gregory Szorc
6be2ff7286 commands.debugindexdot: use cmdutil.openrevlog()
This pattern is used for all the other debug* commands that operate
on revlogs. debugindexdot is an outlier. Make it conform.
2015-12-05 21:40:38 -08:00
Gregory Szorc
ae85c846e7 commands: support consuming stream clone bundles
For the same reasons that we don't produce stream clone bundles with `hg
bundle`, we don't support consuming stream clone bundles with `hg
unbundle`. We introduce a complementary debug command for applying
stream clone bundles. This command is mostly to facilitate testing.
Although it may be used to manually apply stream clone bundles until a
more formal mechanism is (possibly) adopted.
2015-10-15 13:43:18 -07:00
Gregory Szorc
e52d35ae6b commands: support creating stream clone bundles
Now that we have support for recognizing the streaming clone bundle
type, add a debug command for creating them.

I decided to create a new debug command instead of adding support to `hg
bundle` because stream clone bundles are not exactly used the same way
as normal bundle files and I don't want to commit to supporting them
through the official `hg bundle` command forever. A debug command,
however, can be changed without as much concern for backwards
compatibility.

As part of this, `hg bundle` will explicitly reject requests to produce
stream bundles.

This command will be required by server operators using stream clone
bundles with the clone bundles feature.
2015-10-17 11:40:29 -07:00
Siddharth Agarwal
39cdc4468e commands: add a new debug command to print merge state
We're going to be extending the merge state very soon, and this will give us a
way to test all that.
2015-10-02 13:00:47 -07:00
liscju
c4c7beba44 mercurial: add debugextensions command (issue4676)
Add debugextensions command to help users debug their extension
problems. If there are no extensions command prints nothing,
otherwise it prints names of extension modules. If quiet or
verbose option is not specified it prints(after extensions name)
last version of mercurial in which given module was tested for
non internal modules or not tested with user mercurial version.

If verbose is specified it prints following information for every
extension: extension name, import source, testedwith and buglink
information.

Extensions are printed sorted by extension name.
2015-09-10 16:53:07 +02:00
Durham Goode
099689de6b dirstate: add --minimal flag to debugrebuilddirstate
On repositories with hundreds of thousands of files, hg
debugrebuilddirstate causes every dirstate entry to be marked lookup,
and the next hg status can take many minutes.

This adds a --minimal flag that allows us to only rebuild the parts of the
dirstate that are inconsistent. This follows two rules:

1) If a file is in the dirstate but not in the parent manifest, and it is not
marked 'add', it is busted and we should drop it.

2) If a file is not in the dirstate at all, but it is in the parent
manifest, it should be added to the dirstate and we need to mark it as
lookup.

This allows us to fix repositories where the dirstate doesn't match
the manifest much more quickly.

Tested by artificially adding bad dirstate entries (via code) for both cases
above.
2015-08-12 19:44:21 -07:00
Gregory Szorc
8f8cc06067 repair: add functionality to rebuild fncache
Currently, there is no way to recover from a missing or corrupt fncache
file in place (a clone is required). For certain use cases such as
servers and with large repositories, an in-place repair may be
desirable. This patch adds functionality for in-place repair of the
fncache.

The `hg debugrebuildfncache` command is introduced. It ensures the
fncache is up to date by reconstructing the fncache from all seen files
encountered during a brute force traversal of the repository's entire
history.

The command will add missing entries and will prune excess ones.

Currently, the command no-ops unless the repository has the fncache
requirement. The command could later grow the ability to "upgrade" an
existing repository to be fncache enabled, if desired.

When testing this patch on a local clone of the Firefox repository, it
removed a bunch of entries. Investigation revealed that removed entries
belonged to empty (0 byte size) .i filelogs. The functionality for
pruning fncache of stripped revlogs was introduced in 93ba76bfbe8a, so
the presence of these entries likely predates this feature.
2015-06-22 09:59:48 -07:00
Martin von Zweigbergk
decbcc4c31 treemanifest: add --dir option to debug{revlog,data,index}
It should be possible to debug the submanifest revlogs without having
to know where they are stored (in .hg/store/meta/), so let's add a
--dir option for this purpose.
2015-04-12 23:51:06 -07:00
Sean Farley
a0d78a3107 diff: rename --relative option to --root
The diff output format is unable to express files outside the directory so it
makes sense to name this option --root instead of --relative.
2015-03-25 11:55:15 -07:00
Siddharth Agarwal
8b07d14666 commands.diff: add support for diffs relative to a subdirectory
Previous patches added all the backend support for this. This exposes this
option in the UI.
2015-03-17 15:46:30 -07:00
Matt Harbison
3ea5067ed3 subrepo: add basic support to hgsubrepo for the files command
Paths into the subrepo are not yet supported.

The need to use the workingctx in the subrepo will likely be used more in the
future, with the proposed working directory revset symbol.  It is also needed
with archive, if that code is to be reused to support 'extdiff -S'.
Unfortunately, it doesn't seem possible to put the smarts in subrepo.subrepo(),
as it breaks various status and diff tests.

I opted not to pass the desired revision into the subrepo method explicitly,
because the only ones that do pass an explicit revision are methods like status
and diff, which actually operate on two contexts- the subrepo state and the
explicitly passed revision.
2015-03-18 23:03:41 -04:00
Laurent Charignon
f97eaa8ce4 revert: add flag to make revert interactive 2015-03-16 16:33:59 -07:00
Laurent Charignon
00e39c0a37 record: add interactive option to the commit command 2015-03-11 15:22:04 -07:00
Siddharth Agarwal
d2a372910d commands.import: accept a prefix option
The --prefix option is meant to be relative to the root rather than the current
working directory. This is for consistency with the rest of 'hg import' --
paths in patches are otherwise considered to be relative to the root.

In upcoming patches we'll hook this option up to the patch functions.

--exact with --prefix is currently disallowed because I can't really come up
with sensible semantics for it, especially when only part of the patch is
preserved.
2015-03-06 22:56:19 -08:00
Yuya Nishihara
34b5e5774a resolve: port to generic templater
Test output changes because color labels are applied separately.
2015-02-11 13:59:13 +09:00
Sean Farley
dc331facee debugnamecomplete: rename from debuglabelcomplete
Now that we have decided on the use of 'name' instead of 'label' we rename this
function accordingly.

The old method 'debuglabelcomplete' has been left as a deprecated command so
that current scripts don't break.
2014-10-17 13:41:29 -07:00