Commit Graph

1710 Commits

Author SHA1 Message Date
Adam Simpkins
b6b5e38199 pushrebase: report details about public commits being pushed
Summary:
When failing due to attempting to rebase already-public commits, include the
public commit node IDs in the error message.

Test Plan: Included new tests.

Reviewers: durham, quark, #fbhgext

Reviewed By: durham, quark, #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D1496
2017-11-28 20:10:46 -08:00
Mark Thomas
4bce5b2bbc treedirstate: prevent interference with other dirstate implementations
To avoid problems when other dirstate implementations are in use (sqldirstate
or eden), prevent upgrade of repos with those implementations active to
treedirstate.

Automatic upgrades are silently prevented.  Attempts to manually upgrade fail
with an explanatory message.

Differential Revision: https://phab.mercurial-scm.org/D1528
2017-11-28 04:51:38 -08:00
Mark Thomas
33855b35cc treedirstate: add integration tests
Copy the dirstate tests from core Mercurial, but run them with treedirstate
instead of the default dirstate map.

Add an extra test that covers scenarios specific to treedirstate.

Differential Revision: https://phab.mercurial-scm.org/D1490
2017-11-28 04:51:38 -08:00
Mark Thomas
f2610526b0 tests: update githelp test
The githelp for apply was updated in D1522.  Update the tests to match.

Differential Revision: https://phab.mercurial-scm.org/D1529
2017-11-28 04:50:17 -08:00
Durham Goode
fce353c28d fastannotate: pass commitctx to filectx to prevent tree downloads
Previously fastannotate was creating filectx's by doing commitctx[path]. This
invokes logic that resovles the filenode immediately, which require loading the
manifest for that commit. In a repo where manifests are downloaded lazily, this
can result in a lot of time spent downloading manifests.

Since commands like hg blame -u only need the filectx so they can resolve the
commitctx for commit information, let's just pass the commitctx straight to the
filectx. It can later derive the filenode if it needs to.

Differential Revision: https://phab.mercurial-scm.org/D1488
2017-11-27 16:33:50 -08:00
Durham Goode
bd4a9549cb treemanifest: automatically backfill missing manifests during hg pull
Previously, if a repo went from treeonly to not treeonly, the user had to run a
command to backfill the missing flat manifests. This patch makes it happen
automatically as part of hg pull.

Differential Revision: https://phab.mercurial-scm.org/D1485
2017-11-27 09:22:06 -08:00
Hollis Blanchard
4937529d4c tests: split p4fastimport-import-lfs.t into normal LFS vs SQLite
p4fastimport has the ability to bypass the normal LFS upload mechanisms, and
that's what the original testcase actually tested.

We also want to ensure that normal LFS works with p4fastimport too, so we need
a testcase for that.

Differential Revision: https://phab.mercurial-scm.org/D1306
2017-11-27 03:34:35 -08:00
Thomas Jacob
35c42f65ae fbamend: allow general rev for --to, fix aborts
Summary:
Didn't work when --to wasn't specified as a 12 char
short hash, and since no errors were raised
due to the missing "raise" before error.abort
also effectively deleted changes in the working copy.

Now should work with anything repo[input] accepts
as a valid commit.

Also checks for predicatable error conditions before
the repo is modified to avoid changing working copy
on error.

Test Plan: TBD

Reviewers: #sourcecontrol

Subscribers: #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D6379590

Tasks: T22281996
2017-11-25 09:19:09 -08:00
Kostia Balytskyi
e85582c7ce phabricator: fix lint warning
Summary: Fix lint.

Test Plan:
`test-check-code-hg.t` is now pasing
`test-check-config` is also passing

Reviewers: #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D1491
2017-11-22 15:16:10 -08:00
Kostia Balytskyi
60026b3811 remotefilelog: implement threaded _getfiles
Summary:
A better way to avoid deadlocks and not sacrifice performance on `_getfiles`
call.

Test Plan:
- build, pull and update on Windows
- build, pull and update on Linux
- do not observe it hanging

Reviewers: durham, #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D1467
2017-11-22 14:15:06 -08:00
Phil Cohen
138e8bb8b2 test-progressfile: add test for HGPLAIN behavior
Differential Revision: https://phab.mercurial-scm.org/D1487
2017-11-21 16:11:34 -06:00
Jun Wu
01f8f8f86a progressfile: do not swallow the progress bar if statefile is not set
The statefile-not-set case was not tested. Previously the code will make
`ui._progbar` return None, which means no progress bar.

