Commit Graph

22396 Commits

Author SHA1 Message Date
Yuya Nishihara
44811e417e test-commandserver: remove .py test which was ported to .t 2014-09-28 16:55:14 +09:00
Yuya Nishihara
60e5066f88 test-commandserver: port test functions from .py to .t
Though we have to duplicate import statements, .t test is still more handy
than .py test which has cryptic .out file.

This change allows to skip a part of test by #if conditional, which my next
patch series depends on.
2014-09-28 16:05:37 +09:00
Yuya Nishihara
bd1f3e4e18 test-commandserver: add stub for .t test by copying .out with 2-space indent
Currently test-commandserver.t only contains output, so it is skipped by
#require false.
2014-09-28 14:27:40 +09:00
Yuya Nishihara
1d33f9598f test-commandserver: split helper functions to new hgclient module
This prepares for porting test-commandserver.py to .t test.

Though command-server test needs many Python codes, .t test will be more
readable than .py test thanks to inlined output.
2014-09-28 13:31:16 +09:00
Yuya Nishihara
7c09e032d1 heredoctest: do not append extra newline character to continuation line
Trailing newline characters are kept in lines.
2014-09-28 15:13:35 +09:00
Yuya Nishihara
c82190e72c heredoctest: use the same dict for local/global contexts as in doctest
In order to mimic module-level evaluation, globals and locals should be the
same object, so doctest does not pass separate locals dict.

https://docs.python.org/2.7/reference/simple_stmts.html#exec

This fixes NameError in the following example:

    >>> import foo
    >>> def bar():
    ...     foo  # must exist in globalvars
2014-09-28 14:15:43 +09:00
Yuya Nishihara
27aa215891 cmdserver: drop useless in_ attribute from channeledoutput
The previous patch makes sure that in_ == out, so it's no longer needed
to keep in_ for __getattr__.  Also, it seems strange for channeledoutput
to have in_ stream which is actually a writable file object.
2014-09-27 12:37:53 +09:00
Yuya Nishihara
99d8be652a cmdserver: get file attributes of 'e'-channel from stdout, not from stderr
It seems wrong to get attributes from object different than the underlying
file.  In the following example, it doesn't make sense to flush stderr after
writing to stdout:

    self.ferr.write(str(a))
    if not getattr(self.ferr, 'closed', False):
        self.ferr.flush()
2014-09-27 12:27:03 +09:00
Yuya Nishihara
2e0a7a3cee cmdserver: correct doc of channeledoutput
in_ is only used as the source of file attributes.
2014-09-27 12:15:01 +09:00
Matt Mackall
dd1fdce87e merge with stable 2014-09-27 14:47:52 -05:00
Matt Mackall
e3f89597c5 commands: add debuglocks to report/clear lock state 2014-09-26 16:44:11 -05:00
Siddharth Agarwal
731b532719 test-convert-git.t: make copy detection deterministic
Since both 'bar' and 'bar-copied' matched 'bar-copied2', Git's copy detection
would sometimes result in 'bar' being the source for 'bar-copied2' and
sometimes 'bar-copied'. Change bar in a separate commit so that that would no
longer be the case.
2014-09-24 11:20:35 -07:00
Pierre-Yves David
e1494119f1 revsetbenchmark: add a rebase-related revset to the benchmark list 2014-09-23 17:12:27 -07:00
Pierre-Yves David
a74e4ee649 revsetbenchmark: allow comments ('#' prefix) in the revset input 2014-09-23 17:09:19 -07:00
Pierre-Yves David
250b8754d7 revsetbenchmark: make it clear that revsets may be read from stdin 2014-09-23 17:08:49 -07:00
Anton Shestakov
20c415845d hgweb: fail if an invalid command was supplied in url path (issue4071)
Traditionally, the way to specify a command for hgweb was to use url query
arguments (e.g. "?cmd=batch"). If the command is unknown to hgweb, it gives an
error (e.g. "400 no such method: badcmd").

