Commit Graph

91 Commits

Author SHA1 Message Date
Durham Goode
ad813edcbd treemanifest: enable treemanifest by default in tests
Summary:
Now that all our repos are treemanifest, let's enable the extension by
default in tests. Once we're certain no one needs it in production we'll also
make it the default in core Mercurial.

This diff includes a minor fix in treemanifest to be aware of always-enabled
extensions. It won't matter until we actually add treemanifest to the list of
default enabled extensions, but I caught this while testing things.

Reviewed By: ikostia

Differential Revision: D15030253

fbshipit-source-id: d8361f915928b6ad90665e6ed330c1df5c8d8d86
2019-05-28 03:17:02 -07:00
Mark Thomas
66d79c86c8 pull: remove postincoming advice
Summary:
The postincoming checks prints out advice of the following forms:

* `(run 'hg heads' to see heads)`
* `(run 'hg heads' to see heads, 'hg merge' to merge)`
* `(run 'hg heads .' to see heads, 'hg merge' to merge)`
* `(run 'hg update' to get a working copy)`

This advice is no longer useful, so remove it.

Reviewed By: DurhamG, farnz

Differential Revision: D15317185

fbshipit-source-id: 50ba576406c96715fa058399da53462be9b7a3bf
2019-05-20 06:19:49 -07:00
Alexander Kindyakov
88239b04fb debuglock: also report infinitepushbackup and prefetch locks
Summary:
To be able to investigate problems with dangling lock files "infinitepushbackup" and "prefetch".
   - "infinitepushbackup", file "infinitepushbackup.lock" in repo.sharedvfs
   - "prefetchlock", file "prefetchlock" in repo.svfs

Also some small fixes around.
  - Crate "undolog" directory if it doesn't exist.
  - `report` function was restructed. Now if lock checking method is not passed
    lock will be checked with `lockmod.lock`.

Reviewed By: markbt

Differential Revision: D14949807

fbshipit-source-id: 02143ff923145e67e88c5627cf3355a834823b6d
2019-04-29 04:34:28 -07:00
Jun Wu
047b1a05f4 exchange: kill checkheads
Summary:
We had `ui.checkheads=false` set for a long time. Let's remove the feature
entirely and update the tests.

This is necessary before killing the branch cache, as some tests still use
different branches and there would be suddently more "heads" that cause
test issues.

Reviewed By: sfilipco

Differential Revision: D14179861

fbshipit-source-id: 0de76566799a9560b45e823cc5f49cfda9e3dd30
2019-02-22 21:02:41 -08:00
Jun Wu
9dc21f8d0b codemod: import from the edenscm package
Summary:
D13853115 adds `edenscm/` to `sys.path` and code still uses `import mercurial`.
That has nasty problems if both `import mercurial` and
`import edenscm.mercurial` are used, because Python would think `mercurial.foo`
and `edenscm.mercurial.foo` are different modules so code like
`try: ... except mercurial.error.Foo: ...`, or `isinstance(x, mercurial.foo.Bar)`
would fail to handle the `edenscm.mercurial` version. There are also some
module-level states (ex. `extensions._extensions`) that would cause trouble if
they have multiple versions in a single process.

Change imports to use the `edenscm` so ideally the `mercurial` is no longer
imported at all. Add checks in extensions.py to catch unexpected extensions
importing modules from the old (wrong) locations when running tests.

Reviewed By: phillco

Differential Revision: D13868981

fbshipit-source-id: f4e2513766957fd81d85407994f7521a08e4de48
2019-01-29 17:25:32 -08:00
Kostia Balytskyi
cb1179cccb locks: make sure debuglocks knows about malformed locks and undolog lock
Summary: Let's report that this lock cannot be read by Mercurial

Reviewed By: markbt

Differential Revision: D7653196

fbshipit-source-id: c5b7889cdde9c0ecc03a8c961aeba92f426648b1
2018-04-17 17:42:26 -07:00
Durham Goode
c679adb7d0 hg: remove bundlev1 from the supported outgoing versions
Summary:
Removes bundlev1 from the supported outgoing versions, but keeps a flag
around to force enable it if tests need it.

Reviewed By: quark-zju

Differential Revision: D7591176

