Summary: The commit timestamps in Git have second granularity. As a result, sometimes multiple succeeding commits have numerically equivalent timestamps. This means that sorting by timestamp may not result in the correct ordering of commits. This is particularly true because the sort we use is a stable sort, which means that commits with the same timestamp must go into the sort in ascending commit history order to have the correct order coming out of the sort. This commit updates the log that generates the list to use ascending commit order rather than descending.
Reviewed By: tchebb
Differential Revision: D18486839
fbshipit-source-id: 7a0ff099375a250d92b0f1a846e1105bf7bb9c86
Summary: The existing logic for parsing rev-list data relies very heavily on split, which creates many intermediate strings that take up a lot of memory. This commit updates the logic to use indices into the original output to extract individual strings. It also includes a new unit test for the list parsing. Big thanks to Tom Hebb for identifying the excessive memory usage.
Reviewed By: tchebb
Differential Revision: D18513949
fbshipit-source-id: c3b4e420ae2635904b42b84f2973e83c81c21dd7
Summary:
Revision numbers are deprecated, let's only show the short hash of the commit
instead.
Reviewed By: quark-zju
Differential Revision: D18519655
fbshipit-source-id: df277cc7e99ad747899d1fae2d92cd88eebea0f1
Summary:
This diff replaces code of the form:
```
use failure::Fail;
#[derive(Fail, Debug)]
pub enum ErrorKind {
#[fail(display = "something failed {} times", _0)]
Failed(usize),
}
```
with:
```
use thiserror::Error;
#[derive(Error, Debug)]
pub enum ErrorKind {
#[error("something failed {0} times")]
Failed(usize),
}
```
The former emits an implementation of failure 0.1's `Fail` trait while the latter emits an impl of `std::error::Error`. Failure provides a blanket impl of `Fail` for any type that implements `Error`, so these `Error` impls are strictly more general. Each of these error types will continue to have exactly the same `Fail` impl that it did before this change, but now also has the appropriate `std::error::Error` impl which sets us up for dropping our various dependencies on `Fail` throughout the codebase.
Reviewed By: Imxset21
Differential Revision: D18523700
fbshipit-source-id: 0e43b10d5dfa79820663212391ecbf4aeaac2d41
Summary: make the error message returned in the case of out of date parents during a new status call more user friendly and provide possible remediation instructions
Reviewed By: simpkins
Differential Revision: D18328835
fbshipit-source-id: b214f45bb055d008db8b233ddd2a1843332db838
Summary:
The finddate function is used when using `hg update --date`, and since it
returned a revision number, the user would see the revision number deprecation
warning. Using nodes solves this.
Reviewed By: quark-zju
Differential Revision: D18486760
fbshipit-source-id: e1a51f624d8e7133fbf334f9b8b4b4c3d5aff2a0
Summary:
`globset` supports multiple matching strategies, including literal prefix
(backed by AhoCorasick), or regexp, etc.
In theory patterns like `foo/**` (where `*` cannot match `/`) can use `foo`
prefix strategy. However, the implementation detail of `globset` wouldn't
accept it as a prefix. But `foo/*` (where `*` can match `/`) can be treated as
a prefix. Transform the former pattern to the latter to hint `globset` to use
the optimal strategies.
Reviewed By: sfilipco
Differential Revision: D18500298
fbshipit-source-id: 39e604d6157a919b75c392488b6d42375e518c16
Summary:
This diff is preparation for migrating off of failure::Fail / failure::Error for errors in favor of errors that implement std::error::Error. The Fallible terminology is unique to failure and in non-failure code we should be using Result<T>. To minimize the size of the eventual diff that removes failure, this codemod replaces all use of Fallible with Result by:
- In modules that do not use Result<T, E>, we import `failure::Fallible as Result`;
- In modules that use a mix of Result<T, E> and Fallible<T> (only 5) we define `type Result<T, E = failure::Error> = std::result::Result<T, E>` to allow both Result<T> and Result<T, E> to work simultaneously.
Reviewed By: Imxset21
Differential Revision: D18499758
fbshipit-source-id: 9f5a54c47f81fdeedbc6003cef42a1194eee55bf
Summary:
simpkins encountered a case where the treematcher does not work with many
patterns. It turns out `globset` has a hard-coded regex size limit (10MB).
Implement proper error handling so we can detect such issues and fallback to
slower paths.
Reviewed By: sfilipco
Differential Revision: D18500299
fbshipit-source-id: 0122ba9b0246c1536b2069a40e13261ee47f8bba
Summary: Add `hg debuglfsgc` command to reclaim disk space. Make it part of `hg gc`.
Reviewed By: xavierd
Differential Revision: D18417035
fbshipit-source-id: 7c0a445a0d4405df5cff960c0e28c4fc5a1f2c31
Summary:
Even keep was being passed in, rebase still added mutation markers to the old
commits, which would then make them hidden in the smartlog output. Not adding
the mutation markers in this case solves the issue.
Reviewed By: quark-zju
Differential Revision: D18496840
fbshipit-source-id: f5d0f8920bd00041598841a65356b88df00708d7
Summary:
Merge the fb-mercurial code into the Eden repository, under the
`eden/scm` subdirectory.
Reviewed By: quark-zju
Differential Revision: D18445774
fbshipit-source-id: fc3307f9937e0c7e1c8f7d03c5102c4fe5dedb10
Summary:
In preparation for merging fb-mercurial sources to the Eden repository,
move everything from the top-level directory into an `eden/scm`
subdirectory.
Summary:
Allocate and hook up a StructuredLogger at startup if the EdenConfig
has the appropriate values set.
Reviewed By: simpkins
Differential Revision: D18071821
fbshipit-source-id: 3996b6644bbf0c16bb3b9950d57a79d4619a1656
Summary:
Add abstractions so part of the store vfs can be managed by metalog.
A config option was added to control the behavior.
Reviewed By: kulshrax
Differential Revision: D18272996
fbshipit-source-id: 6bd1400bfacbd2414f8d4b6bfc0b978f5020c883
Summary: This makes an upcoming change easier.
Reviewed By: markbt
Differential Revision: D18272999
fbshipit-source-id: e189b147f2e5bbba7930d3c2cae22c8cffdbce88
Summary:
Change `with f` to `with fileobj as f`. The "usual" `fileobj` returns itself
as `f`. But we're changing it in upcoming diffs.
Reviewed By: kulshrax
Differential Revision: D18272995
fbshipit-source-id: 8465311921802010bfaac7fa0c33ed402d737363
Summary:
In a future diff I'm changing the source of truth of `remotenames`, so
`.hg/store/remotenames` will stop working. Rewrite the tests to use a more
compatible form.
Reviewed By: kulshrax
Differential Revision: D18272998
fbshipit-source-id: acb1cc1102caf0397a2a3d72a0c4cbb39a0a9b8d
Summary:
This exposes zstore interface to Python, making it easier to be used as a blob
store, or benchmark with revlog.
Reviewed By: kulshrax
Differential Revision: D18300621
fbshipit-source-id: 2762f23fe0fbd5f5f4af07ca7e4d6303b4009da1
Summary:
Intended to solve atomic read / write problem for remotenames and visibleheads.
In the future it might also store bookmarks and other data.
Metadata like visibleheads or bookmarks can be delta-ed well. So zstore is
used.
Reviewed By: kulshrax
Differential Revision: D18273000
fbshipit-source-id: 78347b9f88ccc9ee52d33f5e8b8663193ff1eec4
Summary: Delta-related logic is complex. Add visualization and test to verify them.
Reviewed By: kulshrax
Differential Revision: D18300620
fbshipit-source-id: 8d0bcf69b9e73a601f549ef9bdc881eea60e1bae
Summary:
This blob store is the first usage of indexedlog. It uses zstd dictionary
compression provided by the zstdelta crate and aims to replace lz4 + bdiff
revlog for storing file revisions.
Blobs are enforced SHA1 addressed. A separate mapping from filenode to SHA1 is
needed if we want to integrate it into Mercurial file storage.
Practically, compare with lz4+bdiff, this setup compresses better (which could
be improved by tweaking parameters in zstdelta - it uses a variant of zstd
level 1 currently) when using same delta-chains:
| Repo | File revisions | Zstore size (log + index) | Revlog du size | Revlog raw size |
| hg | 74.9K | 28 + 2.1MB | 40MB | 33.3MB |
| cpython | 232K | 179 + 6.5MB | 221MB | 199.9MB |
It should also compress better for binary files, since there is no line-based
diff algorithm.
Performance wise, my previous experiments on fbsource showed compression is
faster with zstdelta. Decompression is slower. But in reality we might have
many files to decompress, in which case, multi-thread should make things
better.
The delta base decision logic is designed to automatically reshape a linear
chain to a tree to reduce chain length. The next diff adds dedicated tests
for the algorithm.
The name `Zstore` was chosen because the prefix `zst` is the name of
the compression algorithm.
Reviewed By: kulshrax
Differential Revision: D10251983
fbshipit-source-id: 3ba308d2799bb759a36f69a88f7c0144830fc41e
Summary: Up until now, we haven't been setting file modes for the files we're putting into hg. This seems like it might be related to some of the problems we're seeing in changes relating to symlinks. This commit adds mode tracking to try to fix that. It also adds unit tests to test the underlying mode conversion functions in gitutil to check our logic.
Reviewed By: tchebb
Differential Revision: D18409701
fbshipit-source-id: c5c3a90e12bd7115e24024a912f175484efe8a90
Summary:
For certain repos, the Phabricator GraphQL returns Git commit hashes. Add an
option to convert them to hg commit hashes.
Reviewed By: simpkins
Differential Revision: D18442376
fbshipit-source-id: b68be1d69adca85105d9f1124561c753909fbb32
Summary:
The current implementation calls GraphQL at least twice to make sure pagination
didn't happen. But the second call seems to be rate-limited and timed out in
some cases. Practically it seems one round-trip can just work for hundreds of
commits. Therefore let's just avoid the second GraphQL call.
Reviewed By: singhsrb
Differential Revision: D18442374
fbshipit-source-id: 3313bd01516e758aeeafd6d1ec674eb7c27e165b
Summary:
The `HgDatapackStore.cpp` file currently depends on code not available on Mac,
so do not attempt to build it there.
Reviewed By: fanzeyi
Differential Revision: D18467948
fbshipit-source-id: cce37bb480426e6d972045321f15c1f2aa4457ee
Summary:
The "git" feature detection was broken so the tests didn't run. Fix the feature
detection so the tests run again.
Reviewed By: xavierd
Differential Revision: D18461790
fbshipit-source-id: 6f599e7cea8e20e1d091c20fea654ffa36512739
Summary: D18366733 deprecated changelog.head(rev)s. Migrate hggit to use the new API.
Reviewed By: xavierd
Differential Revision: D18461791
fbshipit-source-id: 713a4eeab48c4455c46cf6415363949015eb5642
Summary:
The predecessor() revset would sometimes include the null commit, combined as a
range, this meant all the commit in the commit graph, which is unexpected. Fix
this by considering that the nullid is in the seen set.
Reviewed By: quark-zju
Differential Revision: D18461597
fbshipit-source-id: 522d4174ecc4d136a6e2b1faba89b1f0cb492fa0
Summary:
I spent hours debugging a deadlock in my code that was caused by
accidental usage of the deprecated Synchronized::operator->. Avoid
that in the future by building Eden deprecation-clean.
Reviewed By: genevievehelsel
Differential Revision: D18354757
fbshipit-source-id: fe74250635f779bb5010f907d57951132b9edea4