Also move the docstring to the header so it shows up in `hg help -e`, and
use modern config registrar to avoid devel warnings.

Test Plan:
Added a test

Differential Revision: https://phab.mercurial-scm.org/D1486
2017-11-21 14:11:34 -08:00
Durham Goode
d73bc0c506 treemanifest: add command for backfilling manifests revlog
Previously, once you transitioned to treeonly mode you had no way of switching
back to hybrid mode. This patch adds a hg backfillmanifestrevlog command to
refill a manifest revlog with any bits that are missing.

Differential Revision: https://phab.mercurial-scm.org/D1456
2017-11-21 12:31:27 -08:00
Jun Wu
d393146974 sparse: try reading from working copy first
Previously sparse will resolve working file context via its parent
unconditionally if the file is outside sparsematch (introduced by D788).
That could be problematic if the file only exists in working copy.

This patch changes it to always try working copy first (fast), then fallback
to parent commit if the file is outside sparse.

Differential Revision: https://phab.mercurial-scm.org/D1464
2017-11-20 13:56:55 -08:00
Jun Wu
898106ae0f sparse: add a test case showing suboptimal behavior
This is reported by users a few times.

Differential Revision: https://phab.mercurial-scm.org/D1463
2017-11-20 13:56:55 -08:00
Durham Goode
792cc88a63 fbamend: disable --to
We've received multiple reports that the command is broken. Let's disable it for
now.

Differential Revision: https://phab.mercurial-scm.org/D1465
2017-11-20 13:17:44 -08:00
Saurabh Singh
5b16b0ac57 prefetch: do not attempt to prefetch trees for draft commits
Summary:
After D1417, `hg prefetch` takes care of downloading both the files
and trees during the prefetch. However, when the command is run without any
options, it attempts to prefetch the trees for the draft commits which results
in an error. We should not even attempt to prefetch trees for the draft
commits.

Test Plan: Added a test to detect this case and ran all the tests.

Reviewers: #fbhgext, durham

Reviewed By: #fbhgext, durham

Subscribers: durham

Differential Revision: https://phab.mercurial-scm.org/D1446
2017-11-17 14:19:41 -08:00
Jun Wu
6f2f104c37 test-remotefilelog-datapack: use more packs for cdatapack code path
The number 200 was used before D1435. It caused trouble on systems with low
`ulimit -n` and with the Python datapack code path because Python's mmap
implementation keeps an internal fd for every mmap object and there is no
way to close those fds via pure Python API. But there is no such limit for
cdatapack after D1185. So let's change cdatapack test to use 200 packs.

Test Plan:
`ulimit -n 50` and `./scripts/unit.py`

Differential Revision: https://phab.mercurial-scm.org/D1442
2017-11-16 21:24:44 -08:00
Jun Wu
3469a6a437 test-remotefilelog-datapack: exercise cdatapack code path
In `fastdatapacktests.testPacksCache`, the C datapack code path should be
used.

Differential Revision: https://phab.mercurial-scm.org/D1441
2017-11-16 21:24:44 -08:00
Saurabh Singh
2520c63e45 prefetch: merge prefetchtrees command into prefetch
Summary:
Currently,

 - `hg prefetch` prefetches files.
 - `hg prefetchtrees` prefetches trees.

This commit removes `prefetchtrees` and makes `prefetch` responsible for
everything i.e. `prefetch` will prefetch whatever it can prefetch be it files,
trees, or both.

Test Plan: Ran all the tests.

Reviewers: #fbhgext, durham

Reviewed By: #fbhgext, durham

Subscribers: quark, durham

Differential Revision: https://phab.mercurial-scm.org/D1417
2017-11-16 15:28:07 -08:00
Saurabh Singh
fe26751847 prefetchtrees: add option to repack prefetched trees
Summary:
The `prefetch` command has an option to repack the prefetched files.
Eventually, we plan to merge `prefetch` and `prefetchtrees` into a single
command and therefore, this commit takes a step towards making the interface to
these commands exactly the same.

Test Plan: Ran all the tests.

Reviewers: #fbhgext, durham

Reviewed By: #fbhgext, durham

Subscribers: durham

Differential Revision: https://phab.mercurial-scm.org/D1416
2017-11-16 15:28:07 -08:00
Saurabh Singh
5c499e75b4 prefetch: add option to specify base revision
Summary:
Adding the option to specify the base revision in the `prefetch`
command. This can useful to limit the prefetch data and also makes the
interface of `prefetch` consistent with `prefetchtrees`. Soon, we will merge
`prefetch` and `prefetchtrees` into a single command and both commands having a
similar interface is useful for the merging.

