Commit Graph

43270 Commits

Author SHA1 Message Date
Adam Simpkins
24d06c02aa fix hg rage error handling on non-Windows platforms
Summary:
WindowsError is only defined on Windows platforms.  On non-Windows platforms
this could cause rage failures like this one: P59496908

This updates the code to just catch `OSError` since `WindowsError` derives from
`OSError` on Windows.

Reviewed By: phillco

Differential Revision: D7856903

fbshipit-source-id: cf56c24eb52bb1da5dcd94ef56a3f8eb5fd849e1
2018-05-02 21:08:32 -07:00
Saurabh Singh
7fa81be4df fix building rpm on osx
Summary: D7840688 broke building RPM on OSX. This commit fixes the same.

Reviewed By: quark-zju

Differential Revision: D7854180

fbshipit-source-id: 4d3e4c87da777930780ad53888c13a41aab6c6e4
2018-05-02 17:36:01 -07:00
Jun Wu
841114e210 sparse: skip checking files outside sparse for absorb's case
Summary:
The logic was added by D2594568 and is intentional for "repairing" dirstate.
It's O(working copy). That makes absorb super slow. Therefore let's use the
new "exact" flag to skip the slow path.

Reviewed By: mitrandir77

Differential Revision: D7818728

fbshipit-source-id: a3a7d6074bd0240b9e1919e18d3e0b95daf74a64
2018-05-02 17:16:01 -07:00
Jun Wu
0fb4933a1e absorb: use dirstate.rebuild(exact=True)
Summary:
Previously, absorb patches fsmonitor to skip invalidating fsmonitor state
during dirstate.rebuild. Now let's use the added "exact" parameter to avoid
the monkey patching.

Reviewed By: mitrandir77

Differential Revision: D7818729

fbshipit-source-id: 0db41c7609277acd4823101e5569cbbe80f7580e
2018-05-02 17:15:50 -07:00
Jun Wu
1b475a874d dirstate: add an "exact" parameter to "rebuild"
Summary: This is a hint for performing certain fast paths.

Reviewed By: mitrandir77

Differential Revision: D7818730

fbshipit-source-id: 4adcf8724b462d8d652e8e580d6a36eebc46a0f8
2018-05-02 17:15:40 -07:00
Jun Wu
77638ffcc0 treedirstate: actually enable it in tests
Summary:
Previously it is not actually used.

`test-hgext-repogenerator.t` changed because treedirstate uses random
number to generate file names.

`fakedirstatewritetime.py` was updated to be treedirstate-aware. This
makes test-revert.t test-merge-tools.t test-merge1.t pass.

Reviewed By: singhsrb

Differential Revision: D7844960

fbshipit-source-id: 33a1d0d4a8e22ea5e6bb6454956884571fcf6bab
2018-05-02 17:15:36 -07:00
Jun Wu
b055d6aace cleanup: remove "fb/" from test-check tests
Summary:
Either fix or ignore issues in `fb/` so the test is consistent if run
externally.

Reviewed By: DurhamG

Differential Revision: D7850647

fbshipit-source-id: 0f7faa3be2dff1dcf61a3b765c1827583fafc14f
2018-05-02 14:01:09 -07:00
Kostia Balytskyi
c8861cea97 windows: implement cachestat using win32.fileinfo
Summary:
`GetFileInformationByHandle` returns a `BY_HANDLE_FILE_INFORMATION` structure,
which is similar to what a `stat` call returns. In particular, this structure
contains:
- the `VolumeSerialNumber` field
- the `CreationTime` fields
- the `LastWriteTime` fields
- the `FileSize` field
- the `FileIndex` fields

All of these are self-explanatory, except for the `FileIndex`. Here's what MSDN says:
```
The identifier that is stored in the nFileIndexHigh and nFileIndexLow members is called the file ID.
...
In the NTFS file system, a file keeps the same file ID until it is deleted.
You can replace one file with another file without changing the file ID
by using the ReplaceFile function. However, the file ID of the replacement file,
not the replaced file, is retained as the file ID of the resulting file.
```

Basically, every change to a file, except replacing it with some other file,
results in a changed file Id. Calling `ReplaceFile` however results in
`CreationTime` preserved from the replaced file and `LastWriteTime` preserved
from the replacement file:
```
C:\Code\tries\windowstries
λ python fileinfo.py
1.txt: Attr;32;Create;4064609256;30663014;Write;3046340864;30663166;Volume;1792064959;Size;0;5;Idx;655360;547898
2.txt: Attr;32;Create;3030045984;30663166;Write;3030172944;30663166;Volume;1792064959;Size;0;5;Idx;786432;565725
Replacing 1.txt with 2.txt;  result is:  1
1.txt: Attr;32;Create;4064609256;30663014;Write;3030172944;30663166;Volume;1792064959;Size;0;5;Idx;786432;565725
```