But there's also another way to specify a command: as a url path fragment (e.g.
"/graph"). Before, hgweb was made forgiving (looks like it was made in
cd356f4efd91) and user could put any unknown command in the url. If hgweb
couldn't understand it, it would just silently fall back to the default
command, which depends on the actual style (e.g. for paper it's shortlog, for
monoblue it's summary). This was inconsistent and was breaking some tools that
rely on http status codes (as noted in the issue4071). So this patch changes
that behavior to the more consistent one, i.e. hgweb will now return "400 no
such method: badcmd".

So if some tool was relying on having an invalid command return http status
code 200 and also have some information, then it will stop working. That is, if
somebody typed foobar when they really meant shortlog (and the user was lucky
enough to choose a style where the default command is shortlog too), that fact
will now be revealed.

Code-wise, the changed if block is only relevant when there's no "?cmd" query
parameter (i.e. only when command is specified as a url path fragment), and
looks like the removed else branch was there only for falling back to default
command. With that removed, the rest of the code works as expected: it looks at
the command, and if it's not known, raises a proper ErrorResponse exception
with an appropriate message.

Evidently, there were no tests that required the old behavior. But, frankly, I
don't know any way to tell if anyone actually exploited such forgiving behavior
in some in-house tool.
2014-09-22 23:46:38 +09:00
Mike Hommey
d177b1d78f keepalive: fix how md5 is used
The code in keepalive dates from when it was importing the md5 module directly
and uses md5.new. Since then, what 'md5' means has been changed from an import
of the md5 module to being a function using the right module between hashlib
and md5, so the md5.new idiom doesn't work anymore.
2014-09-24 15:52:40 +09:00
Yuya Nishihara
679696a5fe tags: use full hash for formatter output as in log or annotate commands 2014-09-21 12:50:48 +09:00
Yuya Nishihara
b70e3d719f tags: change field name of formatter output to be the same as log command
Since -T option is not public yet, this won't break backward compatibility.
2014-09-21 12:46:23 +09:00
Yuya Nishihara
40faa84ff9 files: correct topic of formatter 2014-09-21 12:38:47 +09:00
Durham Goode
2b47ffae5c revert: move targetsubs calculation down to its use
A future patch will be reorganizing this section of the code into two paths, and
targetsubs complicates this by existing in the middle of one path, but not the
other. We fix that by moving it 200 lines down, to the only place it's used.
2014-09-19 18:40:39 -07:00
Augie Fackler
b9ffc43057 help: document that default hgweb style is called paper (issue4373) 2014-09-23 14:20:08 -04:00
Arun Chandrasekaran
15ec7856da help: update help for hgweb template and style (issue4373) 2014-09-20 14:16:39 -07:00
Mike Hommey
d553e368f9 bundle2: rename functions that have the same name 2014-09-23 16:22:52 +09:00
Mads Kiilerich
4d34e988b1 mq: write headers of new patches using patchheader 2014-09-20 17:06:57 +02:00
Mads Kiilerich
44bd94dc4e mq: refactor patchheader header ordering to match export (BC)
The refactoring also gives more robust and extendable handling of other HG
headers.
2014-09-24 02:41:11 +02:00
Mads Kiilerich
67c67bcdbe mq: upgrade non-plain patches to HG format when setting parent in patchheader
Parent will now always be updated or added when qrefreshing HG patches. Plain
patches will not be changed, but patches that neither are plain nor HG will be
upgraded to HG patches on first refresh.
2014-09-20 17:06:57 +02:00
Mads Kiilerich
a82df81b22 mq: make patchheader .plainmode more reliable
Instead of having to make extra checks whenever we use .plainmode, let the
initial value consider the actual patch header content.
2014-09-20 17:06:56 +02:00
Mike Hommey
518979521d bundle2: remove heads and common arguments to getbundle parts generators 2014-09-24 21:50:03 -07:00
Mike Hommey
4f54b8d62e bundle2: separate bundle10 and bundle2 cases in getbundle()
The primary goal is to make it easier for extensions to alter how bundle2
parts are laid out. They now can use the getbundle2partsgenerator decorator
to add new parts, or directly act on getbundle2partsmapping to wrap existing
part functions.

Note the 'request for bundle10 must include changegroup' error was kept
under the same conditions as before, although the logic changes don't make
it obvious.
2014-09-25 11:47:57 +09:00
Mike Hommey
8fdbd0d4df bundle2: pass b2caps down to functions adding bundle2 parts for getbundle 2014-09-25 11:11:37 +09:00
David Soria Parra
4a8632512f parsers: fix uninitialize variable warning
The heads pointer is not initialized correctly if filter is false, causing
both clang and gcc to issue a warning. Correctly initialize heads to NULL.
2014-09-24 13:16:20 -07:00
Pierre-Yves David
a7bd255d53 revset: use subset & in bare p2()
This takes advantage of the `fullreposet` smartness with a nice
speedup. It's a similar speedup to `p1()` when a merge is in progress
(the non merge case is already lightning fast anyway.)
2014-09-17 11:00:03 -07:00
Pierre-Yves David
85eb5c83a9 revset: use subset & in bare p1()
This takes advantage of the `fullreposet` smartness and yields a nice
speedup.

revset #0: p1()
0) wall 0.003256 comb 0.010000 user 0.010000 sys 0.000000 (best of 527)
1) wall 0.000066 comb 0.000000 user 0.000000 sys 0.000000 (best of 23224)
2014-09-17 10:59:52 -07:00
Pierre-Yves David
8cb4d64b32 revset: use subset & in rev
This takes advantage of the `fullreposet` smartness and yields a nice
speedup.

