This is an archive of the discontinued Mercurial Phabricator instance.

transaction: make entries a private attribute (API)
ClosedPublic

Authored by indygreg on Sep 17 2018, 7:36 PM.

Details

Summary

This attribute is tracking changes to append-only files. It is
an implementation detail and should not be exposed as part of
the public interface.

But code in repair was accessing it, so it seemingly does belong
as part of the public API. But that code in repair is making
assumptions about how storage works and is grossly wrong when
alternate storage backends are in play. We'll need some kind of
"strip" API at the storage layer that knows how to handle things
in a storage-agnostic manner. I don't think accessing a private
attribute on the transaction is any worse than what this code
is already doing. So I'm fine with violating the abstraction for
transactions.

And with this change, all per-instance attributes on transaction
have been made private except for "changes" and "hookargs." Both
are used by multiple consumers and look like they need to be
part of the public interface.

.. api::

Various attributes of ``transaction.transaction`` are now ``_``
prefixed to indicate they shouldn't be used by external
consumers.

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.Sep 17 2018, 7:36 PM
This revision was automatically updated to reflect the committed changes.