Commit Graph

22895 Commits

Author SHA1 Message Date
Ryan McElroy
365c7718eb amend: fix amending rename commit with diverged topologies (issue4405)
This addresses the bug described in issue4405: when obsolescence markers are
enabled, amending a commit with a file move can lead to the copy information
being lost.

However, the bug is more general and can be reproduced without obsmarkers as
well, as demonstracted by Pierre-Yves and put into the updated test.
Specifically, graph topology divergences between the filelogs and the changelog
can cause copy information to be lost during amends.
2014-10-16 06:35:06 -07:00
Augie Fackler
0e58e63b9c hgweb: disable SSLv3 serving (BC)
Because of recent attacks[0] on SSLv3, let's just drop support entirely.

0: http://googleonlinesecurity.blogspot.com/2014/10/this-poodle-bites-exploiting-ssl-30.html
2014-10-21 17:09:37 -04:00
Augie Fackler
e19e1a783c sslutil: only support TLS (BC)
In light of the POODLE[0] attack on SSLv3, let's just drop the ability to
use anything older than TLSv1 entirely.

This only fixes the client side. Another commit will fix the server
side. There are still a few SSLv[23] constants hiding in httpclient,
but I'll fix those separately upstream and import them when we're not
in a code freeze.


0: http://googleonlinesecurity.blogspot.com/2014/10/this-poodle-bites-exploiting-ssl-30.html
2014-10-21 17:01:23 -04:00
Mads Kiilerich
a195867192 eol: fix crash when handling removed files
ci --amend would in some cases fail after 2eef89bfd70d failed to refactor the
eol extension too.
2014-10-22 16:10:23 +02:00
Pierre-Yves David
ad1ec3399d bundle2: transmit exception during part generation
If an exception is raised during a bundle2 part payload generation it is now
recorded in the bundle. If such exception occurs, we capture it, transmit an
abort exception through the bundle, cleanly close the current part payload and
raise it again. This allow to generate valid bundle even in case of exception so
that the consumer does not wait forever for a dead producer. This also allow to
raise the exception during unbundling at the exact point it happened during
bundling make debugging easier.
2014-10-15 03:52:20 -07:00
Pierre-Yves David
38561c6027 bundle2: add a interrupt mechanism
It is now possible to emit a single part in the middle of a payload production.
This part will be processed with limitation (only access to a `ui` object). The
goal is to let the server raise exception and output while a part is being
processed. The source motivation is to transmit exception that occurs while
generating a part.

This change is was the motivation to bump the bundle2 format from HG2X to HG2Y.
Somehow, the format bump made it into 3.2 without it. So this change go on
stable. It is low risk as bundle2 is still disabled by default.
2014-10-14 10:47:47 -07:00
Durham Goode
fd796ba36d transactions: change backupfiles format to use newlines
Previously the journal.backupfiles file was delimited by \0. Now we delimit it
using \n (same as the journal file). This allows us to change the number of
values in each line more easily, rather than relying on the count of \0's.
2014-10-21 12:38:28 -07:00
Durham Goode
646f35dbec transactions: add version number to journal.backupfiles
The transaction format will be changing a bit over the next releases, so let's
go ahead and add a version number to make backwards compatibility easier. This
whole file format was broken prior to 3.2 (see previous patch), so changing it
now is pretty low risk.
2014-10-21 11:37:29 -07:00
Durham Goode
faf9d65282 transactions: fix hg recover with fncache backups
The transaction backupfiles logic was broken for 'hg recover'.  The file format
is XXX\0XXX\0YYY\0YYY\0 but the parser did a couple things wrong. 1) It went one
step beyond the final \0 and tried to read past the end of the array. 2)
array[i:i+1] returns a single item, instead of two items as intended.

Added a test to catch it, which turns out to be the first actual 'hg recover'
test.
2014-10-20 16:53:56 -07:00
Yuya Nishihara
bac0595bd4 revset: have rev() drop out-of-range or filtered rev explicitly (issue4396)
The recent optimization of "and" operation relies on the assumption that
the rhs set does not contain invalid revisions.  So rev() has to remove
invalid revisions.

This is still faster than using `.filter(lambda r: r == l)`.

