Commit Graph

13521 Commits

Author SHA1 Message Date
Durham Goode
dab12d9939 remotefilelog: test for bad ancestor traversal
Summary:
Adds a test that demonstrates a bug in our ancestor traversal logic.
The test requires very particular circumstances:

Assuming a file x was modified to x' then renamed to z:

1. The rename is required because the bug is in keeping track of the copy source name
2. Version x' must be in the same pack as version z, because the bug is in the
logic that traverses a single packs history.
3. Version x must be in a different pack than x' and z, because the bug is about
trying to look up version x after having lost track of the correct name when
going from z to z'.
4. We must be using rust historypacks, because that implementation attempts to
traverse the entire history within the pack, while the python implementation
stops at renames.

Reviewed By: kulshrax

Differential Revision: D13332458

fbshipit-source-id: b01d09fb8ebd27414e4f6dba06a6d0b1f26ac13c
2018-12-06 11:07:21 -08:00
Jun Wu
c92e6755d7 plain: add a diff exception
Summary:
Oculus wants to preserve the "do not show binary diff" config while running
`hg export` in automation, since printing the binary diff might just OOM the
container. Let's add a plain exception for it.

Reviewed By: zhh95

Differential Revision: D13111212

fbshipit-source-id: 34af58ac0917de3b3231e637774896d882585e26
2018-12-05 19:23:41 -08:00
Jun Wu
1a18688d9f tests: add a test showing some corner cases in matchmod.match API
Summary: As the title. To help decide the right way for D13332653.

Reviewed By: DurhamG

Differential Revision: D13333157

fbshipit-source-id: 4fe44fffa48409e790efc1ba7b0d681350512eac
2018-12-05 17:58:42 -08:00
Xavier Deguillard
108b8f9d41 treemanifest: corrupt the treemanifest in a test.
Summary:
We've seen corrupted repository in the wild on which we were unable to garbage
collect. Let's add a test to verify that the other repositories will be garbage
collected.

Reviewed By: DurhamG

Differential Revision: D13328487

fbshipit-source-id: 6f6a69d14455d00e468c5b9186d65cca8fd5c1c3
2018-12-05 09:09:18 -08:00
Durham Goode
d8cece61d0 hgsubversion: add truncatemeta command
Summary:
In a future diff we want pushrebase to be able to rewrite commits
pulled from svn. In that situation, we need to be able to rewrite the svn
metadata so that the post-pushrebase commits are mapped to the svn rev numbers.

Let's add a truncatemeta command that will walk the latest commits in the
changelog and redo any that aren't mapped correctly.

Reviewed By: markbt

Differential Revision: D13074960

fbshipit-source-id: fe98879dd16cc0806d20ef6eab5f9d77f0e0c877
2018-11-30 10:32:41 -08:00
Saurabh Singh
c2af69fdf8 bookmarkstore: fix the logic to malform store in tests
Summary:
D13267528 malformed the bookmark store files for testing by deleting a
random file. This makes the test flaky since sometimes a non critical file is
deleted and the exception is not raised. Therefore, lets malform the store more
reliably by truncating all the files in the store.

Reviewed By: ikostia

Differential Revision: D13271362

fbshipit-source-id: 684ffbcdc59e943476a6acc2c4152bf65cc12e1f
2018-11-30 05:28:21 -08:00
Kostia Balytskyi
650abf4b9e tests: stop importing sparse from an explicit python file
Summary:
Importing anything from python files with explicit breaks embedded
aproach we use on Windows.

For one of the tests, I did add `hg debugshell -c "from hgext import sparse;
print sparse.__file__` just to make sure the same file is used in practice.

Reviewed By: singhsrb

Differential Revision: D13258984

fbshipit-source-id: 4c86e1dccfd4f525a14019dc4b9586d798f2bffe
2018-11-30 02:19:16 -08:00
Saurabh Singh
b3b2fedeb3 bookmarkstore: fix the tests
Summary:
D13133605 changed the python bookmark store  API and broke the tests.
To fix, I have migrated the tests to use the new API. Also, since most of the
tests was just python code, I have moved the test from being a `.t` test to a
`.py` test.

