Commit Graph

43783 Commits

Author SHA1 Message Date
Jun Wu
ee638e6de4 indexedlog: log: implement flush
Summary: Completes the interface.

Reviewed By: DurhamG

Differential Revision: D8156511

fbshipit-source-id: 0d4d05aa23c47117da70ec47cf9be3d4fe41df7b
2018-07-09 14:37:26 -07:00
Phil Cohen
b05631eff7 tests: remove the testreport= prefix in report.json
Summary: This prefix makes this file harder because it isn't valid JSON. Per discussion with quark-zju, remove it.

Reviewed By: singhsrb

Differential Revision: D8769139

fbshipit-source-id: f45703c963898202775e90d536dde2894e5029bb
2018-07-09 13:36:27 -07:00
Jun Wu
f5ed37562e templatefilters: move json serialization to a separate module
Summary:
It's handy. Mercurial's json serialization is different from the stdlib json
module since it can round-trip binary content. stdlib json cannot be
reliably used when there are content involving paths.

Reviewed By: ryanmce

Differential Revision: D8392078

fbshipit-source-id: 423bd5c68ea317605991a20b30ae870291249d1c
2018-07-09 10:20:36 -07:00
Jun Wu
a96b12656b commandserver: set pycompact.sysargv on runcommand
Summary:
For chg's usecase, it'd be nice to learn the actual arguments being
executed. So let's just change `pycompact.sysargv`.

An alternative would be assigning it to `ui.argv`. Given the current
codebase is using `pycompact.sysargv` in multiple places. It seems easier to
just change it.

Reviewed By: ryanmce

Differential Revision: D8392081

fbshipit-source-id: e327e04e556ea00e7b62a68b1c62c834ce927293
2018-07-09 10:20:36 -07:00
Durham Goode
1ba7bce984 pyrevisionstore: fix delta chain base case name
Summary:
A recent change made delta base's be Option types, and when we
encounter a None we treat that as the end of a delta chain. In the python
translation layer code we turned this into a Key of ("", nullid) when it
should've been (filename, nullid). This broke a test.

Reviewed By: phillco, quark-zju

Differential Revision: D8768592

fbshipit-source-id: 858a8eadad8699d2e7e99040486f836710381a4f
2018-07-09 10:14:15 -07:00
Phil Cohen
9c41cf636e merge: add number of mergedriver-resolved files as a metric
Summary: This is useful to split dev_command_timer rows based on how many files were rebuilt.

Reviewed By: DurhamG, singhsrb

Differential Revision: D8737307

fbshipit-source-id: 18d52c0fd13184d789daaa8a74f85360554da703
2018-07-06 20:14:28 -07:00
Wez Furlong
70cdd4a413 make hg grep aware of big grep
Summary:
This isn't 100% finished and is missing handling some
error cases, but I wanted to put it out there to get some knee-jerk
reactions and suggestions on how to handle some things.

This diff adds a `grep.usebiggrep` config option to `hg grep`.  The idea is
that we'll default this to on when the repo requires `eden` (or when we pull in
the eden specific site configuration).  When run in big-grep mode, we'll first
ask big grep for the results and then compute the local differences and run
only those through the local grep process, and avoid materializing files
locally.

I'm not 100% sure if the current `repo.status` call will yield the correct
results for the case where the current rev is behind the biggrep
corpus revision.

Reviewed By: quark-zju

Differential Revision: D8416360

fbshipit-source-id: 952badb7a7ec74096b5c77cd79aa25e2327a7659
2018-07-06 20:14:28 -07:00
Jun Wu
8fc182554c treedirstate: avoid calling None.clear in clear()
Summary:
Treedirstate could have `None` _nonnormalset or _otherparentset. Check them
before calling `.clear()`.

Reviewed By: markbt

Differential Revision: D8752216

fbshipit-source-id: 7c72e3a31a405ee2b0464ea08d93b8dd3a187597
2018-07-06 19:20:24 -07:00
Phil Cohen
6725395931 tests cut test-check-clang-format.t from 1.2m to 5s
Summary: Same fix as the previous diffs in this stack -- the issue is a slow `hg files` path that can be better done with grep.

Reviewed By: quark-zju

Differential Revision: D8753437