revset #0: rev(25)
0) wall 0.026341 comb 0.020000 user 0.020000 sys 0.000000 (best of 113)
1) wall 0.000038 comb 0.000000 user 0.000000 sys 0.000000 (best of 66567)
2) wall 0.000062 comb 0.000000 user 0.000000 sys 0.000000 (best of 43699)
(0: 428fa22fb2d1^, 1: 3.2-rc, 2: this patch)
2014-10-19 16:48:33 +09:00
Matt Mackall
56b374dd4e revset: avoid recalculating filesets
This fixes a regression in ea41ca830940 that moved matcher building
into a callback, thus causing it be rebuilt for each revision matched
against.
2014-10-22 15:47:27 -05:00
FUJIWARA Katsunori
d10fadc61a tests: open file in binary mode to use POSIX end-of-line style anywhere
Before this patch, "test-context.py" fails on Windows environment,
because "diff" output contains unexpected "\r" character.

Opening the target file in text mode causes this automatic end-of-line
conversion.
2014-10-20 22:08:08 +09:00
FUJIWARA Katsunori
31d0ede415 tests: add "(glob)" for l10n messages in test-clone.t for Windows
This patch follows the style of other tests avoiding same kind of issue.
2014-10-20 22:08:08 +09:00
FUJIWARA Katsunori
7b2b4035f5 tests: add "(glob)" for l10n messages in test-largefiles-update.t for Windows
This patch follows the style of other tests avoiding same kind of issue.
2014-10-20 22:08:08 +09:00
FUJIWARA Katsunori
de521f3342 tests: add "(glob)" to paths in test-revset-outgoing.t for Windows 2014-10-20 22:08:08 +09:00
FUJIWARA Katsunori
d3fe25b2c7 tests: add "(glob)" to paths in test-hgrc.t for Windows 2014-10-20 22:08:08 +09:00
FUJIWARA Katsunori
94564038da tests: add "(glob)" to paths in test-url-rev.t for Windows 2014-10-20 22:08:08 +09:00
FUJIWARA Katsunori
ebfa67e64d tests: adjust expected prompt choice outputs in test-record.t for Windows
Changeset d735f8a82023 introduced "showing prompt choice if input is
not a tty but is forced to be interactive" and adjusted expected
output in test-record.t.

But some tests for no-execbit platform (= Windows) were not adjusted
by d735f8a82023.

This causes unexpected failure of test-record on Windows environment.

This patch adds below to prompt lines for such tests:

  - prompt choice at the end of prompt line, and
  - empty line after prompt line
2014-10-20 22:08:08 +09:00
Yuya Nishihara
df336dc3c8 ui: separate option to show prompt echo, enabled only in tests (issue4417)
The problem in commandserver was addressed by 766cfbe766dc, but it is tricky
to reuse ui.nontty option to disable echo back.  Instead, this patch introduces
new option to enable echoing of prompt response.

Prompt echoing is changed to be off by default, which should avoid possible
breakage of output parsing in user scripts.

For now, this option is undocumented because it exists for internal use.
2014-10-21 23:16:46 +09:00
Matt Mackall
30f4018132 Added signature for changeset 49471449798d 2014-10-18 18:14:48 -05:00
Matt Mackall
600a8a1715 merge with i18n 2014-10-18 18:05:10 -05:00
Pierre-Yves David
b3b7700935 hook: schedule run "b2x-transactionclose" for after lock release
Hooks that run after the transaction need to be able to touch the
repository. So we need to run them after the lock release. This is
similar to what the "changegroup" hook is doing in the
`addchangegroup` function.
2014-10-17 02:17:36 -07:00
Pierre-Yves David
2658f42db0 repoview: issue a special message when filtering hidden changesets
Hidden changesets are by far the most common error case and is the only one[1]
that can reach the user. We move to a friendlier message with a hint about how
to access the data anyway. We should probably point to a help topic instead but
we do not have such a topic yet.

Example of the new output

  abort: hidden revision '4'!
  (use --hidden to access hidden revisions)


[1] Actually, filtering from "served" can also reach the user during certain
exchange operations.
2014-10-17 15:25:32 -07:00
Pierre-Yves David
1dd313bfc1 repoview: include the filter name in filtered revision error messages
This will help user to debug. A more precise message will be issued
for the most common case ("visible" filter) in the next changesets.

example output:

  -  abort: filtered revision '4'!
  +  abort: filtered revision '4' (not in 'visible' subset)!
2014-10-17 15:54:43 -07:00
Mads Kiilerich
c50760a39b largefiles: inline redundant toname function in status
Simpler and an optimization.
2014-10-15 05:08:56 +02:00
Mads Kiilerich
10316e128d largefiles: inline redundant inctx function in status 2014-10-15 05:08:56 +02:00
Mads Kiilerich
489de2727b ssl: only use the dummy cert hack if using an Apple Python (issue4410)
The hack for using certificate store in addition to the provided CAs resides in
Apple's OpenSSL. Apple's own Pythons will use it, but other custom built
Pythons might use a custom built OpenSSL without that hack and will fail when
exposed to the dummy cacert introduced in ee8b7fe5e119.