Thus comparing all of these fields seems to be enough to replicate the `cachestat` beharior from `posix.py` (We
cache the `stat` of a file, which we almost always expect to change by renaming into it. We only use this `cachestat`
while our process is alive. One notable exception is the `.hgignore` file, which the user can change as they please,
but which we still `cachestat`.)

This change has performance implications for `status` if we use `.hgignore`: it's nearly 0.1s faster.
If we use `.gitignore`, there are no performance implications (at least I did not find any), but I'd still like
to land it for the sake of feature parity between Posix and Windows.

Reviewed By: quark-zju

Differential Revision: D7843746

fbshipit-source-id: f6f69ee12bdce054d7ea77917e83a95bcec17f83
2018-05-02 08:38:59 -07:00
Kostia Balytskyi
d363d016c6 win32: make _getfileinfo accessible from other modules
Summary: Next diff in the stack accesses it from `windows.py`.

Reviewed By: quark-zju

Differential Revision: D7843747

fbshipit-source-id: fa9458a3ac4e66013f61c92d8ebc41b0859d4e37
2018-05-02 08:38:59 -07:00
Kostia Balytskyi
dd69de9b1c rage: finish oncall option cleanup
Summary: Finishing D7142733

Reviewed By: farnz

Differential Revision: D7844879

fbshipit-source-id: ffca2fc1e7b8f6dd608f2c2baae1a336d3f88dcf
2018-05-02 08:38:58 -07:00
Adam Simpkins
844ae16cea support finding pyre2 as "re2"
Summary:
Update the buck build rules to depend on the pyre2 third-party library, and to
try importing it using the module name `re2`.

Reviewed By: ryanmce

Differential Revision: D7840688

fbshipit-source-id: 21156958f42cdcf61f4dfdb2c6eccf95e657fcd1
2018-05-01 20:34:57 -07:00
Jun Wu
3368506521 tests: fix test-check-code.t
Summary:
There is a proper way [1] to skip the dict check-code check. Let's use it.

[1]: a61ed1c2d7

Reviewed By: DurhamG

Differential Revision: D7831336

fbshipit-source-id: a5e654e9e94cbfb1c5a07b047eb6e5451904c48e
2018-05-01 14:17:43 -07:00
Mateusz Kwapich
be9c5d754b fix pyflakes.t failure
Summary: Our CI didn't catch when I landed the previous diff.

Reviewed By: singhsrb

Differential Revision: D7834066

fbshipit-source-id: a51c2a294ea550917836f8b1eede2570838b60b7
2018-05-01 13:44:40 -07:00
Mateusz Kwapich
3e05d1c44a fix test outputs to unbreak the builds
Reviewed By: markbt

Differential Revision: D7831727

fbshipit-source-id: 65b2c5047a6738cda2e07d9bd319cfdc3db20b3f
2018-05-01 11:11:54 -07:00
Jun Wu
67b4301002 extensions: always turn on treedirstate
Summary:
This would make tests run on treedirstate.

To avoid issues with Eden pulling from a non-eden treedirstate repo,
treedirstate is changed to be "always on" and disables itself on an eden repo.

The extension list is changed to a set for efficient `__contains__` test.

Reviewed By: phillco

Differential Revision: D7769804

fbshipit-source-id: d328fe51ef67c4730cfc53f43bdfc48c2765c541
2018-05-01 08:18:36 -07:00
Mateusz Kwapich
626759e564 add short_list support to argparse
Summary:
We mark some hg commands as appearing in short help, let's add this
to our parser

Reviewed By: quark-zju

Differential Revision: D7779270

fbshipit-source-id: 0c2b790f1994205ae4dbf7cd12ac3ba7f5ef39ad
2018-05-01 04:26:26 -07:00
Mateusz Kwapich
cc3ed51d7f importer of command defninitions from python hg to rust
Summary:
Let's check-in the definitions for now. In the future those should be generated
every build with all the extensions enabled - like in prod.

Reviewed By: quark-zju

Differential Revision: D7779273

fbshipit-source-id: f0d5c5260be74c5f64c0945004bf60399a6e8c4c
2018-05-01 04:26:26 -07:00
Jun Wu
8f8adff716 treestate: add getter and setter of watchman clock to TreeState
Summary: Previously they cannot be changed.

