Commit Graph

1021 Commits

Author SHA1 Message Date
Adam Simpkins
2a0b8f58fb update chg to correctly honor the pager.stderr setting
Summary:
Update the chg code to correctly honor the `pager.stderr` setting, and avoid
piping stderr to the pager when it is disabled.

Since only the server-side code knows the hg config values, the server-side
chgserver.py code passes this config setting back to the client when sending
the pager request.

Reviewed By: quark-zju

Differential Revision: D17109106

fbshipit-source-id: 6b69b1a7de9f61db51af7b0ba00d65fa5053a795
2019-09-09 11:48:42 -07:00
Adam Simpkins
e79dc29f0f refactor the chg code that sends system and pager requests
Summary:
This refactors the code the code that sends system and pager requests from the
chg server to the client.

Previously these were both sent using the `S` channel code.  The `S` channel
code was slightly unusual and had special handling: in general the code
assumed that upper-case channel codes did not include any request body data,
but this wasn't true for the `S` channel data.  I changed this to lower-case
in order to eliminate this special case handling, and I also split up the
system and pager data into different channel codes, since they have fairly
different behavior.  System requests are now sent with an `s` channel code,
and pager requests are sent with a `p` channel code.

I also changed the code to require that the server always adds a terminating
`\0` byte after each environment variable value.  Previously the client code
was responsible for adding a nul terminator on the last string, which could
potentially require the client to copy the data into a larger buffer in order
to do so.

I also made a minor change to the client-side `readchannel()` code so that it
can read the channel type and body data length with a single system call
instead of making 2 separate `recv()` calls.

The main benefit of these changes is that they will let the server pass some
additional configuration information with pager requests.  The change to make
use of this new field will come in a subsequent diff.

Reviewed By: quark-zju

Differential Revision: D17216291

fbshipit-source-id: c3044cf3d5f5e103f0b62d083e4ef3764160f20e
2019-09-09 11:48:42 -07:00
Aleksei Kulikov
b7ee506bfa snapshot: keep a list of snapshots in .hg/store/snapshotlist
Reviewed By: markbt

Differential Revision: D17226709

fbshipit-source-id: fefa31227f77295793ccaa3448f4488274f70848
2019-09-09 10:38:22 -07:00
Wez Furlong
0f9b49b65e hg: add debug command to trigger update hooks
Summary:
For Eden we currently have a gap in our post-mount behavior;
we don't perform the update hooks for a freshly cloned and mounted repo.

