Commit Graph

11983 Commits

Author SHA1 Message Date
Matt Mackall
d3c288a6a7 locate: deprecate in favor of files 2014-03-16 13:29:08 -05:00
Matt Mackall
8a32bb8140 formatter: add pickle format
This gives convenient Python2 output. Python 3 users will need encoding=bytes.
2014-09-12 18:36:38 -05:00
Matt Mackall
aa7d73cbbb commands: add hidden -T option for files/manifest/status/tags
These commands have generic formatting support but no way to enable it
yet. When this feature is more fully developed, this flag will be unhidden.
2014-09-15 13:15:07 -05:00
Matt Mackall
949498b27d formatter: add json formatter 2014-09-12 18:29:29 -05:00
Matt Mackall
7cc7319641 cmdutil: add json style to log-like commands
Sadly, this can't be done with the normal templater like we do with
XML due to JSON's inter-record comma rules.
2014-09-15 13:11:13 -05:00
Matt Mackall
0b8e08e772 encoding: add json escaping filter
This ends up here because it needs to be somewhat encoding aware.
2014-09-15 13:12:49 -05:00
Matt Mackall
00a262f2bb encoding: handle empty string in toutf8 2014-09-15 13:12:20 -05:00
Matt Mackall
be3bc4f866 formatter: make debug style match Python syntax 2014-09-12 19:06:11 -05:00
Matt Mackall
e7503a440b files: add new command unifying locate and manifest functionality 2014-09-12 18:32:46 -05:00
Mike Edgar
f67e6d6c04 filelog: parsemeta stops returning unused key list
Currently, only the returned meta dictionary is used. An upcoming change will
use the returned text offset.
2014-09-02 14:42:30 -04:00
Mike Edgar
8a41e32180 filelog: make parsemeta a public module function, to be used by censor module 2014-09-10 00:18:15 -04:00
Mike Edgar
bfb97f3a41 filelog: make packmeta a public module function, to be used by censor 2014-09-10 00:17:17 -04:00
Matt Mackall
5bfd322b62 ui: move samplehgrcs from config
config is generic code that doesn't know about Mercurial usage, so
this was at the wrong layer
2014-09-11 12:26:12 -05:00
Matt Mackall
0653ac4e4b config: normalize style between user/global example configs 2014-09-11 12:21:15 -05:00
Augie Fackler
dcd5b5a4f4 commit: correctly check commit mutability during commit --amend
The right way to check if a context is mutable is to call .mutable(),
not to compare .phase() with public.
2014-08-19 14:33:31 -04:00
Augie Fackler
1a68be1d21 manifest: mark addlistdelta and checkforbidden as module-private 2014-09-11 10:14:34 -04:00
Augie Fackler
e5850be295 manifest: move addlistdelta to module-level
Again, there's no reason for this to be inside manifest.add, so we'll
define it only once.
2014-08-07 12:47:20 -04:00
Augie Fackler
7d3a829f20 manifest: move checkforbidden to module-level
There's no need for this function to be nested, so let's just define
it once instead of every time manifest.add() gets called.
2014-08-07 09:46:05 -04:00
Durham Goode
1d292c944f dirstate: add exception when calling setparent without begin/end (API)
Adds an exception when calling dirstate.setparent without having first called
dirstate.beginparentchange. This will prevent people from writing code that
modifies the dirstate parent without considering the transactionality of their
change.