Reviewed By: markbt

Differential Revision: D7769658

fbshipit-source-id: 4548eb90a82e9bd85fadf6a6f356cca7352fff0d
2018-04-30 19:10:45 -07:00
Jun Wu
224fe91344 treestate: add write methods to TreeState
Summary:
This allows writing `TreeState` state in two ways - save as a new file, or
incrementally update an existing file.

Reviewed By: markbt

Differential Revision: D7748822

fbshipit-source-id: 472b78af6cf7ea79968460a51ec824eaa96e4973
2018-04-30 19:10:45 -07:00
Jun Wu
a34b11ec8d treestate: make Tree write methods return BlockId
Summary: They are used by the next diff.

Reviewed By: markbt

Differential Revision: D7748834

fbshipit-source-id: 9562204975d83a8dce6eb80d2677387e24f8f0a0
2018-04-30 19:10:45 -07:00
Jun Wu
0923d108be treestate: add map-like operations to TreeState
Summary:
The method names are inspired by std HashMap. The types are slightly
different due to `Tree` implementation details.

Reviewed By: markbt

Differential Revision: D7748828

fbshipit-source-id: fc24481cdf0054c8e879d760082e192e52afc7f5
2018-04-30 19:10:45 -07:00
Jun Wu
b15a1b747f treestate: add Tree.get_mut
Summary:
The `Tree` object can return an `&mut` entry easily. Let's expose the
interface. This could be useful when the caller only wants to modify part of
the file state. For example, changing `copied` without touching anything
else.

Reviewed By: markbt

Differential Revision: D7748820

fbshipit-source-id: 430fa8ee310297c61866695a692134daf519e78d
2018-04-30 19:10:45 -07:00
Jun Wu
e07e4a99a1 treestate: add a TreeState struct
Summary:
Unlike TreeDirstate, this struct does not have two trees, and uses
FileStateV2.

Reviewed By: markbt

Differential Revision: D7748826

fbshipit-source-id: e637fad64e6b3e9b2a122e26a29fd04014181d6b
2018-04-30 19:10:45 -07:00
Martijn Pieters
a9f4167218 sparse: add filtering on field contents
Summary: This lets you select on substrings in fields and paths.

Reviewed By: quark-zju

Differential Revision: D7788826

fbshipit-source-id: f92b8cc646fd36f4cb3b8a4dc6116576db80eb42
2018-04-30 14:16:44 -07:00
Martijn Pieters
796523487a sparse: add a hint about using --verbose on hg sparse list
Summary: Calculation on how many profiles were hidden is only done when the hint is actually shown.

Reviewed By: quark-zju

Differential Revision: D7774192

fbshipit-source-id: a7196b2cc5640d0a7cb9c4d572e1a31ebfa41598
2018-04-30 14:16:44 -07:00
Martijn Pieters
2c10ce3145 sparse: add filtering options for fields present or missing
Summary:
This lets us produce a list of profiles with the title set, or find all profiles that are missing a description.

Convert the 'hidden' filter to use this feature, rather than special-case it in `_discover()`.

Reviewed By: quark-zju

Differential Revision: D7774029

fbshipit-source-id: 3bcba75e6da97bf0e560e11ce1ae7cbcee49ee45
2018-04-30 14:16:44 -07:00
Mark Thomas
cec43c1e77 infinitepush: enable compression of bundles
Summary:
Infinitepush stores bundles uncompressed, which can make them quite large.
Enable zstd compression of bundles, both when sending them to the server during
backups, and when storing the bundle in the bundle store on the server.

Reviewed By: quark-zju

Differential Revision: D7777371

fbshipit-source-id: ef9360bf05bf2a6d2b76e26cd40ad1e4ee8ae076
2018-04-30 02:49:18 -07:00
Jun Wu
cfec85ab00 fastannotate: disable forcefollow by default
Reviewed By: sid0

Differential Revision: D7764010

fbshipit-source-id: 16604e9dbeea382bc0e1feb55d30986d0e4ee0d1
2018-04-27 23:40:00 -07:00
Jun Wu
e21cf00d2e sparse: move some documentation to extension-level
Summary:
check-seclevel.py complains about using section markers inside a container.
The help text about sparse file format and config options can be put at
extension-level.

Reviewed By: mjpieters

Differential Revision: D7776355