fbshipit-source-id: 05655b1d8677c1e9b7c1326f3704f15412152b94
2018-07-06 17:27:25 -07:00
Phil Cohen
9bdf1e57d1 tests: make test-check-help.t 2-3x as fast
Summary: This goes from 17s to 8.25s on my laptop, and 9.7s to 3.14s on my devserver.

Reviewed By: DurhamG

Differential Revision: D8753229

fbshipit-source-id: ce176dae0a2fb1aa10dd888b6cef223b953bf840
2018-07-06 17:27:25 -07:00
Phil Cohen
ee68575f82 tests: make test-check-config 9x faster
Summary: This cuts the speed on my laptop from 1.3 min (78s) to 8.9s.

Reviewed By: quark-zju

Differential Revision: D8738675

fbshipit-source-id: f6bd0857c949ad96b0eea54d8ddbd9a0427e8895
2018-07-06 17:27:24 -07:00
Durham Goode
97ad2b1c85 pyrevisionstore: fix build breakage
Summary:
The recent change from delta.base being a Key to an Option<Key> needed
to update pyrevisionstore as well. I'll add this to buck build soon so we can
catch this.

Reviewed By: phillco, quark-zju

Differential Revision: D8752910

fbshipit-source-id: ecf6d2a8a74b72d10b6dc0fb24c7b9346f0f7ed8
2018-07-06 16:06:25 -07:00
Qingpeng Niu
7e0204ff39 loosefile class to read Mercurial loose file format data.
Summary: Create a simple rust reader for our loose file format.  One of Mercurial’s simplest file formats is the loose file format.  fbsource/fbcode/scm/hg/hgext/remotefilelog/remotefilelog.py:_createfileblob() is the python writing implementation.

Reviewed By: DurhamG

Differential Revision: D8731050

fbshipit-source-id: 80eb2abde2a2e5bb672d7e8ffa8ba58ed62184c1
2018-07-06 12:51:08 -07:00
Durham Goode
20c35ecbf3 revisionstore: use fixed random generator for tests
Summary:
Instead of using random nodes, let's use ones based off a seeded
generator.

Reviewed By: quark-zju

Differential Revision: D8741139

fbshipit-source-id: a90e6f092adac6aef35149ee6c4bf2b47c469602
2018-07-06 11:11:40 -07:00
Durham Goode
0e34d12531 mutabledatapack: implement get_delta_chain
Summary: Implements the get_delta_chain function of the DataStore trait.

Reviewed By: quark-zju

Differential Revision: D8598658

fbshipit-source-id: 708bca63e2da3aae6064ed18076a9a1f1282a756
2018-07-06 11:11:40 -07:00
Durham Goode
32ce9b99ab revisionstore: change delta base to be an Option<>
Summary:
Deltas may not have bases if they are a full text. Let's represent
that as an Option instead of as a magical null id value. This has the nice
effect of moving the decision to serialize a missing delta base down into the
serializer instead of up at the delta chain construction level.

Reviewed By: quark-zju

Differential Revision: D8739231

fbshipit-source-id: b58bd40dae45cb85890812db21e7eeff46aa6b4e
2018-07-06 11:11:40 -07:00
Jun Wu
578077cc98 hggit: drop gitignore support
Summary:
The gitignore implementation in core is more complete (support "!" rules)
and efficient (in native Rust). So let's drop the gitignore support in
hggit.

Reviewed By: singhsrb

Differential Revision: D8744807

fbshipit-source-id: faecace0ab0d5a0e015f50473dd1e0c232d013ff
2018-07-06 10:36:17 -07:00
Jun Wu
a47840cd9a gitignore: turn on by default
Summary: It seems to work well. Let's turn it on by default.

Reviewed By: singhsrb

Differential Revision: D8744808

fbshipit-source-id: 61a8b8750f53d91ae94d019a88f27697309cfd66
2018-07-06 10:36:17 -07:00
Jun Wu
abf764ebce check-code: complain about Python underscore variable names
Summary:
Previously only function names are checked. Let's extend the check to
variable names.

Existing names breaking the rule are whitelisted.

Reviewed By: DurhamG

Differential Revision: D8744130