Reviewed By: quark-zju

Differential Revision: D13267528

fbshipit-source-id: 69b5a7110f63ea60e1bac402064edbffbf64420f
2018-11-29 15:04:23 -08:00
Mark Thomas
76078c9f23 commitcloud: pull in changes if maxage changes or full is specified
Summary:
If full is specified, or the maxage config option changes from one sync to
another, we need to actually pull in the new commits.  Since the version number
won't necessarily have changed, we need to request a full copy of the cloud
workspace to work from.

Reviewed By: liubov-dmitrieva

Differential Revision: D13214274

fbshipit-source-id: b21594c04c05f065caf9f9dc494e6274debbde5c
2018-11-27 07:20:30 -08:00
Mark Thomas
11cfc47382 commitcloud: don't bump version when there are omissions
Summary:
Stop comparing the local heads and bookmarks with the full cloud heads and
bookmarks when some heads or bookmarks have been omitted.  Since they're
omitted, they won't be there.

Reviewed By: liubov-dmitrieva

Differential Revision: D13214275

fbshipit-source-id: 35a897f053f58d0793d384ff60b8202e80aec0c7
2018-11-27 07:20:30 -08:00
Liubov Dmitrieva
bd569c3f32 commitcloud: fix omission logic if a bookmark was removed
Reviewed By: markbt

Differential Revision: D13196329

fbshipit-source-id: 78fd305dc9520f735383cd6e86bf020cb891c02e
2018-11-27 04:20:57 -08:00
Kostia Balytskyi
3e70d22bf6 hgbuild: run all tests with hg.rust rather than with python-based hg
Summary: Since we are using `hg.rust` with everything, we should also test it.

Differential Revision: D13121588

fbshipit-source-id: 3a4e07c1d70c279f008812d026bf9a7c74aa3b2e
2018-11-22 07:41:41 -08:00
Durham Goode
39d85694ed pushrebase: don't prepopulate manifest caches
Summary:
This had a nasty bug where it manually computed the cached base text
using the full manifest text. When operating in a treeonly repository, this
resulted in corrupt deltas. The only reason we didn't hit it earlier is because
the secondary stackpush path was added and doesn't have this issue. But it
couldn't handle merge commits, which is why we hit this when it came time to add
a merge commit.

Now that the main repo that needed this optimization is treeonly, we don't need
this precaching anymore.

Reviewed By: mitrandir77

Differential Revision: D13154342

fbshipit-source-id: 5cb74167665a60a36e4a6d926f3f9f1c5c7bbef1
2018-11-21 08:33:48 -08:00
Durham Goode
9a40d36329 pushrebase: add test demonstrating corruption with treeonly
Summary:
There's a corruption that occurs because pushrebase caches a fulltext
instead of a tree. Let's write a test to expose it. The next diff will fix it.

Reviewed By: mitrandir77

Differential Revision: D13154341

fbshipit-source-id: e2ac040c59c677b414b6eddd39d7dc2ebb25f082
2018-11-21 08:33:48 -08:00
Kostia Balytskyi
11336ed4d5 tests: fix grep finding grep in rage output
Summary:
Fix tests.
This makes sure that the grep process itself is not matched.

Reviewed By: farnz

Differential Revision: D13138516

fbshipit-source-id: d29829584c6fe34dd60345b2812682d4cb9d51e4
2018-11-21 07:30:31 -08:00
Liubov Dmitrieva
665ea1b9ee commitcloud: print message in hg sl --all when commits are omitted
Summary:
When we have omitted syncing commits from the cloud workspace, give the user
advice on what to do to fetch them if they run `hg sl --all`.

Reviewed By: markbt

Differential Revision: D13085505

fbshipit-source-id: 624ce6cbf4cb2194ab5ffbc09c1ac3e073932249
2018-11-21 06:01:46 -08:00
Mark Thomas
38cc6a356c help: fix stablerev help summary in test
Differential Revision: D13118834