fbshipit-source-id: 280cbbbe87848e3d6c9d448ce4f87c5eadeff720
2018-04-13 21:51:53 -07:00
Durham Goode
24653e5e32 hg: add develwarn for bundle1 format
Summary:
We want to deprecate the bundlev1 format, so let's start by adding a
develwarn. Later diffs will update the tests to not use v1, then remove v1 as a
supported outgoing bundle entirely.

Reviewed By: quark-zju

Differential Revision: D7591166

fbshipit-source-id: 143ad029bfe4d141f91d6d5077342dfa44ad2944
2018-04-13 21:51:52 -07:00
Jun Wu
4a7b28d08b serve: assign hg serve ports dynamically in tests
Summary:
Previously `hg server` uses `HGPORT` that might be in use. This patch uses
`-p 0 --port-file ...` so `hg server` always gets assigned a free port.

The change was first made by the following Ruby script:

```
re = /^  \$ hg serve(.*) -p \$(HGPORT[12]?) (.*[^\\])$\n  \$/
Dir['*.t'].each do |path|
  old = File.read(path)
  new = old.lines.map do |l|
    next l if l[/\(glob\)/] or not l['$HGPORT'] or l[/^  [$>]/]
    "#{l.chomp} (glob)\n"
  end.join.gsub re, <<-'EOS'.chomp
  $ hg serve\1 -p 0 --port-file $TESTTMP/.port \3
  $ \2=`cat $TESTTMP/.port`
  $
  EOS
  File.write(path, new) if old != new
end
```

Then there are some manual changes:

run-tests.py: It now treats `$HGPORT` in output as glob pattern `*`, since
it does not know the assigned value in tests.

test-bookmarks-pushpull.t, test-https.t: Some `hg pull`s were changed to use
explicit paths instead of relying on `.hgrc` since the test restarts the
server and `.hg/hgrc` having an outdated URL.

test-schemes.t: The test writes `$HGPORT` to `.hgrc` before assigning it.
Changed the order so the correct `$HGPORT` is written.

test-patchbomb-tls.t: Changed `(?) (glob)` to `(glob) (?)`.

Reviewed By: DurhamG

Differential Revision: D6925398