fbshipit-source-id: ca52d938305ccc3b2e1ea59e4e8f9c0dadff5970
2018-07-06 09:36:36 -07:00
Stanislau Hlebik
4f70dea422 prefer 'infinitepush' path instead of 'default'
Reviewed By: markbt

Differential Revision: D8734958

fbshipit-source-id: 7ed7910befdbd7081af645c0bd89927a9f0c0ce4
2018-07-06 08:12:28 -07:00
Liubov Dmitrieva
b159ed37b8 commitcloud: advertise Cloud Sync when user uses short hashes and also updates to own commit
Summary:
Currently many users use hg up to move own commits between the repos because unaware about cloud sync.
The hint will be shown on ambiguous prefix only, so it will not distract anyone.

Reviewed By: markbt

Differential Revision: D8732276

fbshipit-source-id: ae8fa10b28873134da013bc56ff9ebc33e9ed303
2018-07-06 07:05:47 -07:00
Durham Goode
28e570113e lib: remove cbincode from cargo workspace
Summary: This doesn't exist.

Reviewed By: quark-zju

Differential Revision: D8743699

fbshipit-source-id: b12c2beb600b2918bee8ca579dbf96bc8ce5288c
2018-07-05 18:50:43 -07:00
Jun Wu
a487dacc4b codemod: reformat rest of the code
Summary:
Previous code format attempt (D8173629) didn't cover all files due to `**/*.py`
was not expanded recursively by bash. That makes certain changes larger than
they should be (ex. D8675439). Now use zsh's `**/*.py` to format them.

Also fix Python syntax so black can run on more files, and all lint issues.

Reviewed By: phillco

Differential Revision: D8696912

fbshipit-source-id: 95f07aa0c5eb1b63947b0f77f534957f4ab65364
2018-07-05 17:52:43 -07:00
Jun Wu
d0c1b6d014 cargo: add a workspace
Summary:
Make `lib` a cargo workspace so building in subprojects would share a
`target` directory and `cargo doc` will build documentation for all
subprojects.

Reviewed By: DurhamG

Differential Revision: D8741175

fbshipit-source-id: 512325bcb23d51e866e764bdc76dddb22c59ef05
2018-07-05 16:06:35 -07:00
Jun Wu
a745c5a8ae dirstate: use treestate fast path for selecting files
Summary:
This speeds up the matcher against several prefixes, helps commands
like `hg files subdir`.

Reviewed By: phillco

Differential Revision: D8721759

fbshipit-source-id: 8b1b35abc5bde7d3265c0874796808a39eb8810f
2018-07-05 15:36:10 -07:00
Jun Wu
d66878ce6f treestate: add a fast path getting files under a prefix
Summary:
This adds `repo.dirstate._map.keys(prefix=prefix)` API that returns tracked
files for a subdirectory quickly. If `prefix` ends up with `/`, it selects
the subdirectory and all files in it recursively. Otherwise it's an exact
match of a single file.

Reviewed By: phillco

Differential Revision: D8721758

fbshipit-source-id: 200def986e08fd3b9842b6c8012cb7f8350f0822
2018-07-05 15:36:10 -07:00
Durham Goode
a1b6fa3007 mutabledatapack: implement get_meta
Summary:
Implements the get_meta function of the DataStore trait. This caught a
bug in how we record lengths as well.

Reviewed By: quark-zju

Differential Revision: D8598661

fbshipit-source-id: 566dca1770d6666e4215fa1fd8f33babdede2f90
2018-07-05 14:53:19 -07:00
Durham Goode
b728154963 mutabledatapack: change error to contain String
Summary:
We want to be able to format error strings, so we can't return a static
str anymore.

Reviewed By: quark-zju

Differential Revision: D8598659

fbshipit-source-id: 44d7a73c06416efca51ca4d0f24a0c8911af8582
2018-07-05 14:53:19 -07:00
Durham Goode
587fc95964 mutabledatapack: begin implementing DataStore trait
Summary:
A mutabledatapack also needs to be readable as a normal store. Let's
start implementing the DataStore trait, starting with get_missing

Reviewed By: quark-zju

Differential Revision: D8598657

fbshipit-source-id: 1f8bc89fae2be73fe789bc0ef1cdd922222019a2
2018-07-05 14:53:18 -07:00
Durham Goode
875758fdbe datapack: implement getdeltachain
Summary: Implements the last of the DataStore api, getdeltachain.