The thought is that we'll explicitly trigger them by invoking `hg
debugedenrunpostupdatehook` at the end of the mount sequence.

Reviewed By: quark-zju

Differential Revision: D17237197

fbshipit-source-id: 9c2212c61735068c287eb98761503ce31bfee8a6
2019-09-07 10:21:48 -07:00
Aleksei Kulikov
377e1200a7 snapshot: add -m option to set up a custom snapshot message
Reviewed By: markbt

Differential Revision: D17206496

fbshipit-source-id: a6e190ca87aa5309e359a5cecd6c6bc40634ca8d
2019-09-06 08:18:36 -07:00
Aleksei Kulikov
ccc05d0d65 snapshot: remove lfs dependency completely
Summary: Also remove debug commands that are strictly related to remote lfs.

Reviewed By: markbt

Differential Revision: D17184902

fbshipit-source-id: da38a2150212500bab62191ddcfab0990276605e
2019-09-06 08:18:35 -07:00
Aleksei Kulikov
22dce8230d snapshot: bundle metadata and the related files
Summary:
Instead of the lfs remote storage it was chosen to send the snapshot metadata via bundles.
Snapshot metadata consists of: the actual metadata blob + several other blobs (untracked files etc).
If we have several snapshot revisions in a single bundle, the blobs could repeat.
Then we should store each blob as a separate entry in a binary stream, keeping its id and contents.

Here we introduce a new bundle part type `"b2x:snapshotmetadataparttype"`.
```
1 byte of version info
[ # a list of binary entries, each corresponds to a separate file
  # (either a metadata file itself or a related -- externally stored -- file)
  <oid><length><data>
  :oid: is a 64char string with the hash of the file
  :length: is an unsigned int with length of the data
  :data: is binary data of length <length>, the actual file contents
]
```

So far there is an ongoing discussion on the exact format of serialization.
Actual state is at [the quip doc](https://fb.quip.com/R5OVAzabX8oo).

Reviewed By: markbt

Differential Revision: D17184222

fbshipit-source-id: 90f833ec71556e90d513e3be3f3efa7f870b037d
2019-09-06 08:18:35 -07:00
Aleksei Kulikov
bcd08fcda3 snapshot: store metadata version as int
Summary: That way it'll be easier to pack it into a blob.

Reviewed By: markbt

Differential Revision: D17183018

fbshipit-source-id: 44e21103f201aafb6f417a5b5a7b3d4735f32039
2019-09-06 08:18:35 -07:00
Aleksei Kulikov
732a5baa9a snapshot: use local snapshot storage instead of lfs
Summary: In the next diff I will replace remote lfs with bundle2

Reviewed By: markbt

Differential Revision: D17132405

fbshipit-source-id: a0dfff3ebad067abb0231cf31de08ae62affe7ce
2019-09-06 08:18:35 -07:00
Mark Thomas
465e91bbe5 debugmutation: don't use the unfiltered repo by default
Summary:
The `debugmutation` command uses the unfiltered repo to resolve the
user-provided revs.  It shouldn't do this unless the user passes `--hidden`.

Reviewed By: mitrandir77

Differential Revision: D17156722

fbshipit-source-id: 5ab7704acc598cf8b7c1640a3096ba0ce6ac73e9
2019-09-06 00:44:13 -07:00
Mark Thomas
8dc0110c6d debugmutation: improve format and render successors
Summary:
Update the debugmutation format to collapse long chains.  Add
`hg debugmutation -s` to follow the successor relationship (printing what the
commit became) instead of the predecessor relationship.

Reviewed By: mitrandir77

Differential Revision: D17156463

fbshipit-source-id: 44a68692e3bdea6a2fe2ef9f53b533199136eab1
2019-09-06 00:44:12 -07:00
Mark Thomas
d21fc6233a treemanifest: don't purge shared packs while repack is running
Summary:
If treemanifest finds there are too many shared packs (more than
`packs.maxpackfilecount`) then it will purge them.  This is a shame if there is
currently a repack in progress, as it will purge the packfiles from underneath
the repack, deleting lots of cache data that will be imminently repacked).

Skip the purge if there is a repack ongoing.

Reviewed By: mitrandir77

Differential Revision: D17155854

fbshipit-source-id: 20d46f29c252e508177b1fde08ca7a69841dcd7e
2019-09-06 00:40:52 -07:00
Jun Wu
0b570f65a7 stablerev: pass information using environment variables
Summary:
Instead of hardcoding `--target <target>` and hardcode `$2` in the script.
Let's just use environment variables so `target` and other things have explicit
names.

Explicit set `REAL_CWD` so the script can learn the current directory before
it gets reset to the repo root.

Reviewed By: xavierd

Differential Revision: D17213186

fbshipit-source-id: 6a4fc4cf2cbf6e2c623400bc6bc13f7758a46c49
2019-09-05 15:53:37 -07:00
Xavier Deguillard
0cd7a9cb8f remotefilelog: add a config to use the Rust PackStore
Reviewed By: quark-zju

Differential Revision: D17187153

fbshipit-source-id: 57faa956598600e520dfea3cd05de981e5caae1c
2019-09-05 10:21:27 -07:00
Xavier Deguillard
375d91a518 remotefilelog: add make{datapackstore, historypackstore}
Summary: Let's consolidate these 2 to allow easy switching the the Rust based one.

Reviewed By: quark-zju

Differential Revision: D17187154

fbshipit-source-id: 5ccadabac2e2e4b684ca44917f1502e9a05d41d6
2019-09-05 10:21:27 -07:00
Xavier Deguillard
cf64b3dc99 revisionstore: allow a PackStore to ignore corrupted packfiles
Summary:
While a corrupted packfile can be safely removed from the shared hgcache, the
same isn't true for local packfile. When building the packstore, let's allow
the behavior on corrupted packfile to be chosen. This is voluntarily made as an
explicit argument to DataPackStore and HistoryPackStore constructor so the
caller can take this into account.

Reviewed By: quark-zju

Differential Revision: D17187155

fbshipit-source-id: 658fce401f8902a74cfd92780013d1b96e20a590
2019-09-05 10:21:26 -07:00
Jun Wu
d66ac32198 metaedit: support -M / --reuse-message
Summary:
This makes metaedit support `-M / --reuse-message`, which I found handy when
rewriting prototype commits to formal commits.

Reviewed By: xavierd

Differential Revision: D17168991

fbshipit-source-id: fa768a2916ea3ef4db4c31a48989d10897379e92
2019-09-04 17:06:36 -07:00
Jun Wu
15f97d7f53 cmdutil: move -M / --reuse-message handling to cmdutil.logmessage
Summary:
This just moves `-M / --reuse-message` handling from the `commit` command
to a lower layer, making it more reusable.

Reviewed By: xavierd

Differential Revision: D17168992

fbshipit-source-id: 4fe7e93ceae45eff281214dcff03ef3f9ee0c898
2019-09-04 17:06:35 -07:00
Jun Wu
fd071d2076 cmdutil: change logmessage to take a repo
Summary:
Change `cmdutil.logmessage` to take a `repo` instead of `ui`. This makes the
next change easier.

Reviewed By: xavierd

Differential Revision: D17168990

fbshipit-source-id: 47c1707e5a9dbf06d07452b4c400903453992379
2019-09-04 17:06:35 -07:00
Jun Wu
1e027a58e7 fsmonitor: warn about slow full-repo scans
Summary:
I have seen multiple user complaints about slow hg commands that turned out to
be fsmonitor scanning the whole working copy. Print a warning in those cases.
Hopefully this can reduce our oncall burden a bit.

Reviewed By: xavierd

Differential Revision: D17170520

fbshipit-source-id: 8fd5721d123853136c84229d936c3e0c999f3d87
2019-09-04 14:14:51 -07:00
Jun Wu
c637c9d08c copytrace: log domergecopies time
Summary:
I found this very slow. Log it so we can have some ideas about how long it
takes for others.

Reviewed By: xavierd

Differential Revision: D17066510

fbshipit-source-id: 3f9de9b816bcd2d062beb44bc03ea4114d829596
2019-09-04 13:37:40 -07:00
Jun Wu
925ef09146 treemanifest: log findrecenttrees time
Summary:
`findrecenttrees` can take very long in my case - it only tests 1280 trees in
30 seconds. Log it so we can get some ideas about how long it takes.

As we're here, teach `util.timefunction` to figure out the `ui` object
automatically.

Reviewed By: xavierd

Differential Revision: D17066278

fbshipit-source-id: 7e59c8683359a7ce8d4e87fde92af36b95d37b2f
2019-09-04 13:37:39 -07:00
Jun Wu
5def63525a sigtrace: use smarttraceback and print to stderr
Summary:
Make sigtrace use smarttraceback so it prints more context.
As we're here, also make it print to stderr so we don't need to find the
traceback from /tmp.

Reviewed By: xavierd

Differential Revision: D17066277

fbshipit-source-id: 9a1000803fed27a71ec381b8ddbd76400dae99c9
2019-09-04 13:37:39 -07:00
Aleksei Kulikov
bead18e577 lfs: move abstract local blobstore to core mercurial
Summary: It will be used by snapshot extension too.

Reviewed By: markbt

Differential Revision: D17132134

fbshipit-source-id: 6c9fc285e0f1eb445bfa0abe0b6f4de4a1bd1db0
2019-09-04 11:09:36 -07:00
Aleksei Kulikov
4576ab19c2 lfs: move lfsvfs to vfs.py
Summary:
now blob vfs will be in core mercurial. It will be used by snapshot
extension too.

Reviewed By: quark-zju

Differential Revision: D17112671

fbshipit-source-id: e721749d27db37f55bb9eb6af3ea042e8036ddfa
2019-09-04 11:09:36 -07:00
Aleksei Kulikov
1cc68aac23 snapshot: split the extension code into files
Summary: Preparation for lfs deprecation in snapshot extension.

Reviewed By: quark-zju

Differential Revision: D17112040

fbshipit-source-id: aa55a631d1f03180ffea741c71bcf801fb4fc147
2019-09-04 11:09:36 -07:00
Aleksei Kulikov
c193470431 snapshot: prohibit regular checkout on snapshot
Differential Revision: D17093630

fbshipit-source-id: 4425c90fbdecfa3edc9f34f677e0be6b771aa0af
2019-09-04 11:09:35 -07:00
Stefan Filip
429292dfe3 manifest: process deletes before adds in workingctx.buildmanifest
Summary:
The Rust manifest does not allow for directories to be added if files with
the same name exist.

Reviewed By: quark-zju

Differential Revision: D17143550

fbshipit-source-id: fe2533b6f0c049d7b22f2fbb49f3e04959aea39c
2019-09-03 15:08:34 -07:00
Stefan Filip
edfeb9f529 treemanifest: remove delta storing of manifest entries when autocreate
Summary:
It is somewhat difficult to fetch the raw entry on the p1 side in the Rust
Manifests. These entries are used to write deltas to revlogs or to datapacks.

Reviewed By: xavierd

Differential Revision: D17143551

fbshipit-source-id: 6624116324664354d199d5f6ac55712c8ed29b9d
2019-09-03 15:08:34 -07:00
Xavier Deguillard
70796a2a30 bindings: add bindings for the Rust PackStore
Summary:
The Rust code is almost at parity with the Python code, let's expose it to
Python.

Reviewed By: quark-zju

Differential Revision: D16794076

fbshipit-source-id: faf1da775b4e57328be62a06d0065c7becf1b9f4
2019-09-03 13:56:38 -07:00
Mark Thomas
013aa19333 mutation: don't allow divergence when rebasing
Summary:
In general, mutation tracking doesn't care about divergence.  However, in the
case of rebase, it doesn't make sense to allow divergence to occur if we can
avoid it by omitting some of the commits to rebase.

This makes rebase behaviour more like old obsmarker-based behaviour.  This
breaks a test for mutation copying markers, so update those to use metaedit,
which has the copying behaviour for both obsmarkers and mutation.  At some
point we should make rebase behave better in these cases.

Reviewed By: quark-zju

Differential Revision: D17136480

fbshipit-source-id: 9e465b7fc8bda33e7a746e4df68410713e2be37e
2019-09-02 03:13:51 -07:00
Xavier Deguillard
a8f9884152 remotefilelog: add bindings for the IndexedLogHistoryStore
Summary: This plumbs it everywhere to be on-par with the historypack.

Reviewed By: quark-zju

Differential Revision: D17104465

fbshipit-source-id: 0e5b9343388b81f21609a38978816bd729102e1b
2019-08-30 18:30:48 -07:00
Xavier Deguillard
2274399ed8 remotefilelog: refactor hg debughistorypack
Summary:
Move the code that isn't proper to an historypack to a separate function. This
will be used to implement a similar functionality for the
IndexedLogHistoryStore

Reviewed By: quark-zju

Differential Revision: D17104466

fbshipit-source-id: 905a4c4c63d8bbb54611fcb9521ab3039d1b56fd
2019-08-30 18:30:47 -07:00
Xavier Deguillard
66ed398113 bindings: refactor historypack::iterentries
Summary:
This functionality will be needed by the IndexedLogHistoryStore, let's move the
code out of historypack.

Reviewed By: quark-zju

Differential Revision: D17104468

fbshipit-source-id: 33b6b36bb69ed09ca6f72f6f9b6531ffb15c2193
2019-08-30 18:30:47 -07:00
Xinyue Zhang
6331cb6323 Update stablerev.py to work on Windows
Summary:
1.) Windows doesn't support close_fds if stdin/stdout/stderr is redirected. It throws out this Exception: 'close_fds is not supported on Windows platforms if you redirect stdin/stdout/stderr'. This diff resolves this issue by importing mercurial util to use file_fd only on posix
2.) Originally, stable is implemented as a mercurial extension and gets expanded as the following (take update as an example):
```
hg up stable
   -> calls getstablerev("--pick-best") in stable.py
   -> calls a bash script in hg repo, e.g. ovrsource or fbsource