fbshipit-source-id: 4cbcdf261e145acdfc260f2884d39ca0420b606f
2018-11-19 06:38:28 -08:00
Kostia Balytskyi
e788232917 chg: make sure CHGDISABLE is set for non-chg tests
Summary: Now that `chg` is embedded into `hg.rust`, we need to explicitly disable it while tests run.

Reviewed By: quark-zju

Differential Revision: D13021560

fbshipit-source-id: 843045f3bc9d9866e421f0bf0aa132849e5b338f
2018-11-19 06:15:32 -08:00
Jun Wu
61f0a3da45 tests: add a test-check test that runs fix-code.py
Summary:
Add "--dry-run" for fix-code.py and use it in test-check.
This avoids license header and version = "*" issues.

Reviewed By: ikostia

Differential Revision: D10213070

fbshipit-source-id: 9fdd49ead3dfcecf292d5f42c028f20e5dde65d3
2018-11-15 18:54:06 -08:00
Mark Thomas
a3c411c1e8 commitcloud: omit older commits when pulling during sync
Summary:
Add a new config option: `commitcloud.max_sync_age`.  When set, commit cloud
will not pull in any commits that are older than this when it is joining or
syncing.  The commits are still nominally in the cloud workspace, we just
save join or sync time by not including the commits.

Reviewed By: liubov-dmitrieva

Differential Revision: D13062470

fbshipit-source-id: 17a4bdb4095766a83a4bf6d4151ae86b39edf59c
2018-11-15 12:16:19 -08:00
Phil Cohen
5564b837bc rebase: always return 0 on noop rebase
Summary:
tweakdefaults used to do this if configured.

After dicussion with the team, we decided that returning 1 was not a helpful design decision, so we're going to fold this in here and everywhere.

Reviewed By: singhsrb

Differential Revision: D13050548

fbshipit-source-id: 66e834ea503e4b1339e369495a9729b951024a6d
2018-11-13 16:35:31 -08:00
Phil Cohen
4b9fdcd042 stablerev: add getstablerev() revset
Summary:
This allows us to expose `arc pull`'s functionality directly from hg.

There are three parts:

- Create a revset that runs a program, reads the stdout and looks up that commit if it exists
- Auto-pulling if the commit doesn't exist
- Supporting an optional argument (target) that's passed to the script

Reviewed By: DurhamG

Differential Revision: D10524541

fbshipit-source-id: 7493c5592e272f9e8a87f109cec1426d44935ecc
2018-11-12 13:38:49 -08:00
Pavel Aslanov
41c2048ce6 record updated onto rev
Summary:
We need to record updated onto rev instead of guessing it in pushrebase replayer.

I will not land this diff until mononoke db schema is update D12923144, D12997125

Reviewed By: quark-zju

Differential Revision: D12922833

fbshipit-source-id: 11c6411c392ca9092be53ffba8baa074faf3a996
2018-11-12 04:17:37 -08:00
Durham Goode
b6a2776924 remotefilelog: make pending local pack writes available for reads
Summary:
Previously, if we were writing local data to pack files we weren't able
to read that data until the pack file had been flushed. Let's add those mutable
packs to the union store so we can see there data.

This is important for unblocking use of hggit and hgsubversion since they may
import many dependent commits in a single transaction.

Reviewed By: quark-zju

Differential Revision: D12959497

fbshipit-source-id: 405c0c5c1e8fc84bc8ffef827a84e91d57eb95d8
2018-11-11 21:37:52 -08:00
Durham Goode
f1d6212c00 remotefilelog: add test showing issue with packlocaldata
Summary:
The config to write local packs has an issue with reading data from
currently pending mutable packs. Let's add a test demonstrating this, and in the
next diff we'll fix it.

Reviewed By: quark-zju

Differential Revision: D12959501

