This is an archive of the discontinued Mercurial Phabricator instance.

sparse: consolidate common code for writing sparse config
ClosedPublic

Authored by indygreg on Jul 17 2017, 3:15 PM.

Details

Summary

In 3 functions we were writing the sparse config and updating the
working directory. In two of them we had a transaction-like process
for restoring the sparse config in case of wdir update fail.

Because the pattern is common, we've already made mistakes, and the
complexity will increase in the near future, let's consolidate the
code into a reusable function.

As part of this refactor, we end up reading the "sparse" file twice
when updating it. This is a bit sub-optimal. But I don't think it
is worth the code complexity to pass around the variables to avoid
the redundancy.

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

indygreg created this revision.Jul 17 2017, 3:15 PM
durin42 accepted this revision.Jul 17 2017, 5:48 PM
This revision is now accepted and ready to land.Jul 17 2017, 5:48 PM
This revision was automatically updated to reflect the committed changes.