Commit Graph

11718 Commits

Author SHA1 Message Date
Pierre-Yves David
7eb6e3f27d bundle2: catch UnknownPartError during pull
We narrow the exception catching while pulling.
2014-04-21 19:43:01 -07:00
Pierre-Yves David
dc21483bc8 bundle2: catch UnknownPartError during push
We narrow the exception catching while unbundling the push reply.
2014-04-21 19:42:51 -07:00
Pierre-Yves David
8265035568 bundle2: use a more specific UnknownPartError when no handler is found
KeyError is very generic, we need something more specific for proper error
handling.
2014-04-21 19:42:40 -07:00
Pierre-Yves David
3085949133 bundle2: gracefully handle abort during unbundle
Clients expect a bundle2 reply to their bundle2 submission. So we
catch the Abort error and turn it into a bundle2 containing a part
transporting the exception data. The unbundling of this reply will
raise the error again.
2014-04-21 15:48:52 -07:00
Pierre-Yves David
3385347d38 bundle2: decorate exception raised during bundle processing
This is a small hack to help us do some graceful error handling in bundle2
without major refactoring. See embedded comment for details.
2014-04-22 11:22:41 -07:00
Wagner Bruna
359de9734a commands: fix typo in --graph description 2014-04-22 10:12:21 -03:00
Wagner Bruna
0db6df4ed7 revset, i18n: add translator comment to "only" 2014-04-22 10:12:13 -03:00
Mads Kiilerich
134cd15f9a merge: improve notes for listing the bids for ambiguous merges 2014-04-21 20:24:54 +02:00
Mads Kiilerich
a37cc358ef merge: tell the user when we are using bid merge
Bid merge is a new rarely used feature that the user explicitly enabled - we
should tell/warn when the user actually is using it, just like we tell when we
not are using it.

Give a message like
  note: merging 3b08d01b0ab5+ and adfe50279922 using bids from ancestors 0f6b37dbe527 and 40663881a6dd
2014-04-18 13:33:20 +02:00
Mads Kiilerich
019c70c1d0 merge: fix stray character in bid merge message 2014-04-21 20:22:14 +02:00
Mads Kiilerich
6112ed888f merge: fix wrong number of arguments for bid merge message 2014-04-21 19:53:19 +02:00
Matt Mackall
4c8937e91e merge: fix test failures with new merge code on OS X
The case collision checker was missing a op entry for 'k'eep.
2014-04-21 15:08:39 -05:00
Martin Geisler
df032a1bc2 obsolete: fix one-element tuple in module docstring 2014-04-19 20:12:53 +02:00
Martin Geisler
010f4026c6 obsolete: let N denote number of obsoleted changestes in a marker
The number of obsoleted changesets is referred to as N later in the
docstring.
2014-04-19 19:53:46 +02:00
Martin Geisler
3b1788aa56 obsolete: fix language and grammar in module docstring 2014-04-19 19:52:09 +02:00
Pierre-Yves David
f63734b94b bundle2: allow extensions to extend the getbundle request
We want extensions to be able to request extra parts.
2014-04-17 16:56:15 -04:00
Pierre-Yves David
bc1c360f82 bundle2: add a way to add parts during a getbundle request
We add a hook function to let extensions add parts to the bundle.
2014-04-17 17:32:34 -04:00
Pierre-Yves David
9761757d1d getbundle: pass arbitrary arguments all along the call chain
The wireprotocol command accepts arbitrary arguments, we are now passing such
arguments down the call chain.
2014-04-17 17:25:50 -04:00
Pierre-Yves David
3f4bc7b0ce bundle2: call a hook after the transaction is closed
We call a dedicated hook right after closing the transaction. This will let
people react to the transaction with all the information in hand. This hook is
experimental and will not survive in future versions.
2014-04-17 17:59:28 -04:00
Pierre-Yves David
e6db4922df bundle2: call a hook prior to closing the transaction
We call a dedicated hook right before closing the transaction. This will let
people abort unbundling with all the information in hand. This hook is
experimental and will not survive in future versions.
2014-04-17 17:21:39 -04:00
Pierre-Yves David
7bbaf30f57 bundle2: inform transaction that we are in a bundle2 unbundle
That way, hooks called during the unbundle process are aware that a bigger picture
is going on.
2014-04-17 17:16:21 -04:00
Pierre-Yves David
d9e2c653ca changegroup: use tr.hookargs when calling changegroup hooks
So that other parties using the transaction can put information in our hook
calls.
2014-04-17 17:46:26 -04:00
Pierre-Yves David
140d78d745 changegroup: use tr.hookargs when calling pretxnchangegroup hooks
So that other parties using the transaction can put information in our hook
calls.
2014-04-17 17:15:02 -04:00
Pierre-Yves David
1e7dd6937e addchangegroup: register data in tr.hookargs
We are registering data related to the process into the transaction hook data.
This lets other parties using the same transaction get informed of the
addchangegroup result.
2014-04-17 17:09:20 -04:00
Pierre-Yves David
18d2864e3c transaction: add a notion of hook arguments
It is now possible to register parameters to be used when invoking hooks in this
transaction. This will cope with the fact that bundle2 adds multiple data types
in a single transaction.