fbshipit-source-id: 0b7d813c5eee352a054b21897682f6064f384829
2018-04-27 23:40:00 -07:00
Durham Goode
b1027ac19e make: use homebrew python path when available
Summary:
On OSX developers kept having to set their $PATH or change the make
file to actually build against the homebrew python. Let's build against it by
default if it exists.

Reviewed By: ryanmce

Differential Revision: D7791395

fbshipit-source-id: c69e41a469c5f94825814b4b30bc8ea144112167
2018-04-27 11:19:28 -07:00
Jun Wu
94e0297817 tests: fix test-clone-uncompressed.t
Summary: Got the other output on OSX builders.

Reviewed By: singhsrb

Differential Revision: D7790153

fbshipit-source-id: 913b5cf78c2e90933cb77d14a77e244b1ef063ba
2018-04-27 10:00:40 -07:00
Jun Wu
c0994a212f tests: stabilize test-fastmanifest-blackbox
Reviewed By: mjpieters

Differential Revision: D7729157

fbshipit-source-id: 1d546e974520c76e532152802e22fe01b091a9d2
2018-04-27 09:16:02 -07:00
Kaley Huang
c32047e854 p4syncimport: eliminate "p4 where" calls
Summary:
We currently call "p4 where" on all files in the new client spec, which is roughly O(all files in ovrsource), and it's only going to get worse as ovrsource grows :(
This diff makes the number of calls O(files added & removed between two client specs) by filtering them in the following way:
- get a full list of files from old client (L1)
- get a full list of files from new client  (L2)
- files_added = L2 - L1
- files_removed = L1 - L2
- `p4 where` on (files_added + files_removed)

How much speedup do we get?
from
  [2018-04-25 16:07:27,725]INFO:root: Start sync import in ovrsource-master
  [2018-04-25 17:35:35,873]INFO:root: Finish sync import in ovrsource-master after 5288.147963762283 seconds
to
  [2018-04-26 13:43:28,819]INFO:root: Start sync import in ovrsource-master
  [2018-04-26 13:51:35,575]INFO:root: Finish sync import in ovrsource-master after 486.7560772895813 seconds
on this change D7722798

Differential Revision: D7772403

fbshipit-source-id: 05a16343264007ee3ee466621da9da888c2368d7
2018-04-27 08:33:47 -07:00
Jun Wu
2b625d0753 wireproto: write eol for the remotefilelog error message
Summary:
"\n" will flush the line and that would probably solve the OSX test failure.

```
    --- tests/test-clone-uncompressed.t
    +++ tests/test-clone-uncompressed.t.err
    @@ -37,8 +37,8 @@
       > EOF
       $ hg clone --stream -U ssh://user@dummy/server blockedclone
       streaming all changes
    -  remote: unable to perform an implicit streaming clone - make sure remotefilelog is enabled
       abort: locking the remote repository failed
    +  remote: unable to perform an implicit streaming clone - make sure remotefilelog is enabled (no-eol)
       [255]
       $ hg clone --stream --config clone.requestfullclone=True -U ssh://user@dummy/server blockedclone
       streaming all changes
    ok
```

Reviewed By: DurhamG

Differential Revision: D7776998

fbshipit-source-id: f21c26e1bf7aa547cd79892f66521fb27cb2e77f
2018-04-26 13:34:29 -07:00
Jun Wu
9ce759a99a treestate: expose visit filtering via Tree.visit_advanced
Reviewed By: markbt

Differential Revision: D7748830

fbshipit-source-id: f3b41531e015fef90c01773ab65a4523ee72e7df
2018-04-25 17:38:20 -07:00
Jun Wu
53e7ab2a6c treestate: add file state filtering to Node.visit
Reviewed By: markbt

Differential Revision: D7748825

fbshipit-source-id: 2395ac8cc25fb4f4d3e6bdb5770616d859fcfab0
2018-04-25 17:38:20 -07:00
Jun Wu
23506bde19 treestate: merge Node.visit and Node.visit_changed
Summary:
They are similar. Merge into one single method. The `visit` method will be
extended to support other filtering features.

Reviewed By: markbt

Differential Revision: D7748829

fbshipit-source-id: 4388291945668a684808fe384341328ffd4ad2a8
2018-04-25 17:38:20 -07:00
Jun Wu
8cbe4d45c0 treestate: add serialization for Node<FileStateV2>
Reviewed By: markbt

Differential Revision: D7748832

fbshipit-source-id: bd7c6e8fce5b512068d86e16d441564e36565459
2018-04-25 17:38:20 -07:00
Jun Wu
b3da9a0262 treestate: add a compatibility layer for Node
Summary:
Allow `Node` type to work with both versions of file states. This is the
static dispatch approach that does not introduce runtime overhead.