fbshipit-source-id: d5c10476f43ce23f9e99618807580cf8ba92595c
2018-04-13 21:51:07 -07:00
Kostia Balytskyi
93e8a3a685 tests_: simplify bundle2 requirement testing
Differential Revision: https://phabricator.intern.facebook.com/D4599415
(grafted from 35efb60b54b45e4bf8a281da35377ceabd9a2d0d)
(grafted from c976227665e29759c3bfd62a78b653815999f33c)
(grafted from ce81c51c90c6a7e67377b8368ff056be747ba808)
(grafted from f8ebd7782719ffb9f6c9bbdc740af4d628bc4c38)
(grafted from b683d8dc9677c2e4f24395f2ae849129bd4d6c81)
(grafted from 98300e5ba307c80f257e9d28b3afa7ef30d9a109)
(grafted from 6baa745cb3ea1a59c5e194b28d1db7e6a14da8fa)
(grafted from 0bd1e681e370164b2b58ed6329dcceab8a45ba1a)
(grafted from b88e051e45b3b34eebfe68b579d40e0848dd9164)
(grafted from d7d3ea27b8e834ca6a7ee86d67109f68dff8b627)
(grafted from 07f80547629b090986e880005f17af3470927034)
(grafted from f3ecb29d9b68d2adcf28a1986c070ceb85da8421)
(grafted from 23c77af0834657915d69f06623b8d831fc03dfbc)
(grafted from 6c0111953ffaacad3deb12f81bf05454f4c8bfc1)
(grafted from e6564dd98f0ab63736ba70500d60db0def7025f8)
(grafted from 3228fe1cc79cea64fa4cc674bf71f24123433ec7)
(grafted from 5a8c522c3db09d88bc6d45393c40256139ab4d42)
(grafted from 8d3f1b10a2bcda17dc55cdc97712bdc456acc406)
(grafted from 1f994f75a2a4f57c0f19981f71254e22963eaa04)
(grafted from 9bf91f3db246c40475f57657d82bd3f50e571e84)
(grafted from 2f88c5c88fd55b48fc0c30aa2abd701b2b7b9d7d)
(grafted from fab2b4f5d6e855c657f69dccb08f720bab4a82b1)
(grafted from e2fc694c13c74f7948680d653568e62d7010c4f4)
(grafted from d474fcb2eb58404a689024cc503abe28136c8395)
(grafted from 8b2233600993b96119186ddbfb16232c48247fe1)
(grafted from ba5486b8c838e72c35cb437cbdf0add5b2100c6b)
(grafted from 42699d89bd0da2e204075246eb4c27baa642fc2a)
(grafted from 02d0e17b6b7f938ba58f26d84191ef347bcdbd17)
(grafted from 9f9bba61993924c1c96a5dd15c0c50895ec8e525)
(grafted from c3bc9b3844d852ba7365574d3fbd4aa8e2763aa0)
(grafted from fc5d31337891e9eb218f100b177f8ead2f6353da)
(grafted from baad4585f877267a3264dc4c70e8cd75bfc6688e)
(grafted from 6d46603cea8fc9d04628817ae1e239b38e62ce62)
(grafted from c54d6c0b3b3dae086b8ad186e178a1e137b57cae)
(grafted from 1755e00c824c7d5b30a7daff573c3ab1e2f1fd2c)
(grafted from 81826a9db3f5f9c8e760d2b09afb06d9f74a1609)
(grafted from 73bce05fdb8cb8f8739bd2c90741ac7d422e24a4)
(grafted from c942744744e071464d3a476e57fd74f922fca497)
(grafted from 77b797a46b52249b26da6d30a0c63e381d1af0fe)
(grafted from 9b09bef68b1aa1ef3804aec330e793dcc7ada944)
(grafted from fefea5a4a24f0c8219b4b0e2b0cc70b4dfadfde2)
(grafted from 3428e6ab54999e70b38a5ee62291c8774bae7e4a)
(grafted from dd57d190fa75589d800beed188c5a381678cca3c)
(grafted from 9005ba0d5e6420ed8d048c08fc38a9682e536a26)
(grafted from daeb4bf87b68309c4c3c608853affe2adeb9fcbd)
(grafted from 6ad984397b22666ecebc2ff737b0d52ffb95b9b7)
(grafted from bd1f17920c18d88b6c4dd451f76699f6f665bc32)
(grafted from 31a92a48004ab6a4bfc389f674cacf549703e2b9)
(grafted from 7e80636f1529b8902292980912586f1db8598a83)
(grafted from 55ecf6a9f9bc89fd0330c4684f225e213be18033)
(grafted from 3361f627a0b8cb7666a529494ed80a0e1d7a365c)
(grafted from f51abda49b2d33a936567b786ce785c97e4b9c64)
(grafted from 5c01ed3bf394351e116fcece1fbd9e1b19f57ea4)
(grafted from 9503cdb335a95950235b7871978bcb6cb3e87222)
(grafted from 220d31489a377997e71d5766f9f29b30fd1662e1)
(grafted from 97483c98cf95113e95d03bf69f3307f92ef232a4)
(grafted from b3e9f8f43b4dd76422c20234acf76ec82a9c5f5b)
(grafted from 831d9f1b2940b6944fc1015c57f348a22de7a149)
(grafted from 051e1081a45e85944ea4414174a452e208904371)
(grafted from 9fb7c4c494166dee97bb04826cf71b0fa774cd2b)
(grafted from bfb4cb9c08c582323ceb82eb5cd2bcaeaf70329c)
(grafted from ab548e4f700a65bd24fbbbdb43f971eb5da73be5)
(grafted from 8870c382cfecbcbd4f8cec3ca0cb8759a43cf31c)
(grafted from 8e09e732b846b42beb49866d3785572df89f1e38)
(grafted from 951064f2a2980a00d085fce0d207c0225447b5d5)
(grafted from fce58e29903c2ef95b0481c11d59e5ef4fb56d15)
(grafted from 391f610601eeb542b9aa2bed3f541609772b8599)
(grafted from 681ea78b8ae1c29589a49a5bb74e0f3dff30e1d7)
(grafted from add76a9d94ee5d7b829be52458d1dfb65585c2d3)
(grafted from 475ae856da634e53637131717723fe895be0def6)
(grafted from b22d9651b8a7957c8275301d79f6ba62fc5a38f4)
(grafted from 3bf8c57dfd2fb432f4d499014dd9ab4ced26133d)
(grafted from 47718758ce30722c7a6e4d4dc324bdef20d45163)
(grafted from 59270eeea34cc381933ce50600983819e8a35794)
(grafted from 5397fdfa10d831ba358925e4a32faa23fed18173)
(grafted from de9cc0df3d097d25a8a218010e4a8370373f5068)
(grafted from e7f5a21e9dd2f2a4527943f5dad0d597c0f2b7a4)
(grafted from 5c383ebe8f57ccabf1ede74905a951631c7e32de)
(grafted from bf4ad8ffd761b575a843fe5f8370fb4a5c1a2eb9)
(grafted from 8523ff03bfa8708eefb667d9df64fba58e5a9f8c)
(grafted from 5220db13df5a745d113ebba89185ac42f4f890d1)
(grafted from 8a66c7352d03e545e8cbe80a1f84122624f2035c)
(grafted from 94cf7cdbce472e0694582b18acd6f2fc3f46e839)
(grafted from 29575e1ce294a235a1df9136a6b807b8947a20cd)
(grafted from d23b69b215e4201e90b600797b41ab362e7c7044)
(grafted from 386af1481e70f160f6b3d0e08ba8934372446b68)
(grafted from fc69c78396e9ab15fd961540204db004db933799)
(grafted from 8a8e35573518b72937af626999b885c6f6491683)
(grafted from 9fb083f031e7358fdb73ef6fac5278f841f2b084)
(grafted from aa20fd817539bdd8d15adb340ef714121dd273b2)
(grafted from 2b68df547651d1727b4320f2ffbb8fded3ab49ac)
(grafted from ff3bf5623756d977c88a25d546b34160229177d3)
(grafted from fd5f39d43bac7fa2c8a1e5785e3dc060f539277c)
(grafted from 8871ae64560384cf7693a5c32333b90e6774ba2a)
(grafted from 3a01e81a1a78138af5892129f447bee53fb85a73)
(grafted from ca1bc04c027005d42b4dc5eee52c3874a13790df)
(grafted from c68f7302ce65f055e205ed701490529571aaaa32)
(grafted from c7e264107eb95c8ab01804699775374b43bcbd84)
(grafted from 3748e7898899c994a4b5019b66f705e2c7a8d2eb)
(grafted from fe2d08b837334f9b3b1bb3a18a28f010a02c0340)
(grafted from dd29c6c56f0de76550d2f61671eb05da6a03fbc3)
2018-01-03 05:35:56 -08:00
Matt Harbison
7d8bebd9c1 tests: remove (glob) annotations that were only for '\' matches
# skip-blame because this was mechanically rewritten the following script.  I
ran it on both *.t and *.py, but none of the *.py changes were proper.  All *.t
ones appear to be, and they run without addition failures on both Windows and
Linux.

  import argparse
  import os
  import re

  ap = argparse.ArgumentParser()
  ap.add_argument('path', nargs='+')
  opts = ap.parse_args()

  globre = re.compile(r'^(.*) \(glob\)(.*)$')

  for p in opts.path:
      tmp = p + '.tmp'
      with open(p, 'rb') as src, open(tmp, 'wb') as dst:
          for line in src:
              m = globre.match(line)
              if not m or '$LOCALIP' in line or '*' in line:
                  dst.write(line)
                  continue
              if '?' in line[:-3] or ('?' in line[:-3] and line[-3:] != '(?)'):
                  dst.write(line)
                  continue
              dst.write(m.group(1) + m.group(2) + '\n')
      os.unlink(p)
      os.rename(tmp, p)