Test Plan: Ran all the tests.

Reviewers: #fbhgext, durham

Reviewed By: #fbhgext, durham

Subscribers: durham

Differential Revision: https://phab.mercurial-scm.org/D1368
2017-11-16 15:28:07 -08:00
Jun Wu
a65624785c test-remotefilelog-datapack: add the exec bit back
The exec bit got lost after rebase.
The rebase bug was filed as https://bz.mercurial-scm.org/5743.

The file content change is to workaround a potential pushrebase bug that
does not allow mode-only change.
2017-11-16 14:40:20 -08:00
Jun Wu
2247a2f8df test-cstore: run native Python tests directly
Previously the test sets up `LD_LIBRARY_PATH` and `PYTHONPATH`, then runs
Python tests.

Within Python code, setting `sys.path` would achieve the same effect of
setting `PYTHONPATH`. For `LD_LIBRARY_PATH`, it's necessary for C libraries.
But the only C library that cstore depends on is `lz4`, which is supposed to
use the system version. There is no C library provided by this repo -
features like sha1 are compiled in `cstore.so`.

Therefore it's unnecessary to have a separate `.t` file wrapping `.py`
tests. Let's just use `.py` tests directly.

Test Plan:
`./script/unit.py`

Make a temporary change to `cdatapack.c` so it fails unconditionally in
open_datapack. Build the repo in different ways: `make local` and
`python2 setup.py build_clib build_ext`. Then run the test by using
`$HG_CREW/tests/run-tests.py -l test-remotefilelog-datapack.py` without the
`hg-dev` environment and make sure it fails with the expected exception.

Differential Revision: https://phab.mercurial-scm.org/D1429
2017-11-16 10:56:44 -08:00
Durham Goode
cd569729a1 tests: fix too many files error in datapack store
If the os limited a given process to a <200 files open, this test would fail.
Let's change the cache size to be smaller to avoid this.

Also, it turns out the cache size and number of packs created doesn't actually
seem to affect this test. I changed the numbers in a few ways and the test never
failed.

Differential Revision: https://phab.mercurial-scm.org/D1435
2017-11-16 10:04:36 -08:00
Phil Cohen
0cb66efe79 repack: sort orphan nodes by size
Add `repack.chainorphansbysize` (default True).

When enabled, we take all orphaned nodes (nodes that are not part of a chain),
and put them into a new chain at the end, so we can get some minimal
compression out of them. Right now, they default to each being stored as
fulltexts, which is wasteful.

We sort the orphan chain by size, descending, to make the largest version
quickest to access, on the assumption that it is probably the newest. (This is
what Git does for its packed data, and it is a decent fallback if ancestry is
not available)

Example chain output, before:
```
A->B C D->E->F G H
```

After:
```
A->B D->E->F G->C->H
(assuming len(G)>=C=>H)
```