Do not expect any wide and consistent usages of this in the next release. This
will be used by bundle2 experiments first. It will be made better for the release
after.
2014-04-17 17:04:59 -04:00
Pierre-Yves David
1d48078897 bundle2: allow extensions to plug into the push process
Extensions are offered functions to add parts and process their results.
2014-04-17 16:54:15 -04:00
Pierre-Yves David
9ab32b965e bundle2: require both client and server to opt in
Even if the server is bundle2-enabled, the client now has to opt-in in the
config too.
2014-04-17 16:04:58 -04:00
Pierre-Yves David
953b10a36c bundle2: move bundle2 config option to section "experimental"
We highlight the fact that this is experimental by moving it to an "experimental"
section, and we match the config name with the server capability name
`bundle2-exp`.
2014-04-17 16:01:58 -04:00
Pierre-Yves David
fd614e4d04 bundle2: move all parts into a bx2 namespace
All currently core parts are moved to a `bx2` namespace (for "bundle 2
experimental"). This should avoid conflicts between the final stable
format and the one about to be released.
2014-04-17 15:45:12 -04:00
Pierre-Yves David
005c745f17 bundle2: rename server capability to bundle2-exp
For the same reason, we advertise this bundle2 implementation and format as
experimental. This will leave room for field testing in 3.0 but won't conflict
with a stable implementation in 3.1.
2014-04-17 15:33:17 -04:00
Pierre-Yves David
7e653a9c0f bundle2: use HG2X in the header
The current implementation of bundle2 is still very experimental and the 3.0
freeze is yesterday. The current bundle2 format has never been field-tested, so
we rename the header to HG2X. This leaves the HG20 header available for real
usage as a stable format in Mercurial 3.1.

We won't guarantee that future mercurial versions will keep supporting this
`HG2X` format.
2014-04-17 15:27:54 -04:00
Pierre-Yves David
8495126170 bundle2: transmit capabilities to getbundle during pull
Bundle2 capabilities of the client are sent to the server in the bundlecaps
argument of `getbundle`.
2014-04-17 02:01:38 -04:00
Pierre-Yves David
30d2504741 bundle2: include client capabilities in the pushed bundle
The necessary data is now included in the `replycaps` part.
2014-04-17 14:37:24 -04:00
Pierre-Yves David
9992968890 bundle2: advertise bundle2 caps in server capabilities
We can now retrieve them from the server during push. The capabilities are
encoded the same way as in `replycaps` part (with an extra layer of urlquoting
to escape separators).
2014-04-17 01:49:20 -04:00
Pierre-Yves David
0eec02877e bundle2: add bundle2caps dict on localrepo object
This dictionary will hold bundle2-related capabilities.
2014-04-17 01:50:28 -04:00
Pierre-Yves David
9bb9dc1703 bundle2: capabilities encoding 2014-04-17 01:44:53 -04:00
Pierre-Yves David
211041404c bundle2: extract capabilities decoding
We'll need to reuse this in more places (at least pull and push).
2014-04-17 01:09:05 -04:00
Pierre-Yves David
f2ead829c7 bundle2: protect capabilities name and values with url quoting
This lift limitations of the text based encoding.
2014-04-17 01:03:33 -04:00
Pierre-Yves David
f48478a77f bundle2: support for capabilities with values
The capabilities attributes of `bundle20` is now a dictionary and the reply caps
can encode capabilities with values.
2014-04-17 11:44:49 -04:00
Pierre-Yves David
b4784becd2 bundle2: add capabilities support in replycaps part
This part now contains a list of supported capabilities.
2014-04-17 11:32:30 -04:00
Pierre-Yves David
e273dad6f6 bundle2: adds a capabilities attribute on bundler20
This attribute conveys the capabilities supported by the destination of the
bundle. It is used to decide which parts to include in the bundle.

This is currently a set but will probably be turned into a dictionary to allow
capabilities with values.
2014-04-16 23:55:59 -04:00
Pierre-Yves David
1c2cd8594e bundle2: include stderr when capturing handlers output
We do not discriminate between stdout and stderr yet. But this will do for now.
2014-04-16 23:18:27 -04:00
Pierre-Yves David
2feab6f005 ui: pushbuffer can now also capture stderr
We need an easy way to capture both stderr and stdout during bundle2 processing
of a remote bundle. This changeset adds simple changes to the `ui` class to make
this possible.

I expect the interface to change in future releases as bundle2 will probably want to
distinguish stdout and stderr. The current change will, however, do for now.
2014-04-16 23:36:57 -04:00
Pierre-Yves David
53ffee95a2 bundle2: capture remote stdout while unbundling
When a reply is built, the bundle processing will capture the output of each
handler and sends it to the client in a dedicated part.

As a side effect, this add a "remote: " prefix to destination output on local
push. This is considered okay for now as:

1. bundle2 is still experimental,
2. Matt said he could be okay to change output for bundle2,
3. This keeps the implementation simple.

This changeset does it for stdout only. stderr will be done in a future changeset.
2014-04-16 14:22:24 -04:00
Pierre-Yves David
f7d4dc294b bundle2: introduce replycaps part for on-demand reply
The bundle2 processing does not create a bundle2 reply by default anymore.  It
is only done if the client requests it with a `replycaps` part. This part is
called `replycaps` as it will eventually contain data about which bundle2
capabilities are supported by the client.

We have to add a flag to the test command to control whether a reply is
generated or not.
2014-04-16 14:09:35 -04:00
Pierre-Yves David
88fa4f238f bundle2: use an official iterparts method to unbundle parts
Explicit is better than implicit.
2014-04-16 18:41:48 -04:00
Mads Kiilerich
5a1f9b25aa merge: with merge.preferancestor=*, run an auction with bids from ancestors
The basic idea is to do the merge planning with all the available ancestors,
consider the resulting actions as "bids", make an "auction" and
automatically pick the most favourable action for each file.

This implements the basic functionality and will only consider "keep" and
"get" actions. The heuristics for picking the best action can be tweaked later
on.

By default it will only pass ctx.ancestor as the single ancestor to
calculateupdates. The code path for merging with a single ancestor is not
changed.
2014-02-28 02:52:32 +01:00
Lucas Moscovicz
2794920df6 log: changed implementation to use graphlog code
Now that revsets work in a lazy way, log code can be changed to parse every
option into a revset and then evaluate it lazily.

Now expressions like

  "hg log -b default -b ."

are converted into a revset using the same code as graphlog.
2014-02-28 15:10:56 -08:00
Mads Kiilerich
cdb11ac02d context: introduce merge.preferancestor for controlling which ancestor to pick
Multiple revisions can be specified in merge.preferancestor, separated by
whitespace. First match wins.

This makes it possible to overrule the default of picking the common ancestor
with the lowest hash value among the "best" (introduced in f19507e1bcf2).

This can for instance help with some merges where the 'wrong' ancestor is used.
There will thus be some overlap between this and the problems that can be
solved with a future 'consensus merge'.

Mercurial will show a note like
  note: using 40663881a6dd as ancestor of 3b08d01b0ab5 and adfe50279922
        alternatively, use --config merge.preferancestor=0f6b37dbe527
when the option is available, listing all the alternative ancestors.
2014-02-24 22:42:14 +01:00
Mads Kiilerich
81feeb72af context: tell when .ancestor picks one of multiple common ancestors heads
Show a message like
  note: using 0f6b37dbe527 as ancestor of adfe50279922 and cf89f02107e5

So far this is just a warning - there is nothing the user can do to select
another ancestor.
2014-04-17 17:32:04 +02:00
FUJIWARA Katsunori
4ea3569fd2 hgweb: align entries in "changelog" and "revisions" pages of "spartan" style
Before this patch, each log entries in "changelog" and "revisions"
pages of "spartan" style are not aligned by column, because:

  - each log entries are separated "<table>" entries, and
  - there are no fixed "width" information for each "<th>"/"<td>" entries

This patch aligns entries in "changelog" and "revisions" pages of
"spartan" style by:

  - adding 'label' class to '<th>' for 'age' information, and
  - setting 'width' of '<th class="label">' with fixed size

'class="age"' is not used for this purpose, because it is also used to
set "bold" font-weight

"16em" seems to be wide enough to show date information fully, when
web browser disables (or doesn't support) javascript.
2014-04-17 09:36:09 +09:00
FUJIWARA Katsunori
350af37dc3 hgweb: show revisions and hashes gotten from changelog in "comparison" page
Before this patch, revision numbers and hash values in "comparison"
page are gotten from not changelog but filelog.

Such filelog information is useful only for hgweb debugging, and may
confuse users.

This patch shows revision numbers and hash values gotten from
changelog in "comparison" page.
2014-04-17 09:36:09 +09:00
FUJIWARA Katsunori
62dac3c633 hgweb: show as same parents as "hg parents -r REV FILE" in pages for file
Before this patch, "parents" in pages for file doesn't show as same
parents as "hg parents -r REV FILE", when the specified file is not
modified in the specified revision.

For example, it is assumed that revision A, B and D change file "f".

    changelog   (A) ---> (B) ---> (C) ---> (D)
    filelog "f" (x) ---> (y) ------------> (z)

"/file/D/f" invokes "webutil.parents()" with filectx(z) gotten from
changectx(D), and it returns changectx(B). This is as same result as
"hg parents -r D f".

In the other hand, "/file/C/f" invokes "webutil.parents()" with
filectx(y') gotten from changectx(C), and it returns changectx(A),
because filectx(y') is linked to changectx(B), and works like
filectx(y) in some cases.

In this case, revision B is hidden from users browsing file "f" in
revision C.

This patch shows as same parents as "hg parents -r REV FILE" in pages
for file, by making "webutil.parents()" return:

  - "linkrev()"-ed revision only, if:

    - specified context instance is "filectx" (because
      "webutil.parents()" is invoked with changectx, too), and

    - (1) the revision from which filectx is gotten and (2) the one to
      which filectx is linked are different from each other

  - revision gotten from "ctx.parents()", otherwise
2014-04-17 09:36:08 +09:00
FUJIWARA Katsunori
fc4364cead hgweb: make "comparison" get parent from not filelog but changelog
Before this patch, "comparison" shows unexpected result, when the
specified file is not modified in the specified revision, even though
"diff" shows empty result.

When REV doesn't change specified FILE, "diff" shows:

  "hg diff -c REV FILE"

but "comparison" shows:

  "hg diff -c `hg parents -r REV FILE` FILE"

In other words, the former gets parent from changelog, but the latter
gets one from filelog.

This may confuse users browsing (and switching "diff" and
"comparison" of) files in the specified revision.

This patch makes "comparison" get parent from not filelog but
changelog, to show "hg diff -c REV FILE" in both "diff" and
"comparison" pages.
2014-04-17 09:36:08 +09:00
FUJIWARA Katsunori
98201640e7 hgweb: fix lack of "bookmarks" link in "/file" page of "paper" style
This patch also fixes same problem of "coal" style, because it re-uses
"filerevision.tmpl" of "paper" style.

"gitweb" and "monoblue" styles don't have such problems.

"spartan" style doesn't have "bookmarks" page definition itself.
2014-04-17 09:36:08 +09:00
Aaron Jensen
2e9eed01a1 hgweb: adding article link to rss feed 2014-04-17 11:48:22 -07:00
Aaron Jensen
a849a70906 hgweb: adding branch names from inbranch template to rss feed 2014-04-17 11:47:49 -07:00
Aaron Jensen
4ecda29bda hgweb: adding branch names from inbranch template to atom feed 2014-04-17 11:45:43 -07:00
Matt Mackall
a34a093097 merge with stable 2014-07-09 12:30:12 -05:00
anatoly techtonik
1ed4ec4c3a version: show enabled extensions (issue4209)
This code is based by hg-versions extension (GPLv2)
by Markus Zapke-Gruendemann <info@keimlink.de>


http://mercurial.selenic.com/wiki/VersionsExtension
2014-06-10 13:44:37 +03:00
Ryan McElroy
2464893018 templater: introduce word function
This function allows returning only the nth "word" from a string. By default
a string is split as by Python's split() function default, but an optional
third parameter can also override what string the string is split by.
2014-06-12 18:02:23 -07:00
Sean Farley
6fe5bc8cca committablectx: move __contains__ into workingctx
This was mistakenly moved from workingctx to committablectx in
edbbc56a5e4f. Since the method is querying the dirstate, the only logical place
is for it to reside is in workingctx.
2014-07-03 23:01:37 -05:00
Sean Farley
274d2d46cf memctx: explicitly set substate to None
In 4c8873aad79a, memctx was changed to inherit from committablectx, this in
turn added the 'substate' property to memctx. It turns out that the
newcommitphase method tested for this property:

  def newcommitphase(ui, ctx):
      commitphase = phases.newcommitphase(ui)
      substate = getattr(ctx, "substate", None)
      if not substate:
          return commitphase

Currently, memctx isn't ready to handle substates, nor removed files, so we
explicitly must set substate=None to get the old behavior back. In the future,
we can decide how memctx should play with substate. For now, this fixes
third-party extensions and some internal code dealing with subrepos.
2014-07-02 15:24:43 -05:00
André Sintzoff
e960b46a33 util.h: declare dirstateTupleType variable instead of defining it
The definition is already in parsers.c

This patch avoids, at least on Mac OS X 10.6.8, build issue since 00dd020bc772
2014-07-03 19:05:04 +02:00
Sean Farley
5b08d55f04 memctx: add _manifest implementation that computes the filenode
This is an initial implementation of having a manifest for memctx that computes
the hash in the same way that filenodes are computed elsewhere.
2014-05-29 16:12:59 -05:00
Sean Farley
9f8a936835 basectx: pass raw context objects to patch.diff 2014-04-29 16:43:59 -05:00
Mads Kiilerich
eb39238a97 dirstate: report bad subdirectories as match.bad, not just a warning (BC)
This seems simpler and more correct.

The only test coverage for this is test-permissions.t when it says:
  dir: Permission denied
2013-10-03 18:01:21 +02:00
Mads Kiilerich
67a2ed988d dirstate: improve documentation and readability of match and ignore in the walker 2013-10-03 18:01:21 +02:00
Mads Kiilerich
c608411f0d context: remove redundant handling of match.bad return value
The 'bad' function is for reporting - it never returns anything.
2013-10-03 18:01:21 +02:00
Mads Kiilerich
3bb35d5e35 match: remove last traces of unused .missing callback 2013-10-03 18:01:21 +02:00
Mads Kiilerich
3811c637be match: _globre doctests 2014-04-13 22:00:08 +02:00
Mads Kiilerich
df98b5168a match: improve documentation - docstrings and more descriptive variable naming
No real changes.

pattern: 'kind:pat' as specified on the command line
patterns, pats: list of patterns
kind: 'path', 'glob' or 're' or ...
pat: string in the corresponding 'kind' format
kindpats: list of (kind, pat) tuples
2013-10-03 18:01:21 +02:00
Lucas Moscovicz
783ebe698d cmdutil: changed _makegraphlogrevset to _makelogrevset
This method will now be used to build both graphlog and log revset after this
series of patches.
2014-02-25 10:40:04 -08:00
Mads Kiilerich
cb0184290d revlog: backout 1c95c1863327 - commonancestors 2014-04-17 20:01:39 +02:00
Mads Kiilerich
2ffa0a82ac localrepo: use commonancestorsheads for checking linear heritage in file commit
If two revisions are linearly related, there will only be one ancestor, and
commonancestors and commonancestorsheads would give the same result.
commonancestorsheads is however slightly simpler, faster and more correct.
2014-04-17 20:01:39 +02:00
Mads Kiilerich
d2c13e7d3c backout: use commonancestorsheads for checking linear heritage
If two revisions are linearly related, there will only be one ancestor, and
commonancestors and commonancestorsheads would give the same result.
commonancestorsheads is however slightly simpler, faster and more correct.
2014-04-17 20:01:39 +02:00
Mads Kiilerich
1478c563ea revlog: introduce commonancestorsheads method
Very similar to commonancestors but giving all the common ancestors heads.
2014-04-17 20:01:35 +02:00
Mads Kiilerich
6ffb3587ef parsers: remove unnecessary gca variable in index_commonancestorsheads 2014-04-17 19:58:08 +02:00
Mads Kiilerich
b73865b95b parsers: introduce index_commonancestorsheads
This is an exact copy of index_ancestors but without the final "deepest"
pruning.
2014-02-24 22:42:14 +01:00
Mads Kiilerich
acc676f65f ancestors: extract candidates function as commonancestorsheads 2014-04-17 19:49:56 +02:00
Mads Kiilerich
638e3b7e24 filemerge: better handling of failing remove of temporary files
We have seen some failures on Windows that could seem like the unlinks of
temporary files were failing. That could perhaps be because the merge tool
somehow still held the files open.

Instead of the bare bone os.unlink, use our util.unlink with special
rename/retry handling on Windows.
2014-04-17 14:54:46 +02:00
FUJIWARA Katsunori
87f58fc092 obsolete: add '%' specifier to the format string to avoid TypeError at runtime
Mapping operation on the format string not including any '%'
specifiers causes TypeError at runtime.
2014-04-16 03:05:00 +09:00
Sean Farley
c813b41f60 patch: use ctx.node() instead of bare node variable
Future patches will allow patch.diff to take a basectx so node1 (and node2)
could make hexfunc error out. Instead, we'll call the node function on the
context object directly.
2013-08-14 13:10:27 -05:00
Matt Mackall
3fd77ddc42 merge with stable 2014-07-02 00:01:13 -05:00
Matt Mackall
8a748a627c dispatch: handle empty IOError args
We occasionally throw bare IOError objects (especially in convert),
don't choke on them.
2014-07-01 19:54:48 -05:00
Ryan McElroy
e3b09c4564 templater: add symbol to error
This patch makes it easier to debug writing templater functions by
telling the user exactly what was sent to the templater.
2014-06-12 18:07:21 -07:00
Ryan McElroy
f735b30979 templater: introduce startswith function
This function returns a string only if it starts with a given string.
It is particularly useful when combined with splitlines and/or used with
conditionals that fail when empty strings are passed in to take action
based on the contents of a line.
2014-06-12 17:53:37 -07:00
Ryan McElroy
9f5399cbcd templatefilter: add splitlines function
This is useful for applying changes to each line, and it's especially powerful
when used in conjunction with conditionals to modify lines based on content.
2014-06-12 17:45:41 -07:00
Yuya Nishihara
35e80dcc92 serve: tidy up indent level of repository not found message 2014-05-01 19:57:25 +09:00
Yuya Nishihara
2bdb976a60 serve: inline checkrepo() that is used only when --stdio is specified
Since 870f20f84f1a, --cmdserver is allowed to start without repository, so
checkrepo() function is meaningless.
2014-05-01 19:54:43 +09:00
Yuya Nishihara
5f56b9d6a6 serve: make sure to print "listening at" message immediately
If stdout is piped, status message won't be flushed until client connects to
the server and access log is written to stdout.  It seems bad idea to queue
start-up banner of server process.
2014-06-28 13:02:44 +09:00
Matt Mackall
73894d1463 merge with stable 2014-06-27 15:20:50 -07:00
Angel Ezquerra
621431257d tags: read tag info into a sorted dict (rather than into a regular dict)
This lets us preserve the original tag order (as specified on the .hgtags file
that is being read). This will be useful to preserve the tag order when saving
the result of a successful automated .hgtags merge (which will be introduced on
a future patch).

There shouldn't be much impact on performance because the sortdict that
_readtags returns is then used to update the alltags regular dict (which
remains a regular dict).
2014-02-23 03:13:21 +01:00
Angel Ezquerra
74f8eca049 config: move config.sortdict class into util
This makes it more natural to use the sortdict class from outside config.py.
2014-02-23 01:56:31 +01:00
Siddharth Agarwal
337e9e8db0 dirstate.status: assign members one by one instead of unpacking the tuple
With this patch, hg status and hg diff regain their previous speed.

The following tests are run against a working copy with over 270,000 files.
Here, 'before' means without this or the previous patch applied.

Note that in this case `hg perfstatus` isn't representative since it doesn't
take dirstate parsing time into account.

$ time hg status  # best of 5
before: 2.03s user 1.25s system 99% cpu 3.290 total
after:  2.01s user 1.25s system 99% cpu 3.261 total

$ time hg diff    # best of 5
before: 1.32s user 0.78s system 99% cpu 2.105 total
after:  1.27s user 0.79s system 99% cpu 2.066 total
2014-05-27 21:02:16 -07:00
Siddharth Agarwal
f40a94a790 parsers: inline fields of dirstate values in C version
Previously, while unpacking the dirstate we'd create 3-4 new CPython objects
for most dirstate values:

- the state is a single character string, which is pooled by CPython
- the mode is a new object if it isn't 0 due to being in the lookup set
- the size is a new object if it is greater than 255
- the mtime is a new object if it isn't -1 due to being in the lookup set
- the tuple to contain them all

In some cases such as regular hg status, we actually look at all the objects.
In other cases like hg add, hg status for a subdirectory, or hg status with the
third-party hgwatchman enabled, we look at almost none of the objects.

This patch eliminates most object creation in these cases by defining a custom
C struct that is exposed to Python with an interface similar to a tuple. Only
when tuple elements are actually requested are the respective objects created.

The gains, where they're expected, are significant. The following tests are run
against a working copy with over 270,000 files.

parse_dirstate becomes significantly faster:

$ hg perfdirstate
before: wall 0.186437 comb 0.180000 user 0.160000 sys 0.020000 (best of 35)
after:  wall 0.093158 comb 0.100000 user 0.090000 sys 0.010000 (best of 95)

and as a result, several commands benefit:

$ time hg status  # with hgwatchman enabled
before: 0.42s user 0.14s system 99% cpu 0.563 total
after:  0.34s user 0.12s system 99% cpu 0.471 total

$ time hg add new-file
before: 0.85s user 0.18s system 99% cpu 1.033 total
after:  0.76s user 0.17s system 99% cpu 0.931 total

There is a slight regression in regular status performance, but this is fixed
in an upcoming patch.
2014-05-27 14:27:41 -07:00
Siddharth Agarwal
64ffd83be6 dirstate: add dirstatetuple to create dirstate values
Upcoming patches will switch away from using Python tuples for dirstate values
in compiled builds.  Make that easier by introducing a variable called
dirstatetuple, currently set to tuple. In upcoming patches, this will be set to
an object from the parsers module.
2014-05-27 17:10:28 -07:00
Siddharth Agarwal
b0368f2bfe parsers: remove no longer used dirstate_unset 2014-05-27 15:22:23 -07:00
Siddharth Agarwal
a23ea931cf pack_dirstate: in C version, for invalidation set dict to what we write to disk
For files written out in the last second, Mercurial used to invalidate all the
stat data (state, size, mode, mtime) while persisting to disk. This included
invalidating the data in the dirstate dict as well.

In commit c7a2ac9361a7, this was found to be unnecessary, and Mercurial
switched to invalidating only the mtime. However, in the C version of
pack_dirstate the value set in the dict was still the fully invalidated one.

Switch to invalidating just the mtime in the dict as well.
2014-05-27 15:17:38 -07:00
Chinmay Joshi
b213bdb627 hg: update newly added listdir function of vfs in clone
This change invokes os.listdir() via newly added vfs function in clone.
2014-06-21 14:49:49 +05:30
Chinmay Joshi
23499031cc hg: use vfs functions in clone
This change applies vfs functions in clone. destvfs.exists will invoke
os.path.lexists via lexists of vfs to check for broken symbolic links.
2014-06-21 14:44:09 +05:30
Chinmay Joshi
79a112c77c hg: update util.writefile method to use write with vfs in share
This patch replaces util.writefile() to use destvfs.write().
2014-06-21 14:40:29 +05:30
Chinmay Joshi
25196ecc60 hg: update to use vfs functions in shared destination repository
This patch uses destvfs with base as .hg directory in shared destination
repository to update filesystem function with vfs. Some methods are changed to
use vfs functions with destvfs.

branch 'default' HG: bookmark '@' HG: changed mercurial/hg.py
2014-06-21 14:37:39 +05:30
Chinmay Joshi
e649f751d8 hg: use vfs functions in destination repository with share
In this patch, dstwvfs is added to use vfs functions in working directory of
destination shared repository. Existing filesystem operations are updated
to use vfs functions through dstwvfs.
2014-06-21 14:29:20 +05:30
Chinmay Joshi
0db86c64a5 vfs: add listdir for os.listdir in vfs
This patch adds listdir() in vfs to use os.listdir().
2014-06-20 21:18:14 +05:30
Augie Fackler
29ea24d6d3 templater: restore use of callable() since it was readded in Python 3.2 2014-06-23 09:24:56 -04:00
Augie Fackler
523e972164 hook: restore use of callable() since it was readded in Python 3.2 2014-06-23 09:24:38 -04:00
Augie Fackler
5b9ee2a71f help: restore use of callable() since it was readded in Python 3.2 2014-06-23 09:24:24 -04:00
Augie Fackler
d39e848921 extensions: restore use of callable() since it was readded in Python 3.2 2014-06-23 09:24:06 -04:00
Augie Fackler
bd7aa248d4 fancyopts: restore use of callable() since it was readded in Python 3.2 2014-06-23 09:24:16 -04:00
Stephen Lee
b831a97d01 diff: add nobinary config to suppress git-style binary diffs 2014-06-21 15:56:49 +10:00
Matt Mackall
9e74ea490c branchmap: don't use ui.warn for debug message 2014-06-23 13:50:44 -05:00
Matt Mackall
561e39d121 branch: add debug message for branch cache write failure 2014-06-23 13:46:42 -05:00
Gregory Szorc
21d0247021 commands: define inferrepo in command decorator 2014-05-04 22:22:59 -07:00
Gregory Szorc
aa3c5a1887 cmdutil: support inferrepo in command decorator 2014-05-04 22:20:00 -07:00
Gregory Szorc
0a46b331a5 commands: define optionalrepo in command decorator 2014-05-04 22:16:05 -07:00
Gregory Szorc
f5b841fd2e cmdutil: add optionalrepo argument to command decorator 2014-05-04 22:12:34 -07:00
Gregory Szorc
51b0c2ec81 commands: define norepo in command decorator 2014-05-04 20:57:01 -07:00
Gregory Szorc
a7f200b6b8 commands: add norepo argument to command decorator
Since decorators are evaluated at module load time and since the
@command decorator imports commands, the norepo variable (along with
its friends) may not be declared yet. These variables are now declared
before @command usage to ensure they are present.
2014-05-04 20:58:25 -07:00
Gregory Szorc
db0791767a cmdutil: better document command() 2014-05-04 18:45:04 -07:00
Matt Mackall
f3b0b8e4bb merge with stable 2014-06-18 20:59:36 -05:00
Matt Mackall
c3f187f7c4 bookmarks: improve the bookmark help (issue4244) 2014-06-18 15:26:07 -05:00
Matt Mackall
ff110a3353 merge with stable 2014-06-14 11:56:20 -05:00
Matt Mackall
f1d993bf16 merge with stable 2014-06-13 17:42:04 -05:00
Brendan Cully
84c737c817 error: restore python 2.4 compatibility for BundleValueError
Under python 2.4, this:
    super(BundleValueError, self).__init__(msg)
raises this:
    TypeError: super() argument 1 must be type, not classobj
2014-06-10 17:00:31 -07:00
Matt Mackall
36c70daf5c i18n: explicitly decode paragraphs
This was triggering an exception when the default encoding was disabled.
2014-06-12 14:40:45 -05:00
Matt Mackall
ceb82a6112 minirst: explicitly decode substitutions
Caught by Augie and sys.setdefaultencoding("undefined")
2014-06-13 14:14:02 -05:00
Pierre-Yves David
047a4db399 wireproto: rephrase the error message for unknown getbundle parameters
In case of an unknown parameter passed to ``getbundle``, the server prints a
message and ignores the parameter. This message was misleadingly prefixed with
"abort: ". The use of "abort: " here is clearly wrong as nothing is actually
aborted and the ``getbundle`` call proceeds without the parameter.

The message is now prefixed with "warning: " and rephrased to make it clearer
that the parameter was simply ignored.
2014-05-27 14:45:31 -07:00
Pierre-Yves David
52e1ca0858 status: document the content of the returned tuple in the docstring
The ``status`` function returns a lot of information. We document it.
2014-05-31 17:26:15 -07:00
Matt Mackall
140901211f resolve: fix grammar of no matching files message 2014-06-09 14:11:17 -05:00
Matt Mackall
3cb2ffc448 merge with stable 2014-06-09 13:53:23 -05:00
Yuya Nishihara
0215b66d65 workingctx: duplicate status list received at _poststatus hook
basectx.status may reorder the list after workingctx._poststatus is called,
so workingctx must copy it.  Otherwise, wctx.deleted() would return "unknown"
files, for example.
2014-05-31 21:21:06 +09:00
Chinmay Joshi
b97e831462 patch: replace functions in fsbackend to use vfs
Several functions in fsbackend are replaced to use vfs functions.
vfs operations are applied on filename and path is joined by _join().
2014-06-05 15:24:29 +05:30
Chinmay Joshi
ecc3ce679c vfs: add unlinkpath to vfs
This patch adds unlinkpath() function in vfs to replace util.unlinkpath().
2014-06-05 15:16:44 +05:30
FUJIWARA Katsunori
2b812d91a3 backout: accept '--edit' like other commands creating new changeset
After this patch, users can invoke editor for the commit message by
'--edit' option regardless of '--message'/'--logfile'.
2014-06-01 00:08:32 +09:00
Sean Farley
23ec6d1ff8 memfilectx: add a size method
This method is needed to have memfilectx behave like the other file
contexts. We can't just inherit this method because each file context has
different behavior: filectx reads from the filelog, and workingfilectx reads
from the disk. Therefore, we define memfilectx to return the size of the data
in memory.
2014-06-03 13:49:51 -07:00
Matt Mackall
ea918a9647 merge with stable 2014-06-01 16:01:01 -07:00
Matt Mackall
4bc583507d bundlerepo: backout 5d87516cc668
According to foozy:

This patch should be backed out, because "bundlename" and "bundle" in
this case are not relative paths to the root of repositories.

The former is specified via "hg incoming --bundle BUNDLENAME"
(relative path to cwd, or absolute one), and the latter is generated
in "changegroup.writebundle" by "tempfile.mkstemp" for internal
temporary usage (absolute path).

To be exact, the latter hunk in this patch can be applied, because
"os.join" for two absolute paths can generate correct result. But the
former hunk can't, because it may unexpected result, if specified path
is relative to cwd and cwd != root.
2014-05-30 11:53:10 -07:00
Pierre-Yves David
21bb02d08f merge: drop the quotes around commit description
We already have a ":" after the user name to denote the start of the
description. The current usage of quotes around the description is
problematic as the truncation to 80 chars is likely to drop the
closing quote. This may confuse syntax coloration in some editors.
2014-05-26 11:44:58 -07:00
Sean Farley
1757a6c91c memfilectx: remove path since it is now inherited 2013-08-15 15:47:15 -05:00
Sean Farley
48e74f2a7a memfilectx: remove __str__ since it is now inherited 2013-08-15 15:46:32 -05:00
Sean Farley
4c2ccc8f74 memfilectx: remove __nonzero__ since it is now inherited 2013-08-15 15:46:22 -05:00
Sean Farley
1002b6c612 memfilectx: call super.__init__ instead of duplicating code
This patch changes the calling signature of memfilectx's __init__ to fall in
line with the other file contexts.

Calling code and tests have been updated accordingly.
2013-08-15 16:49:27 -05:00
Sean Farley
ce51e4e299 memfilectx: inherit from committablefilectx
This patch marks the beginning of having memfilectx become a full-fledged file
contex so that we can handle diffing and merging.
2013-08-15 15:23:36 -05:00
Sean Farley
dab79b2875 memctx: remove parents since it is now inherited 2013-08-15 15:20:56 -05:00
Sean Farley
19ee0d9801 memctx: remove flags since it is now inherited
commitablectx has a much more robust implementation of flags() so we will use
that instead of just blindly calling the flags function for the given path.
2013-08-15 15:19:29 -05:00
Sean Farley
b313657e44 memctx: remove extra since it is now inherited 2013-08-15 15:17:05 -05:00
Sean Farley
c6c9260200 memctx: remove branch since it is now inherited 2013-08-15 15:14:47 -05:00
Sean Farley
5dad7e7445 memctx: remove clean since it is now inherited 2014-05-28 20:03:38 -05:00
Sean Farley
8901e63f4c memctx: remove ignored since it is now inherited 2014-05-28 20:03:29 -05:00
Sean Farley
72ed48fbf9 memctx: remove unknown since it is now inherited 2014-05-28 20:03:19 -05:00
Sean Farley
10ff60a8f2 memctx: remove deleted since it is now inherited 2013-08-15 15:13:14 -05:00
Sean Farley
06fb032978 memctx: remove removed since it is now inherited 2013-08-15 15:12:54 -05:00
Sean Farley
a5e383250e memctx: remove added since it is now inherited 2013-08-15 15:12:46 -05:00
Sean Farley
e1a50e2392 memctx: remove modified since it is now inherited 2013-08-15 15:12:31 -05:00
Sean Farley
3bb2b1b835 memctx: remove files since it is now inherited
This is a slight change in definition from memctx returning only modified() but
its parent's definition is more consistent with other contexts' behavior so we
can call this change a slight bugfix and step in the right direction.
2013-08-15 15:12:19 -05:00
Sean Farley
ff84134188 memctx: remove description since it is now inherited 2013-08-15 15:07:43 -05:00
Sean Farley
e20bb1e948 memctx: remove date since it is now inherited 2013-08-15 15:07:29 -05:00
Sean Farley
24ca8e9461 memctx: remove user since it is now inherited 2013-08-15 15:07:01 -05:00
Sean Farley
ef4723d1a0 memctx: remove p2 since it is now inherited 2013-08-15 15:06:39 -05:00
Sean Farley
ee101eac61 memctx: remove p1 since it is now inherited 2013-08-15 15:06:10 -05:00
Sean Farley
9609b1d01c memctx: remove __getitem__ since it is now inherited 2013-08-15 15:05:32 -05:00
Sean Farley
f9b7d78d04 memctx: remove __nonzero__ since it is now inherited 2013-08-15 15:04:55 -05:00
Sean Farley
4a1f5fc163 memctx: remove __int__ since it is now inherited 2013-08-15 15:04:36 -05:00
Sean Farley
a6facf0d7d memctx: remove __str__ since it is now inherited 2013-08-15 15:03:52 -05:00
Sean Farley
f37d45d609 memctx: call super.__init__ instead of duplicating code 2013-08-15 15:03:03 -05:00
Sean Farley
2b69f12f63 memctx: inherit from committablectx
This patch marks the start of having memctx inherit from committablectx,
thereby making it a full-fledged context that will eventually grow the ability
to perform diffing and also merging.
2013-08-15 15:00:03 -05:00
Sean Farley
f1efbc42f4 committablectx: fix _manifest doc string 2014-04-29 16:49:27 -05:00
Sean Farley
91eeee166f context: fix wrong indentation from renaming method 2014-05-29 16:09:16 -05:00
Pierre-Yves David
b483678287 push: use bundle2 to push phases when available
We now use a bundle2 container to push all phase updates at the same time. This
is a significant step forward, even if further refactoring is needed to unify
phase push with the changeset push.
2014-05-27 16:33:06 -07:00
Pierre-Yves David
c961ed1664 pushkey: add an `encode` function
This function is just a shorthand for ``encoding.fromlocal``. It will help
hiding the encoding business from other code exchanging pushkey data over the
wire.
2014-05-29 15:22:58 -07:00
Pierre-Yves David
f7baff1111 bundle2: add `pushkey` support
After ``listkeys`` we can now include ``pushkey`` request in a bundle2. The part
uses a very simple scheme closest as possible to the current wireproto command
for ``pushkey``. We may eventually decide for a more sophisticated part format
before the protocol becomes final.
2014-05-27 16:32:50 -07:00
Pierre-Yves David
97316a2345 pushkey: add a `decode` function
This function is just a shorthand for ``decoding.fromlocal``. It will help
hiding the encoding business from other code exchanging pushkey data over the
wire.
2014-05-29 15:23:25 -07:00
Pierre-Yves David
6a6d38b1b8 pull: when remote supports it, pull phase data alongside changesets
We use bundle2 to retrieve the remote phase data at the same time as
changesets. This reduces the amount of requestis and should improve consistency
as the server can ensure nothing changed between the retrieval of those parts.
2014-05-27 15:44:46 -07:00
Pierre-Yves David
deb72642b3 getbundle: support of listkeys argument when bundle2 is used
A new ``listkeys`` is supported by getbundle. It is a list of namespaces whose
content should be included in the bundle.

An appropriate entry has been added to the wireproto map of getbundle arguments
and a new bundle2 capability is advertised.

There are still no codes that request such parts in core mercurial.
2014-05-27 15:43:09 -07:00
Pierre-Yves David
a14e2297f0 getbundle: raise error if extra arguments are provided for bundle10
New arguments are most likely to be supported by bundle20 (and above) only.
2014-05-29 14:59:22 -07:00
Pierre-Yves David
c4d12e35a5 bundle: introduce a listkey handler
This makes it possible to handle listkeys-related data stored in a bundle2.
There are no producers yet.
2014-05-27 15:42:03 -07:00
Pierre-Yves David
57230c6e44 pull: split remote phases retrieval from actual application
We want to be able to retrieve phases information through bundle2. The logic to
apply remote phases will not change.
2014-05-27 15:29:08 -07:00
Pierre-Yves David
9ddf331cd4 wireproto: use pushkey.decodekey 2014-05-27 15:02:51 -07:00
Pierre-Yves David
1ff0f40ae5 pushkey: introduce an `decodekeys` function
This function provides a standardized way to exchange pushkey content over
the wire.
2014-05-27 15:00:20 -07:00
Pierre-Yves David
3b4a115178 wireproto: use pushkey.encodekey 2014-05-27 15:00:08 -07:00
Pierre-Yves David
80d71a6ab3 pushkey: introduce an `encodekeys` function
This function provides a standardized way to exchange pushkey content over
the wire.
2014-05-27 14:57:28 -07:00
Pierre-Yves David
95482f20ff getbundle: declare type of parameters
In addition to listing the expected options for ``getbundle``, we also list their
types and handle the encoding/decoding automatically. This should make it easier
for extensions to transmit additional information to getbundle.
2014-05-22 09:53:52 -07:00
Pierre-Yves David
8174979f47 bundle2: introduce a `caps20to10` function
This function factors the creation of appropriate entries to use in
``bundlecaps`` argument of ``getbundle``. This cleans up code calling
``getbundle`` and helps its usage in more part of the code.
2014-05-22 13:31:33 -07:00
Pierre-Yves David
c2721b6512 bundle2: introduce a bundle2caps function
The process of decoding remote bundle2caps blob into a dictionary is cumbersome.
We move it into a small helper function. This will clarify code that reads
bundle2 capabilities of peers and helps using it in new places.
2014-05-24 16:20:09 -07:00
Pierre-Yves David
ad6efcd2be exchange: reinsert comment in the right place
Unrelated new code was inserted between the original comment and the related
code block.
2014-05-22 12:58:07 -07:00
Matt Mackall
ba031d2d3b merge with stable 2014-05-29 15:41:16 -07:00
Pierre-Yves David
e60d3c1093 bundle2: raise BundleValueError error for stream level unsupported params
This ensures both consistency and smooth propagation over the wire.
2014-05-28 15:37:47 -07:00
Pierre-Yves David
ee9ac67c31 bundle2: support None parttype in BundleValueError
This will be used for errors at the stream level.
2014-05-28 16:46:58 -07:00
Pierre-Yves David
29c25aabd5 bundle2: ignore advisory part with unknown parameters
Advisory parts are advisory. If a handler exists but does not support the
proper parameters, we can safely ignore it.

Test has been updated to include this case.
2014-05-27 12:16:45 -07:00
Pierre-Yves David
da0446d1b9 bundle2: enforce all parameters in a part to be handled
Once we picked a handler, we check that all mandatory parameter keys are
properly supported. If not we raise an exception.

We added a test for this case.

The code now fails for any part with unknown mandatory parameters. We will
ignore such errors for advisory parts in a later changeset.
2014-05-27 12:01:00 -07:00
Pierre-Yves David
5b7edfc76e bundle2: declare supported parameters for all handlers
We now update all existing handlers with the supported parameters information.
2014-05-28 11:40:07 -07:00
Pierre-Yves David
3e4ee45f47 bundle2: make it possible to declare params handled by a part handler
If we are to enforce the mandatory aspect of parameter, we need a way to
discover what a handler supports. The best option we end up with is this a simple
declaration of known parameters at registration time.

We simply plug the list of parameters on the function object because Python lets
us do that and there is no benefit for a more complicated way.

One of the handlers is updated for example and testing.
2014-05-27 11:49:48 -07:00
Pierre-Yves David
1b80836a48 bundle2: support transmission of params error over the wire
We picked a null character to split each parameter during the transfer. This is
fragile if the same character is used in parameter name. However other
codes will already behave in a strange way in that case, so we are not
introducing any regression. A better format may be picked for the final
version of the protocol.
2014-05-28 15:57:23 -07:00
Pierre-Yves David
e625997ab5 bundle2: introduce a `params` attribute to BundleValueError
We'll first use it for unsupported mandatory parameters on parts.
2014-05-28 15:53:34 -07:00
Pierre-Yves David
72ac6a7248 bundle2: introduce a parttype attribute to BundleValueError
We will use the Exception for more that just unknown part type.
2014-05-28 15:51:19 -07:00
Pierre-Yves David
b5c6c1b880 bundle2: rename b2x:error:unknownpart to b2x:error:unsupportedcontent
This is a backward compatibility breakage per se. But bundle2 was explicitly
flagged as experimental, and this is one an error path anyway. So the worse
possible outcome from this change is to still have a crash but with a different
message.
2014-05-27 10:32:07 -07:00
Pierre-Yves David
d9f1652a77 bundle2: move exception classes into the error module
Exceptions should have known their place.
2014-05-28 15:31:05 -07:00
Pierre-Yves David
08bcb101f2 bundle2: rename UnknownPartError to BundleValueError
We are going to raise exceptions for a wider range of cases: unsupported
mandatory stream and part parameters.  We rename the exception with a wider
name.
2014-05-28 14:22:24 -07:00
Sean Farley
3692a2672f context: explicitly return a tuple
In the refactoring of removing localrepo.status, e283486177bd, we accidentally
changed the return type from a tuple to a list. Philosophically, this is
incorrect so we explicitly return a tuple again.
2014-05-27 17:04:48 -05:00