2017-12-10 22:50:57 -05:00
Boris Feld
12ed35f197 bookmark: use the 'bookmarks' bundle2 part to push bookmark update (issue5165)
We use the new binary parts we introduced earlier to exchange bookmark. The
payload is a bit more compact since we use binary and the length of bookmarks
is no longer constrained to 255.

.. fix:: Issue 5165

   Bookmark, whose name is longer than 255, can again be exchanged again
   between 4.4+ client and servers.
2017-10-17 12:38:13 +02:00
Boris Feld
9c4599c477 config: use 'experimental.evolution.exchange'
Extract 'experimental.evolution' = exchange as
'experimental.evolution.exchange'.

We keep the new option in the 'experimental.evolution' namespace in order to
stay coherent with other options ('experimental.evolution.bundle-obsmarker'
and 'experimental.evolution.track-operation') ease the renaming as possibly
'evolution.exchange'.

Differential Revision: https://phab.mercurial-scm.org/D1151
2017-09-28 21:07:58 +01:00
Boris Feld
a95ef2baa9 config: use 'experimental.evolution.create-markers'
Extract 'experimental.evolution' = createmarkers as
'experimental.evolution.createmarkers'.

We keep the new option in the 'experimental.evolution' namespace in order to
stay coherent with other options ('experimental.evolution.bundle-obsmarker'
and 'experimental.evolution.track-operation') ease the renaming as possibly
'evolution.createmarkers'.