revset #0: rev(25)
0) wall 0.005480 comb 0.000000 user 0.000000 sys 0.000000 (best of 305)
1) wall 0.000052 comb 0.000000 user 0.000000 sys 0.000000 (best of 21891)
2014-09-17 11:00:09 -07:00
Pierre-Yves David
375f152fed revset: use subset & in origin
This takes advantage of the `fullreposet` smartness.

revset #0: origin(tip)
0) wall 0.005353 comb 0.000000 user 0.000000 sys 0.000000 (best of 354)
1) wall 0.003080 comb 0.000000 user 0.000000 sys 0.000000 (best of 446)
2014-09-17 19:52:34 -07:00
Pierre-Yves David
fe68969345 revset: use subset & in follow
This takes advantage of the `fullreposet` smartness.


revset #0: follow(COPYING)
0) wall 0.002446 comb 0.000000 user 0.000000 sys 0.000000 (best of 735)
1) wall 0.000331 comb 0.000000 user 0.000000 sys 0.000000 (best of 5672)
2014-09-17 10:59:16 -07:00
Pierre-Yves David
a3297e9a12 revset: use subset & in filelog
This takes advantage of the `fullreposet` smartness.

revset #0: file(COPYING)
0) wall 3.179066 comb 3.180000 user 3.140000 sys 0.040000 (best of 3)
1) wall 2.723699 comb 2.730000 user 2.690000 sys 0.040000 (best of 4)
2014-09-17 10:58:50 -07:00
Pierre-Yves David
244ffda42c revset: use subset & in divergent
This takes advantage of the `fullreposet` smartness.

revset #0: divergent()
0) wall 0.002047 comb 0.000000 user 0.000000 sys 0.000000 (best of 813)
1) wall 0.000052 comb 0.000000 user 0.000000 sys 0.000000 (best of 22757)
2014-09-17 10:58:39 -07:00
Pierre-Yves David
4cc5660e43 revset: use subset & in bisect
This takes advantage of the `fullreposet` smartness.

revset #0: bisect(range)
0) wall 0.014007 comb 0.010000 user 0.010000 sys 0.000000 (best of 115)
1) wall 0.005556 comb 0.010000 user 0.010000 sys 0.000000 (best of 235)
2014-09-17 10:57:57 -07:00
Pierre-Yves David
35c1eba9e6 revset: use subset & in ancestorspec
This takes advantage of the `fullreposet` smartness.


revset #0: tip~25
0) wall 0.004800 comb 0.010000 user 0.010000 sys 0.000000 (best of 259)
1) wall 0.002475 comb 0.000000 user 0.000000 sys 0.000000 (best of 717)
2014-09-17 10:57:47 -07:00
Pierre-Yves David
25b1e1b399 revset: use subset & in bookmark
Speedup, Weeeeeee!

revset #0: bookmark()
0) wall 0.002240 comb 0.000000 user 0.000000 sys 0.000000 (best of 571)
1) wall 0.000132 comb 0.000000 user 0.000000 sys 0.000000 (best of 14059)
2014-09-17 19:57:09 -07:00
Pierre-Yves David
cefa7eaabc revset: use subset & in outgoing
This should give us the same benefit as elsewhere. Result is simpler (and
"faster").