Reviewed By: markbt

Differential Revision: D7748831

fbshipit-source-id: 4ac0386f9f93e55af1102b97a3510c8e872444a2
2018-04-25 17:38:20 -07:00
Jun Wu
cc0390192f treestate: add serialization for FileStateV2
Reviewed By: markbt

Differential Revision: D7748821

fbshipit-source-id: 56c7d7d81c86a8db05f6db2c8f6f02993cd07989
2018-04-25 17:38:20 -07:00
Jun Wu
75d50004f4 treestate: add serialization for StateFlags
Summary: It's just a thin wrapper about writing VLQ integers.

Reviewed By: markbt

Differential Revision: D7748835

fbshipit-source-id: 53a302afe51d551e49ac341901e2767d1a044946
2018-04-25 17:38:20 -07:00
Jun Wu
b796901d0c treestate: add StateFlags to Node
Summary:
This field stores the pre-computed aggregated state that helps fast path
traversal - if a state does not match the aggregated state, we can now skip
an entire tree quickly.

Reviewed By: markbt

Differential Revision: D7748823

fbshipit-source-id: 4b81ef5b911b4a21fdd46f8845ec217a75f5af8c
2018-04-25 17:38:20 -07:00
Jun Wu
71b99ae067 treestate: define a new file state object
Summary: The new `FileState` has a state bitflags field, and a "copied" information.

Reviewed By: markbt

Differential Revision: D7748824

fbshipit-source-id: a68687764e1b0c13252cb914673f2b16fa22d4ef
2018-04-25 17:38:19 -07:00
Mateusz Kwapich
052d0e3708 Command trait in rust
Summary:
We (me and Aida)  wanted to have something that could be used instead of Command decorator that we have in python
and we came up with the following trait.

Differential Revision: D7754930

fbshipit-source-id: 15f412d07045e7d8b229801ec3094664f78f801b
2018-04-25 16:00:36 -07:00
Mateusz Kwapich
86d3de94e5 demo binary
Summary: Let's commit a stub of demo binary depending on argparse that we'll work on this wekk

Differential Revision: D7752614

fbshipit-source-id: a811ea363d49e0fd56cc755b0abb74d89b4a3112
2018-04-25 16:00:36 -07:00
Mateusz Kwapich
21069062f4 argparse crate (derived from fbcode/scm/telemetry/telemetry/src)
Summary:
let's turn the wez's argparse library from telemetry into a separate
crate withing hg/lib. We'll experiment on it and if things go well we'll make
`telemetry` depend on that.

Reviewed By: quark-zju

Differential Revision: D7752615

fbshipit-source-id: 0814d91d704abdb746894a0289bf082e8d799b73
2018-04-25 16:00:36 -07:00
Durham Goode
e3f8f7fc38 clone: add stream_clone_options wireprotocol endpoint
Summary:
We want to allow blocking full repo streaming clones in certain
repositories (since they can take the lock and take a very long time) unless the
client has explicitly asked for it. The existing stream_out wire protocol has no
way of passing an option, so let's create a new endpoint.

Reviewed By: quark-zju

Differential Revision: D7763717

fbshipit-source-id: eace47143f8fdcc4c6e302b5c26678ccf56ca5d4
2018-04-25 13:54:54 -07:00
Martijn Pieters
ed857415c5 sparse: allow listing of profiles at a different revision
Summary: This is needed to be able to list profiles via SCMQuery, where there is a working copy at the null revision.

Reviewed By: quark-zju

Differential Revision: D7745434

fbshipit-source-id: b5ac236c36f9bafc9e0f305bc0892e0cd8bec628
2018-04-25 08:50:27 -07:00
Jun Wu
d15213f6f5 treedirstate: move non-Python part to a separate crate
Summary:
This makes it easier to modify and test the core logic without coupling with
the Python logic.

Reviewed By: markbt

Differential Revision: D7734012

fbshipit-source-id: 0d7b19198d85f6ca7314611256e9271be60070d1
2018-04-24 15:59:07 -07:00
Durham Goode
b66618d8c5 testing: no-op change
Summary:
I need a no-op change to test landing logic.

(Note: this ignores all push blocking failures!)

Reviewed By: phillco

Differential Revision: D7747338

fbshipit-source-id: 49388721418572b97b99971def951704059fc36a
2018-04-24 12:36:19 -07:00