Differential Revision: https://phab.mercurial-scm.org/D1149
2017-09-28 18:19:06 +01:00
Boris Feld
a5658f8623 phase: use a binary phase part to push through bundle2 (BC)
The part we are using for pull is now used for push too. As we no longer use
pushkey, pushkey hooks are no longer triggered. This is an obvious backward
incompatible change. We could artificially trigger the pushkey hook within the
bundle2 part, but this seemed too hacky to me.

An option would be to disable by default this new mechanism for a couple of
versions to help people migrate to `txnclose-phase`. I took the liberal and
optimistic path to just turn it on by default directly.

.. bc::

   Push no longer triggers a pushkey hook when updating phases. Use the new
   `txnclose-phase` and `txnclose-phase` hooks instead.
   (Applies when both server and client use version 4.4 or above).
2017-09-20 19:38:06 +02:00
Boris Feld
6af1a238e0 configitems: register the test 'failpush.reason' config 2017-10-13 23:10:49 +02:00
Denis Laxalde
9efc7f05e3 transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Upon pull or unbundle, we display a message with the range of new revisions
fetched. This revision range could readily be used after a pull to look out
what's new with 'hg log'. The algorithm takes care of filtering "obsolete"
revisions that might be present in transaction's "changes" but should not be
displayed to the end user.
2017-10-12 09:39:50 +02:00
Saurabh Singh
c06453cd30 serve: make tests compatible with chg
chg only supports 'hg serve' when the options to the serve command
follow the 'hg serve'. For example, 'hg -R <repo> serve ..' is unsupported.
This leads to issues with chg running for the following tests:

 - test-bundle2-exchange.t
 - test-clone-uncompressed.t
 - test-hgweb-csp.t
 - test-http-bad-server.t
 - test-http-bundle1.t
 - test-http-protocol.t
 - test-http.t

There was an effort made earlier to fix this issue for chg and the tests were
fixed to confirm to the compatible pattern. But the new tests did not take care
of the same and hence, fail. Hopefully, there will be continuous build setup
for chg after all tests are made compatible with chg so that we can avoid such
issues.

Test Plan:
Ran the aforementioned tests with and without '--chg' option.

Differential Revision: https://phab.mercurial-scm.org/D946
2017-10-04 18:39:26 -07:00
Boris Feld
c886c86073 test: update evolution config
evolution* config has been rewritten in stabilization* in the previous patch,
update tests file to use the new names.

Differential Revision: https://phab.mercurial-scm.org/D249
2017-08-04 18:41:16 +02:00
Matt Harbison
b6162a8a97 tests: quote $PYTHON for Windows
When unquoted, MSYS sees the colon between the drive letter and path as a Unix
path separator and unhelpfully splits on it, feeding only the drive letter as
the command.  Much chaos ensues.

I vaguely remember trying to get the test runner to use /letter/path/to/exe
syntax the last time this happened, without success.  I doubt a check-code rule
would work, since sometimes it is quoted, and sometimes the quotes are escaped.
2017-07-07 01:05:20 -04:00
Augie Fackler
aa7e7bad35 tests: clean up even more direct python calls with $PYTHON
This time ones that are prefixed with =, ", ', or `. This appears to
be the last of them.