fbshipit-source-id: 5bcb278ccb977cea83e8cd594a404816d4f8f1fa
2018-11-11 21:37:52 -08:00
Marla Azriel
4027f3a7e9 commands: update help text for smartlog, show, diff
Summary: Provides updated help text for hg smartlog, hg show, and hg diff

Reviewed By: markbt

Differential Revision: D12950765

fbshipit-source-id: d442079499abada1740760c8b6d0c27bf4a2b2d3
2018-11-09 13:14:20 -08:00
Aida Getoeva
1c7a7e8eb2 debugcrdump: add --nobinary flag to avoid dumping binaries
Summary: Jellyfish uses `hg debugcrdump` to get commit data, including binary files. Now we want in jf to be able avoid dumping binary files, so I added `--nobinary` option to crdump

Reviewed By: quark-zju

Differential Revision: D12981968

fbshipit-source-id: 669ef4cf8f6225b911f5085c1a47fb7242f259bf
2018-11-09 08:50:37 -08:00
Jun Wu
4a49dc876f crecord: fix line number in hunk header
Summary:
`@@ -1,1 +-1,0 @@` is not a valid patch hunk header.
Change it to `@@ -1,1 +0,0 @@`.

This is a backport of my upstream patch https://phab.mercurial-scm.org/D3737

Reviewed By: singhsrb

Differential Revision: D12970975

fbshipit-source-id: eb769e93076efc932a8c4be7387ba21933aae331
2018-11-08 12:34:36 -08:00
Marla Azriel
96cb1050bc commands: update help summary text
Summary: Updated the global help summaries that are displayed for each command when you run 'hg help' and fixed corresponding tests

Reviewed By: markbt, kulshrax

Differential Revision: D12832280

fbshipit-source-id: 950dad1c805feab573d7d0182da523ae12299d3b
2018-11-07 19:59:47 -08:00
Jun Wu
4401ea1473 tests: add a test showing sparse issues
Summary: There are multiple issues here. Expose them.

Reviewed By: DurhamG

Differential Revision: D10861608

fbshipit-source-id: 5e55e4550574b0955eec92b70c700599eebccc6e
2018-11-07 16:36:41 -08:00
Kostia Balytskyi
825a9ddee5 windows: implement a more atomic rename/replace
Summary:
Our `rename` is not atomic:
```
def rename(src, dst):
    """Rename file src to dst, replacing dst if it exists"""
    try:
        os.rename(src, dst)
    except OSError as e:
        if e.errno != errno.EEXIST:
            raise
        unlink(dst)
        # What if the process is interrupted here?
        os.rename(src, dst)
```

However, the `MoveFileEx` Windows API provides a way to to
replace the existing file, thus eliminating the need to do `unlink`.

Unfortunately, it only works for files, not for dirs, therefore
we're introducing a new file-specific rename function.

Differential Revision: D12940555

fbshipit-source-id: a6749a9b16a285788de0f5c06d51a15c919166ce
2018-11-07 10:37:23 -08:00
Mark Thomas
088e0a8ed6 pushrebase: only prevent phase updates if replacements received
Summary:
If the commits being pushrebased don't actually need to be rebased, pushrebase
will accept them like a normal push.  In this case we shouldn't prevent them
from be changed to public commits on the client.

Track this by detecting whether we receive a changegroup part from the server.
If we do, only the commits that are marked as replaced with obsmarkers (if
enabled) can be marked as public.

Reviewed By: quark-zju

Differential Revision: D12944851

fbshipit-source-id: 44f8fc17b36397d949cba5d3e787fad813bab4ea
2018-11-07 04:32:46 -08:00
Mark Thomas
9b4c89abe5 pushrebase: add test demonstrating pushrebase phase change failure
Summary:
When pushrebase is enabled, pushing a commit that doesn't result in any
rebasing action acts like a normal push (the commit is not modifed and a new
hash is not returned), however the phase update doesn't apply, so the commit
remains draft.

Reviewed By: quark-zju

Differential Revision: D12944850