Outgoing is dominated by the discovery so no benchmark is provided.
2014-09-17 10:59:40 -07:00
Pierre-Yves David
d0e7545de8 revset: add an optimised baseset.__contains__ (issue4371)
The baseset class is based on a python list. This means that base.__contains__
was absolutely as crappy as list.__contains__. We now rely on __contains__ from
the underlying set.

This will avoid having to explicitly convert the baseset to a set (using
baseset.set()) whenever one want fast membership test.

Apparently there is already code that forgot to do such conversions since we
observe a massive speedup in some test.

revset #25: roots((0::) - (0::tip))
0) wall 2.079454 comb 2.080000 user 2.080000 sys 0.000000 (best of 5)
1) wall 0.132970 comb 0.130000 user 0.130000 sys 0.000000 (best of 65)

No regression is observed in benchmarks.

This change improve the issue4371 back to acceptable situation (but are still
slower than manual substraction)
2014-09-16 23:59:29 -07:00
Matt Mackall
2f833205d7 help: mention mode in hg log --removed help (issue4381) 2014-09-21 10:31:34 -05:00
Matt Mackall
4afe2f8b38 commit: catch changed exec bit on files from p1 (issue4382) 2014-09-21 10:07:06 -05:00
FUJIWARA Katsunori
d8d8f99761 mq: examine "pushable" of already applied patch correctly
Before this patch, "hg qselect" with --pop/--reapply may pop patches
unexpectedly, even when all of patches applied before "qselect" are
still pushable.

Strictly speaking about the condition of this issue:

  - before "qselect"
    - there are N applied patches
    - the index of the guarded patch X in the series is less than N

  - after "qselect"
    - X is still guarded, and
    - all of applied patched are still pushable

In the case above, "hg qselect" should keep current status, but it
actually tries to pop patches because of X.

The index in "the series" should be used to examine "pushable" of a
patch by "mq.pushablek()", but the index in "applied patches" is used,
and this may cause unexpected examination of guarded patch.

To examine "pushable" of already applied patch correctly, this patch
uses "mq.applied[i].name": "pushable" is the function introduced by
the previous patch, and it returns "mq.pushable(mq.applied[i].name)[0]".
2014-09-12 02:29:19 +09:00
FUJIWARA Katsunori
396a8e0831 mq: pop correct patches when changing pushable-ness of already applied ones
Before this patch, "hg qselect" with --pop/--reapply may pop incorrect
patches, because the index in "applied patches" is used to pop patches
by "mq.pop()", even though the index in "the series" should be used.

For example, when the already applied patch becomes guarded and it
follows the already guarded (= not yet applied) one, "hg qselect" is
aborted, because it tries to pop to guarded one.

This patch uses "mq.applied[i - 1].name" to pop to the patch, of which
the index in the "applied ones" is "i - 1".
2014-09-12 02:29:19 +09:00
FUJIWARA Katsunori
3efcc894d8 mq: use "mq.applied[i].name" instead of "mq.appliedname(i)" for safety
Before this patch, "hg qselect --reapply" is aborted when "--verbose"
is specified, because "mq.appliedname()" returns "INDEX PATCHNAME"
instead of "PATCHNAME" in such case and "mq.push" can't accept the
former as the name of patch.

This patch uses "mq.applied[i].name" instead of "mq.appliedname(i)" as
the name of the patch to be pushed for safety.

Now, there is no code path using "mq.appliedname()", and it should be
removed to prevent developers from using it in the wrong way like this
issue.
2014-09-12 02:29:19 +09:00
FUJIWARA Katsunori
5e22c34bd1 mq: report correct numbers for changing "number of guarded, applied patches"
Before this patch, "hg qselect" may report incorrect numbers for
"number of guarded, applied patches has changed", because it examines
"pushable" of patches by the index not in "the series" but in "applied
patches", even though "mq.pushable()" expects the former.

To report correct numbers for changing "number of guarded, applied
patches", this patch uses the name of applied patch to examine
pushable-ness of it.

This patch also changes the result of existing "hg qselect" tests,
because they doesn't change pushable-ness of already applied patches.

This patch assumes that "hg qselect" focuses on changing pushable-ness
only of already applied patches, because:

  - the report message uses not "previous" (in the series) but
    "applied"

  - the logic to pop patches for --pop/--reapply examines
    pushable-ness only of already applied ones (in fact, there are
    some incorrect code paths)
2014-09-12 02:29:19 +09:00