Differential Revision: https://phab.mercurial-scm.org/D14
2017-06-20 17:31:18 -04:00
Augie Fackler
3500d40ee7 tests: fix missing (glob) annotations in test-bundle2-exchange.t 2017-04-03 18:55:55 -04:00
Pierre-Yves David
e3a8075346 hook: add hook name information to external hook
While we are here, we can also add the hook name information to external hook.
2017-03-31 11:53:56 +02:00
Pierre-Yves David
833b1335ba hook: provide hook type information to external hook
The python hooks have access to the hook type information. There is not reason
for external hook to not be aware of it too.

For the record my use case is to make sure a hook script is configured for the
right type.
2017-03-31 11:08:11 +02:00
Pierre-Yves David
7a17c488e7 run-tests: auto-replace 'TXNID' output
Hooks related to the transaction are aware of the transaction id. By definition
this txn-id is unique and different for each transaction. As a result it can
never be predicted in test and always needs matching. As a result, touching any
like with this data is annoying. We solve the problem once and for all by
installing an automatic replacement. In test, this will now show as:

  TXNID=TXN:$ID$
2017-03-30 17:29:03 +02:00
Jun Wu
7bdcbacb01 tests: use LOCALIP
This patch replaces hardcoded 127.0.0.1 with $LOCALIP in all tests.

Till now, the IPv6 series should make tests pass on common IPv6 systems
where the local device has the address "::1" and the hostname "localhost"
resolves to "::1".
2017-02-16 09:38:52 -08:00
Pierre-Yves David
d00dbd00d9 bundle1: fix bundle1-denied reporting for pull over ssh
Changeset a0966f529e1b introduced a config option to have the server deny pull
using bundle1. The original protocol has not really been design to allow that
kind of error reporting so some hack was used. It turned the hack only works on
HTTP and that ssh server hangs forever when this is used. After further
digging, there is no way to report the error in a unified way. Using `ooberror`
freeze ssh and raising 'Abort' makes HTTP return a HTTP-500 without further
details. So with sadness we implement a version that dispatch according to the
protocol used.

Now the error is properly reported, but we still have ungraceful abort after
that. The protocol do not allow anything better to happen using bundle1.
2017-02-10 18:06:08 +01:00
Pierre-Yves David
92aa2c1992 bundle-tests: operate from outside a repository
We are about to add a test for ssh pull/cloning being denied because of bundle1
usage. For this, it is cleaner to not operate from the clone using http. So we
update the test beforehand for clarity. This is more churns that what I'm happy
to see on stable, but the rests of the series is worth it in my opinion.
2017-02-10 18:06:12 +01:00
Pierre-Yves David
5b07cfa3b3 bundle1: display server abort hint during unbundle
The code was printing the abort message but not the hint. This is now fixed.
2017-02-10 17:56:52 +01:00
Pierre-Yves David
64f57e513b bundle1: fix bundle1-denied reporting for push over ssh
Changeset a0966f529e1b introduced a config option to have the server deny push
using bundle1. The original protocol has not really be design to allow such kind
of error reporting so some hack was used. It turned the hack only works on HTTP
and that ssh wire peer hangs forever when the same hack is used. After further
digging, there is no way to report the error in a unified way. Using 'ooberror'
freeze ssh and raising 'Abort' makes HTTP return a HTTP500 without further
details. So with sadness we implement a version that dispatch according to the
protocol used.

We also add a test for pushing over ssh to make sure we won't regress in the
future. That test show that the hint is missing, this is another bug fixed in
the next changeset.
2017-02-10 17:56:59 +01:00
Pierre-Yves David
e8a7ecc281 bundle2: keep hint close to the primary message when remote abort
The remote hint message was ignored when reporting the remote error and
passed to the local generic abort error. I think I might initially have
tried to avoid reimplementing logic controlling the hint display depending of
the verbosity level. However, first, there does not seems to have such verbosity
related logic and second the resulting was wrong as the primary error and the
hint were split apart. We now properly print the hint as remote output.
2017-02-10 17:56:47 +01:00
Augie Fackler
cb268cbd2f merge with stable 2016-08-15 12:26:02 -04:00
Augie Fackler
97b8f423b9 exchange: correctly specify url to unbundle (issue5145)
This parameter is slightly confusingly named in wireproto, so it got
mis-specified from the start as 'push' instead of the URL to which we
are pushing. Sigh. I've got a patch for that which I'll mail
separately since it's not really appropriate for stable.