```
However, bash is not supported on Windows.
To resolve this, this diff sets up cwd in `subprocess.Popen` and then modifies stablerev to take in a command in string format instead of a script. This way, we can pass in either the bash script for fbsource(backward compatible) or `python <xxx.py>` for ovrsource.

Reviewed By: quark-zju

Differential Revision: D17140170

fbshipit-source-id: ea8ae76883cc34a0517fa7e9eae3cbb3ba901353
2019-08-30 16:48:18 -07:00
Xavier Deguillard
0f125b4073 remotefilelog: commit the dirty shared mutable packs on transaction abort
Summary:
Since the shared mutable packs contain fetched data from the network, not
commiting them means that we would need to redownload the data again. Let's
persist them on disk instead to avoid having to redownload them.

Reviewed By: quark-zju

Differential Revision: D17115796

fbshipit-source-id: 3e213461c7a864156ee4c6c68e6a042294883f9d
2019-08-30 16:14:52 -07:00
Xavier Deguillard
4b28370d5e remotefilelog: local loosefiles should always be fully repacked
Summary:
The loosefiles repack was made incremental to greatly reduce the repack time
for users. Since the amount of local loosefiles should be way smaller than the
amount of shared ones, let's always run a full repack on the former. This
should allow us to kill all the local loosefiles, which will help in no longer
supporting them.

Reviewed By: quark-zju

Differential Revision: D17135975

fbshipit-source-id: 9480993b31aa57d0d6e6b7caffd282929183f782
2019-08-30 15:09:25 -07:00
Xavier Deguillard
81614017c6 remotefilelog: remove repack Python fallback
Summary:
Now that we're past the point of being not confident about the Rust repack
code, we can remove the fallback code. Instead, let's fail hard if the Rust
repack fails.

Reviewed By: quark-zju

Differential Revision: D17135979

fbshipit-source-id: a521a4f9267361a167bba61968659557bed35e20
2019-08-30 15:09:24 -07:00
Xavier Deguillard
6e0b6a2161 remotefilelog: Rust repack is the default
Summary:
Rust repack has been the default for a while now. Let's stop pretending we're
going to switch back to the Python repack by removing the config entirely.

Reviewed By: quark-zju

Differential Revision: D17135977

fbshipit-source-id: 5aaa0faa48e2b40a7314d5ab455f5eeaa4e4984d
2019-08-30 15:09:24 -07:00
Jun Wu
b178492317 changelog: disable inline revlog
Summary:
The inline revlog format merges `.i` and `.d` into one `.i` file. It was intended to reduce the
number of files for filelogs. For the changelog one extra file does not hurt.

This makes it easier to write native code parsing the changelog revlog index.

Reviewed By: xavierd

Differential Revision: D17125922

fbshipit-source-id: f48ffe0d2df71abec007a80e05b684dcbac71883
2019-08-30 14:58:02 -07:00
Wez Furlong
3a13d58d7a Back out "hg: wrap convert in a big transaction for better pack behavior"
Summary:
I broke some svn tests in that commit, but while fixing forward
realized that we're blocked from making this change because we rely on
rolling back the last commit in the case where the filemap creates an
empty commit.

We can revisit this when we have convert this all to rust!

Reviewed By: sfilipco

Differential Revision: D17140172

fbshipit-source-id: c93911f599afd2d22e84b3327a2a9455204065a0
2019-08-30 14:53:21 -07:00
Wez Furlong
846de7e82f hg: wrap convert in a big transaction for better pack behavior
Summary:
We noticed that the runtime for convert was exponential
due to way that packs were managed.

This wraps the convert in a big transaction so that we reuse an
existing pack rather than writing out one for each commit.

Reviewed By: xavierd

Differential Revision: D17138073

fbshipit-source-id: 46e418a49f917e2ffc411920ace1a3d98ac6b8e4
2019-08-30 14:10:00 -07:00
Xavier Deguillard
689256b99d remotefilelog: handle missing directory
Summary:
Wez noticed that when /var/cache/hgcache/<repo>/packs/manifest was missing, `hg
repack` would fail, not repacking anything. Let's fix the offending code to
properly ignore the missing directory.

Reviewed By: quark-zju

Differential Revision: D17120206

fbshipit-source-id: 7a7aebac717e5f128565ea2f8d50ffaeda4563f9
2019-08-30 11:23:22 -07:00
Stefan Filip
f8fa8d9367 manifest: add list directory functionality
Summary:
`listdir` returns the contents a directory in the manifest. The format
is pretty simple, containing only the simple names of the files and or
directories. I don't know if this is something that eden can use because
it seems to simple. In other words, we have something but we may want
to iterate on it before we market it broadly.

Reviewed By: quark-zju

Differential Revision: D17098082

fbshipit-source-id: d6aa42c96781cf1f8b2e916fa10bb275593bdc65
2019-08-30 10:50:05 -07:00
Stefan Filip
ffb563f1bb manifest: add subdir_diff compatibility function for gettreepacks
Summary:
The C++ manifest implements walksubdirtrees which is used to compute the packs
that a "client" wants for a prefetch. In terms of interface the function is very
annoying and couples with storage and tree representations without being part
of any of them.

We reproduce that functionality as a means to replace the C++ implementation.
The long term goal is to do lazy fetches using an iteration style that plays
nicer with batching downloads.

This change also includes fastmanifest updates because they are required to
enable the walksubdirtrees functionality in our tests.

Reviewed By: quark-zju

Differential Revision: D17086669

fbshipit-source-id: 6c1f9fbf975814f0a2071f8d1c8e022e5ad58e29
2019-08-30 10:50:05 -07:00
Thomas Orozco
fa4e12df09 wireproto logging: capture getpack
Summary:
ignore-conflict-markers

This updates Mercurial to add a loggetpack option for wire proto logging that
allows capturing getpack responses. This will be useful to verify correctness
for ovrsource on Mononoke (right now, Mononoke isn't serving traffic for hosts
that use getpack).

Reviewed By: StanislavGlebik

Differential Revision: D17091537

fbshipit-source-id: 755a429949d7645010dddab95202c613025f2984
2019-08-30 05:08:18 -07:00
Xavier Deguillard
309229fdf5 remotefilelog: do no build the entire ancestormap in remotefilectx.parents
Summary:
While working on a stack, I noticed that `hg amend -e` would sometimes download
a lot of history information. For a 4 files change, I saw 738 history entry
fetched individually...

Looking at the profile, this pointed towards remotefilectx.parents requesting
the entire ancestormap. Since that function really only need the nodeinfo,
let's only get that.

Reviewed By: DurhamG

Differential Revision: D17104263

fbshipit-source-id: fae1f673b2d2a641ae4f22d1099317cc5abd8447
2019-08-29 09:51:38 -07:00
Thomas Orozco
243716cdc4 commitcloud: add missing parameter
Summary:
Someone reported an error in this function being called with a missing
argument.

Reviewed By: quark-zju

Differential Revision: D17110694

fbshipit-source-id: 65adbae7e1380652afd1cec8bd3e2bbef27268dd
2019-08-29 09:06:34 -07:00
Jun Wu
74d5e02eb8 chg: remove hashstate and validation logic
Summary:
After D7840236 stack, it's possible to have a single chg server that handles
different [extensions] configurations. The 'validate' step and 'hashstate' were
mainly designed to detect changes of [extensions], the source code of the
extensions. That becomes unnecessary with the latest design.

Remove them to simplify the logic.

chg no longer creates symlink `server2 -> server2-hash`. Bump the name
to `server3` to explicitly break compatibility.

Reviewed By: xavierd

Differential Revision: D16866463

fbshipit-source-id: 5e1d00e6f895d9b8ead0bcabefcea11756f57c94
2019-08-28 19:26:26 -07:00
Jun Wu
a7721506ed chgserver: use bindings.commands to run commands
Summary:
Use hgcommands via its bindings to run commands. This allows chg to run Rust
commands.

Reviewed By: xavierd

Differential Revision: D16866466

fbshipit-source-id: 0c264a6b5441d2d0b2cdd01beefda5606b00cc61
2019-08-28 19:26:25 -07:00