fbshipit-source-id: 2145d9b7eebc27bfdff34544e73802c13f30dbd2
2018-11-07 04:32:46 -08:00
Saurabh Singh
b496efcc9a test-hgsubversion-globalrevs: test revset interoperability
Summary:
D12888964 added the capability for `svnrev` revsets to be
interoperable with the `globalrev` revsets. This commit adds the tests for it.

Reviewed By: quark-zju

Differential Revision: D12888960

fbshipit-source-id: 07b12632d534a329c32179e978b058b1e427e688
2018-11-06 16:42:11 -08:00
Saurabh Singh
ff98fdcc08 test-hgsubversion-globalrevs: remove the capturing ui
Summary:
The capturing UI is not required as we can use the much cleaner
`ui.pushbuffer`/`ui.popbuffer` for the intended purpose.

Reviewed By: quark-zju

Differential Revision: D12906912

fbshipit-source-id: ae93e6417135ca23b28a11af63745464344fa3cf
2018-11-06 16:42:11 -08:00
Saurabh Singh
32b539a13a test-hgsubversion-globalrevs: add useful params to the assert log method
Summary:
This method always prints the graph for the commits in the repository.
This commit adds supports for specifying any revset as input for the log and
also, makes printing the graph optional.

Reviewed By: quark-zju

Differential Revision: D12888965

fbshipit-source-id: 794606fa17f9836fd73675d36d11220b11994f41
2018-11-06 16:42:11 -08:00
Saurabh Singh
e9ebb554f3 test-hgsubversion-globalrevs: include svnrev in tests instead of rev
Summary: The `svnrev` is more useful than the `rev` in this context.

Reviewed By: quark-zju

Differential Revision: D12888963

fbshipit-source-id: a902c57ecc3bc3eca9da77ab6e14ef58512d5ad8
2018-11-06 16:42:11 -08:00
Saurabh Singh
6f25c6e5c9 hgsubversion: support resolving revset string with prefix 'r' during tests
Summary:
This is required for testing `globalrevs` integration with
`hgsubversion`. In particular, we will test out whether we can resolve
`r<svnrev>/r<globalrev>` correctly later. Seems like this configuration should
be on during all the tests because it is the configuration we use in
production. Therefore, this commit in resolves revset string with prefix `r`
for all the `hgsubversion` tests.

Reviewed By: quark-zju

Differential Revision: D12888961

fbshipit-source-id: af9b2e1aea9771f42fe1fb2d3f9a759a926b1ce3
2018-11-06 16:42:11 -08:00
Saurabh Singh
0d204fba6f globalrevs: introduce configuration for specifying valid starting revision
Summary:
We need a configuration option for specifying the starting revision
beyond which we will consider the global revisions associated with the commit
valid for the following reasons:

 - It lets us have the flexibility to support `globalrevs` from a commit of our
   choice.
 - We need this configuration to decide when we should fallback to looking at
   the `svnrev` instead of the `globalrev`.

Reviewed By: quark-zju

Differential Revision: D12888966

fbshipit-source-id: 46d6314886ed5074edb537ba340d5606ec354619
2018-11-06 16:42:10 -08:00
Durham Goode
718d19fce6 datapack: fix not including rename information in datapack blobs
Summary:
It turns out data packs contain the exact mercurial file blob,
including the rename metadata header. This is different from how loose files work, which
contain the non-headered text and instead store the rename in the history at the
end of the file.

Ideally we'd change datapacks to not store the metadata version of the file, but
unfortunately this is how it has always been, so instead we must change the
commit-straight-to-pack code to write the headered blob.

Differential Revision: D12936247

fbshipit-source-id: 3f909d2964d7f7200ac0e31e47bd195b0c9b03e5
2018-11-06 14:06:55 -08:00
Mark Thomas
529aa8872e absorb: use ngettext for message plurals
Summary: Pluralize messages using ngettext.

Reviewed By: quark-zju

Differential Revision: D12921683