Fixes a regression in bundle2 from bundle1.
2016-08-05 16:25:15 -04:00
Pierre-Yves David
1ba19266a7 tests: use 'legacy.exchange' option in 'test-bundle2-exchange.t'
The new option will stay around. The experimental option was only meant to be
temporary.
2016-08-02 15:23:03 +02:00
Pierre-Yves David
a7ac53500f tests: remove initial bundle2 enabling in various bundle2 tests
Bundle 2 is enable by default since 3.6 so we don't need this anymore.

The remaining use of 'experimental.bundle2-exp' are there to test legacy behavior
with bundle 1. Future patches will introduce a way outside of experimental to
test that.
2016-08-02 14:54:06 +02:00
Jun Wu
463f2aebe1 tests: reorder hg serve commands
chg currently does not support hg serve -d. It has a quick path testing if the
command is hg serve -d and fallbacks to hg if so. But the test only works if
"serve" is the first argument since the test wants to avoid false positives
(for example, "-r serve" is different).
This patch reorders "hg server" commands in tests, making them chg friendly.
2016-03-15 09:51:54 +00:00
Mateusz Kwapich
6688b1c845 hooks: add HG_NODE_LAST to txnclose and changegroup hook environments
Sometimes a txnclose or changegroup hook wants to iterate through all
the changesets in transaction: in that situation usually the revset
`$HG_NODE:` is used to select the revisions. Unfortunately this revset
sometimes may contain too many changesets because we don't have the
write lock while the hook runs newer changes may be added to
repository in the meantime.

That's why there is a need for extra variable carrying the information about
the last change in the transaction.
2016-01-05 17:37:59 -08:00
Gregory Szorc
b5e53cc1d6 wireproto: support disabling bundle1 only if repo is generaldelta
I recently implemented the server.bundle1* options to control whether
bundle1 exchange is allowed.

After thinking about Mozilla's strategy for handling generaldelta
rollout a bit more, I think server operators need an additional
lever: disable bundle1 if and only if the repo is generaldelta.

bundle1 exchange for non-generaldelta repos will not have the potential
for CPU explosion that generaldelta repos do. Therefore, it makes sense
for server operators to continue to allow bundle1 exchange for
non-generaldelta repos without having to set a per-repo hgrc option
to change the policy depending on whether the repo is generaldelta.

This patch introduces a new set of options to control bundle1 behavior
for generaldelta repos. These options enable server operators to limit
bundle1 restrictions to the class of repos that can be performance
issues. It also allows server operators to tie bundle1 access to store
format. In many server environments (including Mozilla's), legacy repos
will not be generaldelta and new repos will or might be. New repos often
aren't bound by legacy access requirements, so setting a global policy
that disallows access to new/generaldelta repos via bundle1 could be a
reasonable policy in many server environments. This patch makes this
policy very easy to implement (modify global hgrc, add options to
existing generaldelta repos to grandfather them in).
2015-12-20 11:56:24 -08:00
Gregory Szorc
9af952ad6e wireproto: config options to disable bundle1
bundle2 is the new and preferred wire protocol format. For various
reasons, server operators may wish to force clients to use it.

One reason is performance. If a repository is stored in generaldelta,
the server must recompute deltas in order to produce the bundle1
changegroup. This can be extremely expensive. For mozilla-central,
bundle generation typically takes a few minutes. However, generating
a non-gd bundle from a generaldelta encoded mozilla-central requires
over 30 minutes of CPU! If a large repository like mozilla-central
were encoded in generaldelta and non-gd clients connected, they could
easily flood a server by cloning.

This patch gives server operators config knobs to control whether
bundle1 is allowed for push and pull operations. The default is to
support legacy bundle1 clients, making this patch backwards compatible.
2015-12-04 15:12:11 -08:00
Gregory Szorc
059667a51c bundle2: attribute remote failures to remote (issue4788)
Before bundle2, hook output from hook failures was prefixed with
"remote: ". Up to this point with bundle2, the output was converted to
the message to print in an Abort exception. This had 2 implications:

1) It was unclear whether an error message came from the local repo
   or the remote
2) The exit code changed from 1 to 255

This patch changes the handling of error:abort bundle2 parts during push
to prefix the error message with "remote: ". This restores the old
behavior.

We still preserve the behavior of raising an Abort during bundle2
application failure. This is a regression from pre-bundle2 because the
exit code changed.

