( )⚙ D11956 exchange: add fast path for subrepo check on push

This is an archive of the discontinued Mercurial Phabricator instance.

exchange: add fast path for subrepo check on push
ClosedPublic

Authored by joerg.sonnenberger on Jan 2 2022, 7:29 PM.

Details

Summary

Try to check if .hgsub and .hgsubstate exist at all before looking
for them in every changeset to be pushed. The latter can be quite
expensive for large repositories and the existance check is almost free.

Diff Detail

Repository
rHG Mercurial
Branch
default
Lint
No Linters Available
Unit
No Unit Test Coverage

Event Timeline

Alphare added a subscriber: Alphare.Jan 3 2022, 5:41 AM
Alphare added inline comments.
mercurial/exchange.py
533

That seems like a very wide net to throw. Do we have a more specific way of falling back?

mercurial/exchange.py
533

The problem here is remotefilelog, which has a custom hag for .hgtags and otherwise throws a runtime error. So no, I don't think there is a more specific way without changing the implementation.

Alphare requested changes to this revision.Jan 4 2022, 11:58 AM
Alphare added inline comments.
mercurial/exchange.py
533

Can't we either change the exception to be more fine-grained in remotefilelog (and still inherit from RuntimeError to not break anything) or detect a remotefilelog repo and early return? I'm really not comfortable catching this wide.

This revision now requires changes to proceed.Jan 4 2022, 11:58 AM
mharbison72 added inline comments.
mercurial/exchange.py
531

I assume this checks if the file exists anywhere in history (since it doesn't mention a rev), to handle the case of the files being removed? (I don't see the file() function on the localrepository class, so I'm not sure what this is doing)

Alphare accepted this revision.Jan 17 2022, 4:24 AM
This revision is now accepted and ready to land.Jan 17 2022, 4:24 AM