Commit Graph

18985 Commits

Author SHA1 Message Date
Bryan O'Sullivan
fb050f23a7 repoview: remove more unreachable code
Found using Cython.
2013-04-12 17:25:27 -07:00
Bryan O'Sullivan
426c898bd2 pvec: use the correct name for an identifier
Found using Cython.
2013-04-12 17:20:09 -07:00
Bryan O'Sullivan
273ac980e4 pvec: use the correct name for an identifier
Found using Cython.
2013-04-12 17:20:09 -07:00
Bryan O'Sullivan
f489c0d0c1 repoview: remove unreachable code
Found using Cython.
2013-04-12 17:18:52 -07:00
Bryan O'Sullivan
6bdbf1a461 repoview: remove unreachable code
Found using Cython.
2013-04-12 17:18:52 -07:00
Bryan O'Sullivan
855ee49f38 mail: add missing import of sys
Found using Cython.
2013-04-12 17:17:35 -07:00
Bryan O'Sullivan
e689a5b672 statichttprepo: add missing import of os
Found using Cython.
2013-04-12 17:17:05 -07:00
Bryan O'Sullivan
7fb4e0bf12 worker: add missing import of errno
Found using Cython.
2013-04-12 17:16:37 -07:00
Bryan O'Sullivan
434777d4af histedit: support editing of the first commit (issue3767) 2013-04-12 16:01:18 -07:00
Augie Fackler
bd9e548151 test-commit-amend.t: fix check-code violation from ea36fbf3d5c3 2013-04-12 17:00:42 -04:00
Mads Kiilerich
c7ab477d55 util: improve doc for checkcase 2013-02-11 00:43:12 +01:00
Mads Kiilerich
c7d556777b scheme: don't crash on invalid URLs 2013-04-11 14:41:22 +02:00
Brodie Rao
3d16726725 amend: support amending merge changesets (issue3778) 2013-02-08 21:08:34 +00:00
Bryan O'Sullivan
c538c00399 worker: catch all exceptions, try to exit usefully/safely 2013-04-11 13:30:31 -07:00
Bryan O'Sullivan
7d3941d67f lock: if we fork, ensure that only the parent releases
This prevents us from having a bunch of errant worker processes all try
to release a lock if a problem occurs. (Releasing the lock more than once
is harmless; it's invoking the associated callbacks we want to avoid.)
2013-04-11 13:30:27 -07:00
Mads Kiilerich
c0e7f36590 tag: clarify cryptic error message when tagging null revision 2013-04-11 14:44:22 +02:00
Mads Kiilerich
af3a71e28b setup: make error message for missing Python headers more helpful 2013-04-12 16:55:34 -04:00
Pierre-Yves David
a256234df3 obsolete: ensure all markers have a date
Obsolescence creates a sparse DAG mostly composed of a lot of small independent
chain of markers. Date is the only simple and "reliable" way to sort them. The
existence of a date is now enforced at creation time as I'm more and more
convinced that date will have a key role in obsolescence markers exchange.
2013-02-11 11:20:12 +01:00
Nikolaj Sjujskij
5b84a8b846 zsh_completion: make use of debuglabelcomplete command
Use `debuglabelcomplete` command when populating labels list, instead of
calling `hg` three times: for branches, bookmarks and tags. Do not pass string
being completed to `hg debuglabelcomplete` (as `$words[$CURRENT]`), since it
breaks `_hg_revrange` completion (`--rev 2.5:2.5.<Tab>`) for no apparent
benefit.
Also complete `hg view` with labels, not just tags, and drop unused `_hg_tags`.
2013-04-08 16:51:38 +04:00
Bryan O'Sullivan
562cfc4b72 dirs: use mutable strings internally
perfdirs results for a working dir with 170,000 files:
  Python     638 msec
  C          244
  C+int      192
  C+int+str  168

In the large repo above, the nearly 0.5 second time improvement is
visible in commands like "hg add" and "hg update".

hg add
  Python    1100 msec
  C+int+str  600

hg update (with nothing to do)
  Python    2800 msec
  C+int+str 2240
2013-04-10 15:08:28 -07:00
Bryan O'Sullivan
601384a79a dirs: use mutable integers internally
These integers are not visible to Python code, so this is safe.

perfdirs results for a working dir with 170,000 files:
  Python     638 msec
  C          244
  C+int      192
2013-04-10 15:08:27 -07:00
Bryan O'Sullivan
8f78d582d5 scmutil: rewrite dirs in C, use if available
This is over twice as fast as the Python dirs code. Upcoming changes
will nearly double its speed again.

perfdirs results for a working dir with 170,000 files:
  Python     638 msec
  C          244
2013-04-10 15:08:27 -07:00
Bryan O'Sullivan
4a4a5dde94 scmutil: use new dirs class in dirstate and context
The multiset-of-directories code was open coded in each of these
modules; this change gets rid of the duplication.
2013-04-10 15:08:26 -07:00
Bryan O'Sullivan
c1db508ee8 scmutil: add a dirs class
This encapsulates the "multiset of directories" structures that are
currently open-coded (and duplicated) in both the dirstate and
context modules.

This will be used, and optionally replaced by a C implementation,
in upcoming changes.
2013-04-10 15:08:26 -07:00
Bryan O'Sullivan
00ff38c9c3 scmutil: migrate finddirs from dirstate 2013-04-10 15:08:25 -07:00
Bryan O'Sullivan
283083ca12 merge 2013-04-10 15:05:06 -07:00
Siddharth Agarwal
559322b2a6 manifestmerge: handle workdir removed, remote removed with flags
This can happen when a file with flags is removed or deleted in the working
directory and also not present in m2. The obvious solution is to add a
__delitem__ override to manifestdict that removes the file from flags if
necessary, but that has a significant performance cost in some cases, e.g.
hg status --rev rev1 --rev rev2 <file>.
2013-04-10 12:34:42 -07:00
Siddharth Agarwal
663e918bc2 dicthelpers.diff: compare against default for missing values
This is not only a bit faster, but also aligns with callers' expectations
better since we can legitimately have manifestdict's _flags set to '' instead
of unset.

hg perfmergecalculate -r .
before: ! wall 0.139582 comb 0.140000 user 0.140000 sys 0.000000 (best of 59)
after:  ! wall 0.126154 comb 0.120000 user 0.120000 sys 0.000000 (best of 74)

hg perfmergecalculate -r .^
before: ! wall 0.236333 comb 0.240000 user 0.240000 sys 0.000000 (best of 36)
after:  ! wall 0.212265 comb 0.210000 user 0.210000 sys 0.000000 (best of 45)
2013-04-10 12:31:07 -07:00
Brendan Cully
6bf5800d14 templater: back out 0da42d2ff029, it breaks schemes ({1}) 2013-04-09 21:38:08 -07:00
Bryan O'Sullivan
738dd167db debuglabelcomplete: compute active branch heads correctly
The previous computation was simply wrong.
2013-04-09 09:40:40 -07:00
Matt Mackall
d7eb3b4a51 merge with i18n
Note: i18n work should normally be done on stable
2013-04-08 17:57:42 -05:00
Bryan O'Sullivan
7c51d9d3e5 templater: fix check-code error 2013-04-08 15:04:17 -07:00
Stefano Tortarolo
681c36b6d1 hg-i18n-it: minor fixes 2013-04-05 17:04:37 +02:00
Matt Mackall
5449719a55 merge with stable 2013-04-01 15:19:16 -05:00
Nikolaj Sjujskij
88b3e1a958 zsh_completion: fix trailing carriage return spoiling tag completion
This was giving the following error:

 % hg up 2.5-r<Tab>
 (eval):1: bad substitution
 % hg up 2.5-r
2013-03-29 18:45:07 -07:00
Matt Mackall
2ad3a48eb3 filesets: add eol predicate 2013-03-29 16:48:32 -07:00
Matt Mackall
0435af73d5 merge with stable 2013-03-29 15:27:33 -07:00
Matt Mackall
0e4e7a2ef3 merge with i18n 2013-03-29 15:27:11 -07:00
Bryan O'Sullivan
b9f58e03c3 perf: remove mysterious trailing newlines 2013-03-28 18:21:20 -07:00
Bryan O'Sullivan
0477147e50 blackbox: fix a few check-code portability errors 2013-03-27 09:00:43 -07:00
Bryan O'Sullivan
1d04c93909 check-code: fix a check-code failure in check-code
The irony is delicious.
2013-03-27 08:57:45 -07:00
FUJIWARA Katsunori
3a3aca3c72 smtp: verify the certificate of the SMTP server for STARTTLS/SMTPS
Before this patch, the certificate of the SMTP server for STARTTLS or
SMTPS isn't verified.

This may cause man-in-the-middle security problem (stealing
authentication information), even though SMTP channel itself is
encrypted by SSL.

When "[smtp] tls" is configured as "smtps" or "starttls", this patch:

  - uses classes introduced by preceding patches instead of "SMTP" or
    "SMTP_SSL" of smtplib, and

  - verifies the certificate of the SMTP server, if "[smtp]
    verifycert" is configured as other than False

"[smtp] verifycert" can be configured in 3 levels:

  - "strict":

    This verifies peer certificate, and aborts if:

      - peer certification is not valid, or
      - no configuration in "[hostfingerprints]" and "[web] cacerts"

    This is default value of "[smtp] verifycert" for security.

  - "loose":

    This verifies peer certificate, and aborts if peer certification is
    not valid.

    This just shows warning message ("certificate not verified"), if
    there is no configuration in "[hostfingerprints]" and "[web]
    cacerts".

    This is as same as verification for HTTPS connection.

  - False(no verification):

    Peer certificate is not verified.

    This is as same as the behavior before this patch series.

"hg email --insecure" uses "loose" level, and ignores "[web] cacerts"
as same as push/pull/etc... with --insecure.

Ignoring "[web] cacerts" configuration for "hg email --insecure" is
already done in "dispatch._dispatch()" by looking "insecure" up in the
table of command options.
2013-03-26 02:28:10 +09:00
FUJIWARA Katsunori
36bc77eef3 sslutil: abort if peer certificate is not verified for secure use
Before this patch, "sslutil.validator" may returns successfully, even
if peer certificate is not verified because there is no information in
"[hostfingerprints]" and "[web] cacerts".

To prevent from sending authentication credential to untrustable SMTP
server, validation should be aborted if peer certificate is not
verified.

This patch introduces "strict" optional argument, and
"sslutil.validator" will abort if it is True and peer certificate is
not verified.
2013-03-26 02:28:10 +09:00
FUJIWARA Katsunori
8fbfb98e72 smtp: add the class to verify the certificate of the SMTP server for SMTPS
Original "smtplib.SMTP_SSL" has no route to pass "ca_certs" and
"cert_reqs" arguments to underlying SSL socket creation. This causes
that "getpeercert()" on SSL socket returns empty dict, so the peer
certificate for SMTPS can't be verified.

This patch introduces the "SMTPS" class derived from "smtplib.SMTP" to
pass "ca_certs" and "cert_reqs" arguments to underlying SSL socket
creation.

"SMTPS" class is derived directly from "smtplib.SMTP", because amount
of "smtplib.SMTP_SSL" definition derived from "smtplib.SMTP" is as
same as one needed to override it.

This patch defines "SMTPS" class, only when "smtplib.SMTP" class has
"_get_socket()" method, because this makes using SSL socket instead of
normal socket easy.

"smtplib.SMTP" class of Python 2.5.x or earlier doesn't have this
method. Omitting SMTPS support for them is reasonable, because
"smtplib.SMTP_SSL" is already unavailable for them before this patch.

Almost all code of "SMTPS" class is imported from "smtplib.SMTP_SSL"
of Python 2.7.3, but it differs from original code in point below:

  - "ssl.wrap_socket()" is replaced by "sslutil.ssl_wrap_socket()" for
    compatibility between Python versions
2013-03-26 02:27:43 +09:00
FUJIWARA Katsunori
12eb9a4035 smtp: add the class to verify the certificate of the SMTP server for STARTTLS
Original "smtplib.SMTP" has no route to pass "ca_certs" and
"cert_reqs" arguments to underlying SSL socket creation. This causes
that "getpeercert()" on SSL socket returns empty dict, so the peer
certificate for STARTTLS can't be verified.

This patch introduces the "STARTTLS" class derived from "smtplib.SMTP"
to pass "ca_certs" and "cert_reqs" arguments to underlying SSL socket
creation.

Almost all code of "starttls()" in this class is imported from
"smtplib.SMTP" of Python 2.7.3, but it differs from original code in
points below:

  - "self.ehlo_or_helo_if_needed()" invocation is omitted, because:

    - "ehlo_or_helo_if_needed()" is available with Python 2.6 or later, and
    - "ehlo()" is explicitly invoked in "mercurial.mail._smtp()"

  - "if not _have_ssl:" check is omitted, because:

    - "_have_ssl" is available with Python 2.6 or later, and
    - same checking is done in "mercurial.sslutil.ssl_wrap_socket()"

  - "ssl.wrap_socket()" is replaced by "sslutil.ssl_wrap_socket()" for
    compatibility between Python versions

  - use "sock.recv()" also as "sock.read()", if "sock" doesn't have
    "read()" method

    with Python 2.5.x or earlier, "sslutil.ssl_wrap_socket()" returns
    "httplib.FakeSocket"-ed object, and it doesn't have "read()"
    method, which is invoked via "smtplib.SSLFakeFile".
2013-03-26 02:27:23 +09:00
Brendan Cully
1c111a8da8 template: allow unquoted int function arguments 2013-04-07 23:25:50 -07:00
Brendan Cully
5659e9d1ac Merge with main 2013-04-08 09:44:26 -07:00
Siddharth Agarwal
7b731630aa graft: use missing ancestors algorithm to find earlier grafts
When the revisions to graft are numerically close to the destination, this
avoids two walks up the DAG, which for a repository with over 470,000
changesets translates to around 2.2 seconds.
2013-04-06 19:50:03 -07:00
Siddharth Agarwal
d16194fcaf graft: find ancestors of destination lazily
When the revisions to graft are numerically close to the destination, this
avoids one walk up the DAG, which for a repository with over 470,000
changesets translates to around 1.1 seconds.
2013-04-06 20:05:17 -07:00
Matt Mackall
4e73b3cd9c merge with crew 2013-04-05 12:21:38 -05:00