Because we no longer raise an Abort with the remote's message, we needed
to insert a message for the new Abort. So, I invented a new error
message for that. This is another change from pre-bundle2. However, I
like the new error message because it states unambiguously who aborted
the push failed, which I think is important for users so they can decide
what's next.
2015-10-24 00:39:22 +01:00
Pierre-Yves David
30913031d4 error: get Abort from 'error' instead of 'util'
The home of 'Abort' is 'error' not 'util' however, a lot of code seems to be
confused about that and gives all the credit to 'util' instead of the
hardworking 'error'. In a spirit of equity, we break the cycle of injustice and
give back to 'error' the respect it deserves. And screw that 'util' poser.

For great justice.
2015-10-08 12:55:45 -07:00
Durham Goode
ceec7b0056 bundle2: allow lazily acquiring the lock
In the external pushrebase extension, it is valuable to be able to do some work
without taking the lock (like running expensive hooks). This enables
significantly higher commit throughput.

This patch adds an option to lazily acquire the lock. It means that all bundle2
part handlers that require writing to the repo must first call
op.gettransction(), when in this mode.
2015-10-05 16:19:54 -07:00
Pierre-Yves David
5e9a275007 bookmarks: change bookmark within a transaction
For some time, bookmark can and should be moved in the transaction. This
changeset migrates the 'hg bookmarks' commands to use a transaction.

Tests regarding rollback and transaction hooks are impacted for
obvious reasons. Some have to be slightly updated to keep testing the
same things. Some can just be dropped because they do not make sense
anymore.
2014-09-28 00:49:36 -07:00
Matt Harbison
de473412b1 tests: restore 'python' and '$TESTDIR/' for dummyssh invocation
This is a backout of 93589179c542, and a partial backout of 9b1628b91e74.

Windows won't execute 'dummyssh' directly, presumably because CreateProcess()
doesn't know how to execute a bash script:

   $ hg clone -e "dummyssh" ssh://user@dummy/cloned sshclone
   remote: 'dummyssh' is not recognized as an internal or external command,
   remote: operable program or batch file.
   abort: no suitable response from remote hg!
   [255]

With the restoration of python as the executable, $TESTDIR needs to be restored
for these invocations, because python won't search $PATH for 'dummyssh':

   $ hg clone -e "python dummyssh" ssh://user@dummy/cloned sshclone
   remote: python: can't open file 'dummyssh': [Errno 2] No such file or directory
   abort: no suitable response from remote hg!
   [255]
2015-06-09 21:39:33 -04:00
Pierre-Yves David
e567efc154 bundle2: convey PushkeyFailed error over the wire
We add a way to convey the precise exception. This will allow better error
message on the server.
2015-06-10 13:10:53 -04:00
Pierre-Yves David
97353a98b6 push: catch and process PushkeyFailed error
We add a way to register "pushkey failure callback" that will be used if the
push is aborted by a pushkey failure. A part generator adding mandatory pushkey
parts should register a failure callback for all of them. The callback will be
in charge of generating a meaningful abort if this part fails.

If no callback is registered, the error is propagated.

Catch PushkeyFailed error in exchange.
2015-06-05 16:30:11 -07:00
Pierre-Yves David
2f30e7a692 bundle2: abort when a mandatory pushkey part fails
So far, result of a pushkey operation had no consequence on the transaction
(beside the change). We makes it respect the 'mandatory' flag of part so that
failed pushkey call abort the whole transaction. This will allow rejecting
changes (primary target: changesets) regarding phases or bookmark criteria in
the future (when we will push such data in a mandatory part).

We currently raise an abort error because all clients support it. We'll
introduce a more precise error in the next changesets.
2015-05-27 05:28:40 -07:00
Matt Mackall
36e5db11e5 tests: simplify printenv calls
Make printenv executable so that we don't need python, TESTDIR, or
quoting.
2015-06-08 15:10:15 -05:00
Matt Mackall
c64d336faa tests: simplify calls to dummyssh
dummyssh is marked executable and is in the path, no need for python,
TESTDIR, or quotes.
2015-06-08 15:02:49 -05:00
Matt Mackall
b709208c37 tests: drop DAEMON_PIDS from killdaemons calls 2015-06-08 14:55:40 -05:00