Commit Graph

11969 Commits

Author SHA1 Message Date
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
Augie Fackler
f41d193435 merge with stable 2014-09-04 09:59:23 -04:00
Durham Goode
37c75eb0f0 bookmarks: allow pushkey if new equals current
Previously a bookmark pushkey would be rejected if the specified 'old' value
didn't match the servers 'current' value. This change allows this situation, as
long as the 'current' server value equals the 'new' pushkey value already.

We are trying to write a hook that forces a server bookmark to move forward,
using a changegroup hook. If the user also pushed the bookmark, they would get
an error, since they computed their pushkey (old,new) pair before the server
moved the bookmark. Long term, bundle2 will let us do this more smartly, but
this change seems reasonable for now.
2014-08-26 04:58:41 -07:00
Angel Ezquerra
129d376917 localrepo: make it possible to pass multiple path elements to join and wjoin
This makes join and wjoin behave in the same way as os.path.join. That is, it
makes it possible to pass more than one path element to them.

Note that the first path element is still required, as it was before this patch,
and as is the case for os.path.join.
2014-08-28 17:23:05 +02:00
Mike Edgar
be835fe233 error: use docstrings, not bare strings, for error classes 2014-08-30 12:22:20 +02:00
Pierre-Yves David
5b2a89c72f branchmap: pre-filter topological heads before ancestors based filtering
We know that topological heads will not be ancestors of anything, so we filter
them out to potentially reduce the range of the ancestors computation.

On a strongly headed repo this gives humble speedup:

    from 0.1984 to 0.1629
2014-08-30 12:33:12 +02:00
Pierre-Yves David
fa154e4139 branchmap: issue a single call to ancestors for all heads
There is no reason to make multiple calls. This provides a massive speedup for
repo with a lot of heads.

On a strongly headed repo this gives humble speedup in simple case:

    from 8.1097 to 5.1051

And massive speedup in other case:

    from 7.8787 to 0.1984
2014-08-30 12:20:50 +02:00
Pierre-Yves David
cb0b9120c1 bundle2: pull obsmarkers relevant to the pulled set through bundle2
We use the new `obsheads` argument to retrieve them in a bundle2 part at the
same time as the changegroup.
2014-08-26 12:47:41 +02:00
Pierre-Yves David
e65921cdf4 getbundle: add obsmarkers argument to getbundle
This argument triggers the retrieval of all markers relevant to the set of
changesets defined by the nodes in `heads`.
2014-08-29 12:36:17 +02:00
Pierre-Yves David
4fa8350ddd pull: use the "cg" argument when pulling a bundle2
We use the `cg` argument to disable the generation of a changegroup part. This
is useful to pull information when changesets are already in sync (phases,
obsmarkers).
2014-08-29 12:28:58 +02:00
Pierre-Yves David
d291149b10 wireprotocol: fix 'boolean' handling
The encoding and decoding code were swapped. This is now fixed.
2014-08-29 12:51:00 +02:00
Pierre-Yves David
81f365f70c push: only push obsmarkers relevant to the "pushed subset"
We should only exchange obsolete markers related to the changesets
that are being exchanged. For example, if `A'` is a successor of `A`,
we do not want to push the marker if we are not exchanging
`A'`. Otherwise `A` would disappear without a successor, leading to confusion
for both users and the evolution mechanism.

Therefore we now exchange only the markers relevant to the subset of nodes
involved in the push (the nodes themselves may be already common but were
selected by --rev (or the lack of --rev)).

Note that all selected markers are still exchanged on each push. We do
not have a discovery protocol for markers in core yet. Such discovery
would save us the exchange of markers known on both side.
2014-08-20 01:15:09 -07:00
Pierre-Yves David
4dda0b0535 push: use bundle2 to push obsmarkers when possible 2014-08-25 19:44:27 +02:00
Pierre-Yves David
64fe90ce39 exchange: add a buildobsmarkerpart function
We'll have to build an obsmarker part for both push and pull. So we build a
function to factor out the common part.
2014-08-25 19:32:51 +02:00
Pierre-Yves David
9c8ad08d12 obsolete: add a commonversion function
This function returns the highest common version between the locally known
formats and a list of remotely known formats. This is going to be useful to
know what format should be used for exchange.
2014-08-26 11:36:23 +02:00