Reviewed By: quark-zju

Differential Revision: D8557950

fbshipit-source-id: 7f6530fe2064f0d035414b7920a126c6aab41beb
2018-07-05 14:53:18 -07:00
Durham Goode
24a4751ff0 revisionstore: change Delta.data to Rc
Summary:
In a future diff we'll be returning data read from a pack file out as a
Delta. To avoid copies, we need to be able to return an Rc from DataPack. This
seems like it will be a common pattern, so let's go ahead and make Delta contain
its data as an Rc.

Reviewed By: quark-zju

Differential Revision: D8557949

fbshipit-source-id: 276005360bfa48e9154143dedce579a21129e976
2018-07-05 14:53:18 -07:00
Durham Goode
c6af00dbc9 datapack: implement getmetadata
Summary:
Introduces the DataEntry structure which is able to parse data entries
from pack files. Uses it to implement getmetadata

Reviewed By: quark-zju

Differential Revision: D8556610

fbshipit-source-id: c25427c3c247970a879ad7d409b821f3695b97d9
2018-07-05 14:53:17 -07:00
Durham Goode
79a9dd976f datapack: implement getmissing
Summary: Adds the DataStore trait and implements the getmissing function.

Reviewed By: quark-zju

Differential Revision: D8554391

fbshipit-source-id: 41c107c07de7d6945ca7370e264c6bc0bf154754
2018-07-05 14:53:17 -07:00
Durham Goode
ebc31e8daf datapack: add initial datapack structure
Summary:
This adds the initial struct and opener for a datapack. Future diffs
will add actual functionality and tests.

Reviewed By: quark-zju

Differential Revision: D8553436

fbshipit-source-id: 3b17f995632e859019205f242a4cce389ac77407
2018-07-05 14:53:17 -07:00
Durham Goode
029666cf27 mutabledatapack: write index to disk during serialization
Summary:
Actually write the index to disk when the mutabledatapack is
serializing.

Reviewed By: quark-zju

Differential Revision: D8552276

fbshipit-source-id: 354c7fdc3fe84b91d582f0e8cde8c6ae2494c559
2018-07-05 14:53:17 -07:00
Durham Goode
e68c0ec7e0 mutabledatapack: add logic for reading DataIndex
Summary: This adds the logic for reading a DataIndex from disk.

Reviewed By: quark-zju

Differential Revision: D8552278

fbshipit-source-id: 611ff09c27716b8d8ff7424c1a27287b9fc42b78
2018-07-05 14:53:16 -07:00
Durham Goode
d22f6ce58d mutabledatapack: add logic for writing DataIndex
Summary:
Soon we will be writing the index during pack file serialization, so
let's add the logic for serializing the index.

Reviewed By: quark-zju

Differential Revision: D8552277

fbshipit-source-id: 60829631eb060f62d266c16f6016f34080311f8e
2018-07-05 14:53:16 -07:00
Durham Goode
69a59f53d9 revisionstore: add Node::from_slice
Summary: A simple helper method for producing Node's from slices in a safe way.

Reviewed By: quark-zju

Differential Revision: D8547679

fbshipit-source-id: 85ae8fcd7749c662b1459af1d84ccf9695dd5f0b
2018-07-05 14:53:16 -07:00
Durham Goode
1c3767bc11 mutabledatapack: implement data index header serialization
Summary:
We're beginning to implement the DataPack index file logic. Let's start
with header serialization/deserialization.

Reviewed By: quark-zju

Differential Revision: D8319727

fbshipit-source-id: 079aab06ececb1c5159aec2da3243268eea0cb61
2018-07-05 14:53:15 -07:00
Durham Goode
12e0e5bf16 mutabledatapack: build inmemory index as revisions are added
Summary:
Let's build an inmemory hash table of the revisions that were added. A
future diff will serialize this index into a dataidx file.

Reviewed By: quark-zju

Differential Revision: D8309730

fbshipit-source-id: 9efc7f0f34129a63c52309b4d70179f2c10840b3
2018-07-05 14:53:15 -07:00
Durham Goode
763d1e4bef datapack: implement a fanout table
Summary:
Implements a fanout table trait that history pack and data pack will
use. It basically consists of logic to build and read a quick lookup table that
uses the first few bytes of a key to determine the bounding range of a binary
search.