There do not seem to be a simple way to check from Python if we are using a
patched OpenSSL or if it is an Apple OpenSSL.

Instead, check if the Python executable resides in /usr/bin/python* or in
/System/Library/Frameworks/Python.framework/ and assume that all Pythons found
there will be native Pythons using the patched OpenSSL.

Custom built Pythons will not get the benefit of using the CAs from the
certificate store.
2014-10-17 18:56:12 +02:00
Mads Kiilerich
fa9ed50a56 largefiles: move initialization of standins variable to clarify its "scope" 2014-10-15 05:08:56 +02:00
Mads Kiilerich
3aa19a07d3 largefiles: the update override only needs lfdirstate and status for --check 2014-10-15 05:08:56 +02:00
Alexander Sauta
9578fc17f5 i18n-ru: synchronized with bc20b710d0da 2014-10-13 14:46:50 +01:00
Mads Kiilerich
3b22bfee79 largefiles: remove confusing rev parameter for lfdirstatestatus
Dirstate only works on the repo wctx.
2014-10-03 00:42:40 +02:00
Mads Kiilerich
2518387f43 largefiles: replace repo._isaddremove hack with a simple function parameter 2014-10-03 00:42:40 +02:00
Martin von Zweigbergk
7eeee3a877 status: add more complete tests for --rev
The 'status --rev' code is not very well tested, which has bitten us
as recently as in issue4321. Let's add some more tests, some of which
uncover bugs. Remove the few existing tests that are now covered in a
more thorough and consistent way.
2014-10-12 22:23:43 -07:00
Yuya Nishihara
a9b00f4522 cmdserver: include pid of server handling requests in hello message
Because unix-mode server forks child process per connection, client does not
know the pid of the server that will handle requests.  The pid is necessary
to interrupt hung process:

 1. client connects to socket server
 2. server accepts the connection, forks, and tells pid
 3. client requests "runcommand pull"
    .. hung ..
 4. client sends SIGINT to the (forked) server
 5. server returns from I/O wait

Note that getsockopt(SO_PEERCRED) of Linux cannot be used because the server
fork()s after accept().
2014-10-18 12:24:50 +09:00
Yuya Nishihara
f15ba4e058 run-tests: clean up unused globals that were removed by tests-refactor series
They were demoted to instance variables by bd9cce5752d6, c59bb1e35f8c,
12bbe81716c1, b9b6ea3c673c, ac4e4d32cde4 and 7212772d393e.
2014-10-18 21:52:11 +09:00
Mads Kiilerich
b7b83cd1eb docker: use official centos5 image
I guess it didn't exist when centos5 support was introduced.
2014-10-16 17:44:37 +02:00
Mads Kiilerich
79c175d696 docker: add centos7 target for CentOS / Red Hat 7 support 2014-10-16 17:44:14 +02:00
Siddharth Agarwal
146e346b87 lock: while releasing, unlink lockfile even if the release function throws
Consider a hypothetical bug in the release function that causes it to raise an
exception. Also consider the bisect command, which saves its state in a finally
clause. Saving the state requires acquiring the wlock.

If we don't unlink the lockfile when the exception is thrown, we'll try to
acquire the wlock again. We're going to try and acquire a lock again while our
old lockfile is on disk. The PID on disk is our own, and of course we're still
running, so we won't take over the lock. Hence we'll be stuck waiting for a
lock that we left behind ourselves.

To avoid this, always unlink the lockfile. This preserves the invariant that
self.held > 0 is equivalent to the lockfile existing on disk.
2014-10-16 19:15:51 -07:00
Augie Fackler
69caabb3af i18n: cache the result of every gettext call
In looking at profiler output for 'hg log' on mozilla-central, I
noticed we spent a _huge_ amount of time in gettext relative to what
it's doing. Caching provides a roughly 15% performance improvement
even on repositories as small as hg.

== hg repo on linux ==

Before:
  %   cumulative      self
 time    seconds   seconds  name
  5.05      0.19      0.19  i18n.py:62:gettext
  4.84      0.18      0.18  revlog.py:88:decompress
  2.95      0.17      0.11  changelog.py:201:node
  2.32      0.09      0.09  ui.py:577:write
  2.11      0.08      0.08  i18n.py:72:gettext
  2.11      0.08      0.08  obsolete.py:196:_fm0readmarkers
  1.89      0.07      0.07  obsolete.py:569:_load
  1.68      0.63      0.06  localrepo.py:29:__get__