fbshipit-source-id: a8dce90b3b9318597f888a8aca72351012de05ae
2018-11-06 03:19:01 -08:00
Aida Getoeva
dc09d0c75c move contentstore pending from localrepo to shallow
Summary: Not all of the repos are remotefilellog, so I moved some invocagions of the content store to shallowrepo and added requirements check where the transaction is processsed in localrepo

Reviewed By: quark-zju

Differential Revision: D12881916

fbshipit-source-id: 1119debd1e3d42cdf9513a6cae4bad4c000cc046
2018-11-05 07:53:24 -08:00
Mark Thomas
d15af3f239 cmdutil: remove amend message template
Summary:
Based on discussions about the best approach for solving the amend message
problem, back out the template previously added.  We will use a different
approach.

Reviewed By: mitrandir77, liubov-dmitrieva

Differential Revision: D12921753

fbshipit-source-id: ca760ffe14bfe473b7526a1b84a8cfc6b0257bf2
2018-11-05 06:28:03 -08:00
Jun Wu
f556edd8a4 fsmonitor: add migration to toggle tracking ignored files
Summary:
It turns out tracking ignored files does have an impact on status performance.
Filtering out the ignored directories is not that fast, and ignored files can
be scattered everywhere (like ".pyc", ".iml" files) that makes them harder to
be filtered out efficiently.

Add code paths to migrate between "ignored tracked" and "ignore untracked".
Store the metadata in treestate.

Reviewed By: phillco

Differential Revision: D12916021

fbshipit-source-id: e02d0c6f3b1a036f70703c11f35381c594e2f8e5
2018-11-03 11:12:56 -07:00
Jun Wu
9719d371db treestate: add a debug command to list treestate content
Summary: This is to replace `debugstate -v`. The latter does ont list untracked files.

Reviewed By: DurhamG

Differential Revision: D12906649

fbshipit-source-id: b84f41dfadff4932c0ddd48480a4aa03db88cab0
2018-11-03 11:12:56 -07:00
Phil Cohen
cbf94e4a87 hgsubversion: add SVN error code to "Outgoing changesets parent is not at subversion HEAD"
Summary: We'd like to identify which of the three underlying conditions cases this exception.

Reviewed By: quark-zju

Differential Revision: D12870572

fbshipit-source-id: 45724ad6bb3582c04a6ea3c0b7a748bf72219b93
2018-10-31 14:02:30 -07:00
Saurabh Singh
a761dbd527 test-fb-hgext-tweakdefaults-grep: fix the test
Summary:
This test is broken after D12849852 because the grep outputs the files
in different order during multiple test runs. Let's fix it by sorting the
output from the command.

Reviewed By: phillco

Differential Revision: D12869810

fbshipit-source-id: 49073e83e926e94db5f0bd290d74845ebfde0bb6
2018-10-31 12:09:24 -07:00
Wez Furlong
e24e242728 hg: make hg portion of biggrep grep output have deterministic ordering
Summary: This is nicer for the user and makes the test not be flakey.

Reviewed By: quark-zju

Differential Revision: D12860852

fbshipit-source-id: 6ccb0ca679dc25a80730e83a26a39dd3becb5c8f
2018-10-31 11:59:25 -07:00
Mateusz Kwapich
c697c8b81a commands: avoid implicit bool cast in "update" parameter validation
Summary: This fixes the "hg prev" targetting the first commit in the repo. The problem was the rev `0` which casted to false in all the checks.

Reviewed By: phillco

Differential Revision: D12840237

fbshipit-source-id: 594a2725fa125ee713f347379c875ec54b80a53d
2018-10-31 10:27:53 -07:00
Mateusz Kwapich
292728707f tests: set disallowemptyupdate in "hg prev" test
Summary:
This brings the config closer to what we use and uncovers some problems with
disallowemptyupdate itself.

Reviewed By: phillco

Differential Revision: D12840239

fbshipit-source-id: 77740b79114c7d901b0181e0e425aea4e9c7c570
2018-10-31 10:27:53 -07:00