(I'm still adding a test case, but the code itself could be reviewed.)

Differential Revision: https://phab.mercurial-scm.org/D1272
2017-11-15 22:23:04 -08:00
Jun Wu
c59e252ac9 test-remotefilelog-datapack: print more debugging information
We got exception:

  unable to load pack ...: [Errno 24] Too many open files

on OS X machine where we think `ulimit -n` is big enough.

Let's add some debugging outputs so we can have more clues about it.

Note: the Python implementation of `mmap.mmap` actually keeps a fd open [1].
So the fix (65c38ccb9835) only reduces fd count from 2 * N to N, but does
not really solve the issue.

We might want to enforce the native code path to work around Python mmap
implementation.

[1]:  # Modules/mmapmodule.c
      m_obj->fd = dup(fd);
      if (m_obj->fd == -1) {
          Py_DECREF(m_obj);
          PyErr_SetFromErrno(mmap_module_error);
          return NULL;
      }

Differential Revision: https://phab.mercurial-scm.org/D1420
2017-11-15 11:14:25 -08:00
Phil Cohen
d183f0fd68 tests: fix a laggart reference I missed 2017-11-14 19:02:51 -08:00
Phil Cohen
baa9059871 pushrebase: make conflict message a bit more helpful
A very minor change, but we should probably explain that local rebasing is
needed. (You might be forgiven for thinking that `pushrebase` would have
done that for you.)

Differential Revision: https://phab.mercurial-scm.org/D1352
2017-11-14 18:34:41 -08:00
Jeremy Fitzhardinge
d38c94c1d8 checkmessagehook: print more detail on what bad chars were found
Print which bad characters were found on what line, so that users can
fix the problem just from the hook message.

Differential Revision: https://phab.mercurial-scm.org/D1419
2017-11-14 16:52:45 -08:00
Saurabh Singh
45048c9f5e remotefilelog-datapack: reenable the test failing continuous integration
Summary: The TODO has been addressed and this test should be able to run now.

Test Plan:
 - Checked that test host is capable of running the test now.
 - Ran all the tests.

Reviewers: #fbhgext, mitrandir

Reviewed By: #fbhgext, mitrandir

Differential Revision: https://phab.mercurial-scm.org/D1369
2017-11-14 10:06:34 -08:00
Jun Wu
962f35a673 test-check: backport py3 compat check from core hg
Hopefully this could prevent new files without `absolute_import` being
committed.

Differential Revision: https://phab.mercurial-scm.org/D553
2017-11-10 12:12:04 -07:00
Martijn Pieters
234ca8ad39 sparse: list available and active profiles
This lets you list your currently active profiles, as well as let you discover
new profiles, provided sparse.profile_directory is set.

Includes JSON output. Future revisions can build on this to provide richer
metadata (parsed from the profile files).

Differential Revision: https://phab.mercurial-scm.org/D1250
2017-11-10 14:39:11 +00:00
Phil Cohen
defc5b9ca1 repack: add --packsonly option to repack
Occasionally, callers to `hg repack` prefer to skip loose objects and only
repack packfiles. This adds an option to do so.

Differential Revision: https://phab.mercurial-scm.org/D1228
2017-11-09 10:32:15 -08:00
Durham Goode
1c92cab224 treemanifest: improve server side incremental repack
Currently an incremental repack on the server will repack the entire pack files,
and the new parts of the revlogs. The pack files can be very large and can take
a long, long time to run. So let's use the normal incremental pack heuristics to
minimize how often we have to do full repacks.

Differential Revision: https://phab.mercurial-scm.org/D1350
2017-11-09 10:28:53 -08:00
Mateusz Kwapich
a07f54b7d2 remotefilelog: disable testPacksCache
Summary:
It's failing on our tests macs because they can't have that many files open at
the time

Test Plan: tested on my laptop, fingers crossed

Reviewers: #mercurial, ikostia

Reviewed By: ikostia

Subscribers: mjpieters, medson

Differential Revision: https://phabricator.intern.facebook.com/D6285344

Tasks: T23454758

Signature: 6285344:1510247301:f295431e05836921288c313034864c3ec616b8af
2017-11-09 09:08:45 -08:00
Saurabh Singh
c4ec4d2889 basepack: add a lru cache for the pack files
Summary:
To speed up pack lookups (especially when there are lots of packs), we
should maintain an lru ordering of the packs and perform searches in that
order, since it's likely the next entry we search for will be in the same pack
file as the last entry we searched for. This commit achieves the same.

Test Plan:
 - Ran all the tests.

 - Created ~2k pack files in a large repo.

  - Time taken without the cache:
    - `hg update b` while at a: ~18 minutes.
    - `hg update a` while at b: ~23 seconds.

  - Time taken with the cache:
    - `hg update b` while at a: ~14 seconds.
    - `hg update a` while at b: ~9 seconds.

Reviewers: #fbhgext, durham

Reviewed By: #fbhgext, durham

Subscribers: durham

Differential Revision: https://phab.mercurial-scm.org/D1208
2017-11-08 10:25:12 -08:00
Saurabh Singh
9063582c84 remotefilelog-datapack: refactor createPack method to include pack directory
Summary:
createPack had no option to specify the pack directory because of
which it can only create one pack in a directory. This restriction was in place
because we only test the datapack and not the datapackstore during these tests.
This commit makes the method more generic and includes the option to specify
the directory for creating the packs. This would allow for the datapackstore to
be tested while reusing most of the current logic.

Test Plan: Ran all the tests.

Reviewers: #fbhgext, durham

Reviewed By: #fbhgext, durham

Subscribers: durham

Differential Revision: https://phab.mercurial-scm.org/D1325
2017-11-08 10:25:12 -08:00
Maxime Montinet
dba2c32225 infinitepush: add support for deleting scratch bookmarks from local
Summary:
Add support to hg book -d to delete scratch infinitepush bookmarks

Uses functions from remotenames to rewrite the remotenames cache omitting
the specified scratch bookmarks

Test Plan:
cd ~/facebook-hg-rpms/fb-hgext/tests
source ../../hg-dev
rt test-infinitepush-*.t --extra-config-opt=devel.all-warnings=False

Reviewers: #mercurial, cdown, stash, durham

Differential Revision: https://phabricator.intern.facebook.com/D6221853

Tasks: T22615396
2017-11-07 11:43:56 -08:00
Durham Goode
c440ffa356 treemanifest: fix commit hooks for hybrid pushes
There is a bug in the upstream bundlerepo implementation that causes it to
infinite loop if the manifestlog isn't backed by a revlog. I've sent a fix
upstream, and this adds a test to cover that case.
2017-11-07 10:24:07 -08:00
Durham Goode
ee2c606728 treemanifest: support the {manifest} template
The core Mercurial manifest template prints the rev number and the short hash.
Since treemanifest doesn't have rev numbers, this has to change. Let's just have
it print the whole hash, since manifest hashes are usually only ever used by
automation which probably wants the whole hash anyway.

Differential Revision: https://phab.mercurial-scm.org/D1305
2017-11-07 09:06:24 -08:00
Durham Goode
579b7ba53d treemanifest: allow hybrid repos to make treeonly commits
If a hybrid repo pulls in a treeonly commit from a treeonly client, it
previously couldn't commit on top of it because it tried to read the flat
manifest. This patch makes it possible for the hybrid repo to make a treeonly
commit if it is committing on top of a treeonly commit (i.e. where the manifest
only exists in the tree store, not in the flat manifest revlog).

This makes it easier for multiple types of repositories to interact, and to flip
back and forth between treeonly and non-treeonly as we migrate.

Differential Revision: https://phab.mercurial-scm.org/D1304
2017-11-07 09:06:24 -08:00
Phil Cohen
d4642ef2ca debugdatapack: suppport passing multiple files
Also print the name of the packfile being inspected, and \itweak newlines a bit.

This simplies debugging several packfiles in tests.

Differential Revision: https://phab.mercurial-scm.org/D1326
2017-11-06 19:09:15 -08:00
Durham Goode
5987282c25 treemanifest: test commit hooks with pushrebase 2017-11-06 17:26:08 -08:00
Phil Cohen
ef47b31d2f debugdatapack: print delta and blob size totals and compression %
Also print "(empty name)" if the filename is empty.

Differential Revision: https://phab.mercurial-scm.org/D1259
2017-11-05 21:45:40 -08:00
Phil Cohen
a8cfab1484 repack: add blob size to metadata if it's missing
When trees are fetched from the server as packs, metadata isn't included, as
it's not supported in the protocol. Fast size information is useful, since
we have access to the fulltext during a repack, add the metadatan then.

This will be needed for sized-based sorting of manifest entries.

Differential Revision: https://phab.mercurial-scm.org/D1255
2017-11-05 18:49:10 -08:00
Phil Cohen
53d2c02095 debugdatapack: add blob size
It's useful to know the size of the resultant object, not just the delta entry.

Differential Revision: https://phab.mercurial-scm.org/D1254
2017-11-05 18:45:21 -08:00
Durham Goode
d89d7b5249 tests: update with upstream obsmarker changes
Upstream has enabled the effect flag metadata by default. Add it to our test
output.
2017-11-03 12:40:04 -07:00
Durham Goode
8f4b8e3894 treemanifest: add sendtrees config back
It turns out we have some machines that don't have treemanifest enabled, so we
need to add back the config that prevents a client from sending trees.
2017-11-03 09:24:39 -07:00
Pulkit Goyal
d3b6e1c63c fbhistedit: add support for json input to histedit
This patch adds support to histedit command to take input from json. The JSON
should be of following format:

{ "histedit": [
                {"action": "...", "node": "..."},
                {"action": "...", "command": "..."},
                {...}
              ]
}

For actions except "exec" and "execr", "node" is required and for "exec" and
"execr", "command" should be there.

The support is plugged in directly and is not hidden behind a config flag. After
this support, the parser which parses the commands file will assume that JSON is
given and will fallback to original parsing if it fails to convert the data in
the file to JSON.
In case where input is JSON but a key is missing, status message is shown and we
fallback to normal parsing.

Both small and large verbs are supported for the action part in JSON.

Differential Revision: https://phab.mercurial-scm.org/D1263
2017-11-03 05:30:12 +05:30