Reviewed By: quark-zju

Differential Revision: D8309729

fbshipit-source-id: 71e398277dc8ae041447035f044e5d47ca41cf7e
2018-07-05 14:53:15 -07:00
Durham Goode
4588cc18c8 mutabledatapack: write version number header
Summary:
The mutabledatapack format has a one byte header containing the version
number.

Reviewed By: quark-zju

Differential Revision: D8305653

fbshipit-source-id: c4a96dc48e64acd2c5849034e5d90b87363fbc8d
2018-07-05 14:53:15 -07:00
Durham Goode
99a11bbb24 mutabledatapack: use hash of contents as name
Summary:
Implements the logic that builds a hash of the contents of the pack
file and uses it as the name.

Reviewed By: quark-zju

Differential Revision: D8305654

fbshipit-source-id: d1270e7519a7718aa5427f3be5cdc0cd0dee2fe2
2018-07-05 14:53:14 -07:00
Durham Goode
3f467bd21f mutabledatapack: implement add()
Summary:
This is the start of a rust mutable datapack implementation. The first
diff adds a simple add function. Later diffs will add the logic that builds the
index, serializes the index, and computes the final hash name.

Reviewed By: quark-zju

Differential Revision: D8304036

fbshipit-source-id: db05c2b845e51a3552c039b7fc0b8f4cc0ff0852
2018-07-05 14:53:14 -07:00
Durham Goode
8057817dc1 revisionstore: add read/write functions to Metadata
Summary:
In a future diff we'll be serializing and deserializing metadata in
datapacks. Let's add the reader and writer functions for Metadata and some unit
tests.

Reviewed By: quark-zju

Differential Revision: D8303603

fbshipit-source-id: 7e7a7aa218c05179b205abf8b151b1488be674b3
2018-07-05 14:53:14 -07:00
Matt Glazar
9b7a4d32a1 templater: allow non-ASCII fillchar in pad()
Summary:
Hg's `pad()` template function can only fill with a single character. To assert this, Hg checks the length of the fill string. Because the fill string is a Python 2 `str`, Hg rejects UTF-8 `'☃'` (`'\xe2\x98\x83'`) because its length is 3.

Instead of checking the length of the fill string, check the width of the fill string while taking encoding into account. This lets us use ☃ as a pad fill character.

For ASCII fill strings in `pad()`, this diff should not change behaviour.

Reviewed By: phillco

Differential Revision: D8730727

fbshipit-source-id: ad015aa4cae274160bc2726e0cb5e570e6edcc1e
2018-07-05 14:20:44 -07:00
Liubov Dmitrieva
8eba8372c3 commitcloud: cloud sync always wait for the background process to complete
Summary: before the waiting provide all the information to the user

Reviewed By: markbt

Differential Revision: D8734860

fbshipit-source-id: 9c0203b0879091d1d367c2ded9eccd8db4ee1bb9
2018-07-05 11:35:16 -07:00
Jun Wu
e4f29da588 hardlink: whitelist apfs
Summary: `hg debugfs` can report `apfs` correctly on latest mac. So let's add it to whitelist.

Reviewed By: ikostia

Differential Revision: D8725764

fbshipit-source-id: a9eb0db9d1f75cdd64c28b5c2f41451955758e18
2018-07-05 10:06:41 -07:00
Mark Thomas
e96dc290b9 tests: relax output for rename commit in treeonly-copyamend test
Summary:
The output of the rename commit can vary depending on how many files hg needs
to download as part of the rename.  This makes this test flaky when run with
watchman in the stress runs.

We don't actually care about the commit output here, so just match anything.

Reviewed By: mitrandir77

Differential Revision: D8731713

fbshipit-source-id: c2eded9115d2348c11fcb79eb425b923d073eddb
2018-07-05 09:50:59 -07:00
Phil Cohen
b32405f449 rebase: replace opts['noconflict;'] with opts.get('noconflict')
Summary: simpkins found a user getting a KeyError with the former.

Reviewed By: simpkins

Differential Revision: D8730525

fbshipit-source-id: 40d80f17e0ab8b2905fc53377e501546c21feaae
2018-07-03 17:49:44 -07:00