This is an archive of the discontinued Mercurial Phabricator instance.

narrow: rework logic to check whether we need to widen and narrow
ClosedPublic

Authored by pulkit on Oct 23 2018, 9:52 AM.

Details

Summary

This patch reworks logic which calculates whether we need to extend or narrow
our working copy or not.

We filter the addincludes, removeincludes, addexcludes and removeexcludes passed
from user to the actual added and removed includes and excludes. What that means
is a user can pass an already included path as addincludes, a path which is not
included as removeincludes etc. In such situations the old logic use to think we
need to do some work, whereas we don't need to do that work.

In old logic, even if we don't have anything new to include but it believes we
need to call widen, this adds some good amount of work on large repository. A
widen calls involves computing incomming csets, calling the narrow_widen() which
in non-ellipses cases goes through all the set of csets which are available
which can take ~2-3 mins on large repos. Those 2-3 minutes are spend on doing
nothing which a client can prevent by checking is there really anything which
needs to be included.

The tests changes shows that we don't go to the server anymore in such cases
which is nice.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

pulkit created this revision.Oct 23 2018, 9:52 AM
martinvonz accepted this revision.Oct 23 2018, 11:24 AM
martinvonz added inline comments.
hgext/narrow/narrowcommands.py
429

nit: s/extend/widen/? that seems like the natural opposite to (the verb) "narrow"

This revision is now accepted and ready to land.Oct 23 2018, 11:24 AM
pulkit added inline comments.Oct 23 2018, 11:34 AM
hgext/narrow/narrowcommands.py
429

I am fine with anyone, you can fix this in flight or I can send an updated version too.

pulkit updated this revision to Diff 12325.Oct 23 2018, 12:07 PM
This revision was automatically updated to reflect the committed changes.