real	0m4.026s
user	0m3.993s
sys	0m0.034s

After:
  %   cumulative      self
 time    seconds   seconds  name
  8.05      0.26      0.26  revlog.py:88:decompress
  2.68      0.22      0.09  color.py:395:write
  2.20      0.07      0.07  obsolete.py:196:_fm0readmarkers
  1.95      0.06      0.06  obsolete.py:174:_fm0readmarkers
  1.95      0.06      0.06  ui.py:577:write
  1.95      0.06      0.06  util.py:1228:datestr
  1.71      0.06      0.06  utf_8.py:16:decode
  1.71      0.06      0.06  revlog.py:273:__len__

real	0m3.519s
user	0m3.447s
sys	0m0.073s


== mozilla-central repo on linux ==
Before:
  %   cumulative      self
 time    seconds   seconds  name
  7.72      2.35      2.35  revlog.py:88:decompress
  4.46      1.36      1.36  i18n.py:62:gettext
  2.22      0.67      0.67  i18n.py:72:gettext
  2.19      1.14      0.67  changelog.py:201:node
  2.16      0.66      0.66  ui.py:577:write
  1.96      0.60      0.60  utf_8.py:16:decode
  1.93      1.97      0.59  color.py:395:write
  1.85      0.81      0.56  changelog.py:136:tip

real	0m30.822s
user	0m30.660s
sys	0m0.149s

After:
  %   cumulative      self
 time    seconds   seconds  name
  9.82      2.49      2.49  revlog.py:88:decompress
  2.67      1.31      0.68  localrepo.py:29:__get__
  2.57      0.65      0.65  utf_8.py:16:decode
  2.48      1.01      0.63  changelog.py:201:node
  2.10      0.82      0.53  changelog.py:136:tip
  2.01      0.51      0.51  ui.py:577:write
  1.91      0.49      0.49  util.py:1232:datestr
  1.85      1.65      0.47  color.py:395:write

real	0m25.619s
user	0m25.446s
sys	0m0.166s

== cpython repo on os x =
Before:
  %   cumulative      self
 time    seconds   seconds  name
  5.05      1.35      1.35  cmdutil.py:982:_show
  4.59      1.22      1.22  revlog.py:274:__len__
  3.98      1.06      1.06  i18n.py:62:gettext
  3.91      1.04      1.04  revlog.py:1016:revision
  3.68      0.98      0.98  revlog.py:337:parents
  3.45      0.92      0.92  revlog.py:88:decompress
  2.91      0.78      0.78  revlog.py:309:rev
  2.62      0.70      0.70  revlog.py:1033:revision

real	0m30.414s
user	0m28.145s
sys	0m0.541s



After:
  %   cumulative      self
 time    seconds   seconds  name
  7.98      1.66      1.66  cmdutil.py:982:_show
  6.83      1.42      1.42  changelog.py:46:decodeextra
  5.18      1.08      1.08  revlog.py:274:__len__
  3.94      0.82      0.82  revlog.py:1016:revision
  3.41      0.71      0.71  revlog.py:309:rev
  3.32      0.69      0.69  revlog.py:88:decompress
  2.99      0.63      0.62  revlog.py:1033:revision
  2.69      0.56      0.56  revlog.py:341:start

real	0m22.811s
user	0m21.883s
sys	0m0.397s
2014-10-17 13:52:10 -04:00
Wagner Bruna
0be158ded2 i18n-pt_BR: minor fixes and rewording on histedit help text 2014-09-30 13:43:30 -03:00
Wagner Bruna
61b30f0d0e i18n-pt_BR: synchronized with d307c14fbf45 2014-09-30 10:17:59 -03:00
Wagner Bruna
60436bc97f merge with i18n 2014-09-30 10:13:25 -03:00
Anton Shestakov
1119de7215 hgweb: refresh hgweb.repo on phase change (issue4061)
Make hgweb.refresh() also look at phaseroots file (in addition to 00changelog.i
file) and reload the repo when os.stat returns different mtime or size than
cached, signifying the file was modified.

This way if user changes phase of a changeset (secret <-> draft), there's no
need to restart hg serve to see the change.
2014-09-27 21:59:55 +09:00
Matt Mackall
5f07bb0a47 help: fix typo in log examples 2014-09-29 16:42:12 -05:00
Wagner Bruna
e7e5f8b6c3 i18n-pt_BR: synchronized with 7bd2f92d9634 2014-09-22 15:39:21 -03: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
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