This will break third party extensions that call setparents.
2014-09-05 11:37:44 -07:00
Durham Goode
a5a69f0001 dirstate: wrap setparent calls with begin/endparentchange (issue4353)
This wraps all the locations of dirstate.setparent with the appropriate
begin/endparentchange calls. This will prevent exceptions during those calls
from causing incoherent dirstates (issue4353).
2014-09-05 11:36:20 -07:00
Durham Goode
7a67b9c913 dirstate: add begin/endparentchange to dirstate
It's possible for the dirstate to become incoherent (issue4353) if there is an
exception in the middle of the dirstate parent and entries being written (like
if the user ctrl+c's). This change adds begin/endparentchange which a future
patch will require to be set before changing the dirstate parent.  This will
allow us to prevent writing the dirstate in the event of an exception while
changing the parent.
2014-09-05 11:34:29 -07:00
Henrik Stuart
e2838d5249 parsers: avoid signed/unsigned comparison mismatch
Based on warning from Microsoft Visual C++ 2008.
2014-09-08 20:57:44 +02:00
Henrik Stuart
78f716f0fd parsers: use correct type for file offset
Now using Py_ssize_t instead of long to denote offset in file whose length is
already measured using Py_ssize_t. Length and offset are now consistent. Based
on warning from Microsoft Visual C++ 2008.
2014-09-08 20:22:10 +02:00
Henrik Stuart
a276be3478 parsers: ensure correct return type for inline_scan
The returned data type for inline_scan should be Py_ssize_t rather than long.
Based on warning from Microsoft Visual C++ 2008.
2014-09-08 20:20:17 +02:00
Henrik Stuart
a18556978b parsers: fix typing issue when constructing Python integer object
The passed variable is a Py_ssize_t, not a long, and consequently should use
PyInt_FromSsize_t rather than PyInt-FromLong. Fixed based on warning from
Microsoft Visual C++ 2008.
2014-09-11 12:05:23 -05:00
Henrik Stuart
fc62e1d1bc parsers: use bitmask type consistently in find_gca_candidates
Normalized type usage in find_gca_candidates triggered by warning from
Microsoft Visual C++ 2008.
2014-09-08 20:06:52 +02:00
Pierre-Yves David
0a99f9c4f9 revert: drop lexist check in the backup logic
We are no longer trying to backup files that do not exist on disk. This check
can be safely dropped.
2014-08-30 02:10:29 +02:00
Pierre-Yves David
2a02a27185 revert: distinguish between deleted file and locally modified
Locally modified needs a backup while a deleted file cannot be backed
up because there is no file to backup.
2014-08-30 02:09:53 +02:00
Pierre-Yves David
a6bc441291 revert: detect unknown files in the same path as files marked as removed
Such unknown files may need to be backed up. Having them identified beforehand
will help simplify the backup logic.

We now use different sets with different backup strategies.
2014-08-30 02:00:20 +02:00
Pierre-Yves David
f77e0eb240 revert: cache working context in a variable
During the silicon age, humans on planet Earth discovered the use of
variables. This marvelous invention let them improve both code
readability and performance.
2014-08-30 01:52:08 +02:00
Pierre-Yves David
1873ea14ec obsolete: properly drop 'date' from metadata
Mistakes were made while resolving rebase conflicts in 92753bcc8aa2. This led to
'date' being preserved in metadata when reading markers from a binary stream.

As a result, some known markers were seen as "new" when pulling. I noticed it
because a no-op pulls from main added about 600 duplicated markers to my
obsstore (for each pull).

I do not believe we need to perform any specific action to actively
de-duplicates existing obsstore. After this fix, duplicated markers will no be
propagated and the few affected repositories can probably deal with duplication (or
people can repull the obsstore from a clone).

As a side effect, we decode metadata only once, reducing the impact of the hack
in fm0 to store extra important data (parents and date).
2014-09-10 14:42:52 +01:00
Anton Shestakov
c4f325bd82 templater: implement __len__ for _hybrid
Objects of class _hybrid are returned by such template keywords as children,
bookmarks, tags and others, and also by revset() template function. They are
representing "list of strings" (as hg help template says) for use in templates.
So it would be logical to implement a handy way to count the number of strings
in such list, and that's what __len__ method does.
2014-09-08 20:12:58 +09:00
Sune Foldager
eb415860f8 changegroup: rename bundle-related functions and classes
Functions like getbundle and classes like unbundle10 really manipulate
changegroups and not bundles. A HG10 bundle is the same as a changegroup
plus a small header, but this is no longer the case for a HG2X bundle,
so it's better to separate the names a bit.
2014-09-02 12:11:36 +02:00
Mads Kiilerich
fae32dd0a3 comments: describe ancestor consistently - avoid 'least common ancestor'
"best" is as defined by mercurial.ancestor.ancestors: furthest from a root (as
measured by longest path).
2014-08-19 01:13:10 +02:00
Mads Kiilerich
f3e152462b dagutils: fix docstrings for singleton internalize/externalize 2014-08-15 19:43:32 +02:00
Martin von Zweigbergk
e95a8f8fb9 cmdutil: avoid the confusing name 'patch' for a matcher 2014-08-31 07:45:50 -07:00
Jordi Gutiérrez Hermoso
f26ea7b700 config: propose some sample global config file
An example of what could be suggested to the user as a global config
file. Trying to be conservative here, and only suggesting the safest
possible extensions. In addition to the user-level extensions, the
blackbox extension is something a sysadmin might reasonable want to
enable for every repo on the system.
2014-08-24 19:45:46 -04:00
Jordi Gutiérrez Hermoso
87b5d13400 config: give more fine-tuned sample hgrcs to this command
The hgrc for user config is typically different from the hgrc at the
system-wide or repository level. This patch provides different sample
hgrcs for each level. Sometimes when copying repos around, the copy or
the original don't have a default path yet, so at least for `hg config
-l`, this ought to provide a more reasonable default and suggestions
of what typically goes there.

The actual sample configs go in the config.py file, to minimise
clutter. In order to avoid an unnecessary import, the corresponding
import for this dictionary is at the file level.
2014-08-13 17:05:48 -04:00
Mads Kiilerich
b46e11faa6 revlog: introduce isancestor method for efficiently determining node lineage
Hide the not so obvious use of commonancestorsheads.
2014-08-19 01:13:10 +02:00
Augie Fackler
54df1661c3 clone: provide sample username = config entry in .hg/hgrc (issue4359)
Some users clone from a server before ever running 'hg config --edit',
so they don't see our helpful template for things like enabling the
username. Attempt to give them some helpful guidance.
2014-09-09 17:16:24 -04:00
Augie Fackler
a0fd83333c merge with stable 2014-09-09 13:47:50 -04:00
FUJIWARA Katsunori
0d1dc1fcfa dispatch: check shell alias again after loading extensions (issue4355)
Before this patch, the shell alias causes failure when it takes its
specific (= unknown for "hg") options in the command line, because
"_parse()" can't accept them.

This is the regression introduced by 7849ac1dbc57.

It fixed the issue that ambiguity between shell aliases and commands
defined by extensions was ignored. But it also caused that ambiguous
shell alias is handled in "_parse()" even if it takes specific options
in the command line.

To avoid such failure, this patch checks shell alias again after
loading extensions.

All aliases and commands (including ones defined by extensions) are
completely defined before the 2nd (= newly added in this patch)
"_checkshellalias()" invocation, and "cmdutil.findcmd(strict=False)"
can detect ambiguity between them correctly.

For efficiency, this patch does:

  - omit the 2nd "_checkshellalias()" invocation if "[ui] strict= True"

    it causes "cmdutil.findcmd(strict=True)", of which result should
    be equal to one of the 1st invocation before adding aliases

  - avoid removing the 1st "_checkshellalias()" invocation

    it causes "cmdutil.findcmd(strict=True)" invocation preventing
    shell alias execution from loading extensions uselessly
2014-09-10 00:41:44 +09:00
FUJIWARA Katsunori
906133d681 dispatch: make "_checkshellalias" reusable regardless of adding aliases
To reduce changes in the subsequent patch fixing issue4355, this patch
makes "_checkshellalias" reusable regardless of adding aliases.

In this patch, alias definitions are added and restored, only when
"precheck=True".
2014-09-10 00:41:44 +09:00
Gregory Szorc
a57721695a help: only call doc() when it is callable
`hg help -k` on my machine was aborting because the hg-prompt extension
was inserting a string and not a function into help.helptable and help
was blindly calling it.

This patch changes keyword searching to be more robust against
unexpected types.
2014-08-30 20:06:24 +02:00
Mike Hommey
edf6a59652 repoview: fix typo in repoview.changelog
Incidentally, this avoids the changelog cache being invalidated each time
it's accessed on a repoview.

On a filtering experiment on a repository the size of mozilla-central,
this makes a significant difference:

Before, running hg log -l 10 --time with about 8k changesets filtered out:
time: real 1.490 secs (user 1.450+0.000 sys 0.040+0.000)

After:
time: real 0.540 secs (user 0.530+0.000 sys 0.010+0.000)
2014-08-31 19:43:03 +09:00
Pierre-Yves David
884e556964 revert: drop now useless conditional in the backup check
Now that we removed the (hopeless) attempt to backup file we knew to be
missing in the target changeset, we can stop checking if the file exists in
the target changeset.
2014-08-30 01:51:02 +02:00
Pierre-Yves David
d51e1ac08b revert: no backup for dsadded set
There is only one case where a backup is required in the `dsadded` set, and the
current backup mechanism fails to handle it. So we stop trying to do backups at
all for now. This will help us to simplify the backup code and finally fix
this backup issue.
2014-08-30 01:49:28 +02:00
Pierre-Yves David
5fca88c509 revert: add more padding in the dispatch list
We are going to add more sets and some of them will have longer names. We add
padding in a standalone patch for readbility purposes.
2014-08-30 16:06:09 +02:00
Pierre-Yves David
b34b8413be revert: add documentation in the dispatch table
More sets are coming so documenting the existing ones will help.
2014-08-30 01:48:58 +02:00
Pierre-Yves David
2554c150e4 revert: add a way for external extensions to prefetch file data
This allow extensions that mess with the storage layer (remotefilelog,
largefile) to prefetch any data that will be accessed during the revert
operation.

We are currently fetching more data than theoretically required because the
backup code is a bit stupid. Future patches will improve that.
2014-08-30 02:47:59 +02:00