I'm writing an initial patch to let the user control pristines-on-demand
on and off per WC.

Here I will assume:

  - The user needs a way to populate all pristines throughout the whole
WC when they want to, for example before they go offline.

At first I thought we would have an option value that represents the
state where all pristines are definitely present, as in older formats.
But we want a setting that is under direct control of the user, not a
state that Subversion reports from an API (although we might want that
as well). The user may change the setting at any time, when some
pristines may be absent, so there is no "all pristines are present right
now" mode setting.


SEMANTICS

The user can choose one mode, per WC, from a list of options that may include:

  - off: as in previous versions, no checking, just assume all pristines
are present
  - pristines-on-demand: fetch "wanted" pristines; discard others
  - fetch-only: fetch any pristine that's absent; do not discard

If the user wishes to ensure all pristines in the WC are present, they
can set the "fetch-only" mode and then run some svn command that fetches
all missing pristines.

If the user wishes to change a WC from having all pristines present to
pristines-on-demand, keeping pristines only for files that are currently
modified and discarding the rest, they can set the "pristines-on-demand"
mode and then run some svn command that discards all "unwanted" pristines.

In both of those cases, it doesn't particularly matter which command the
user has to run, just so long as we ensure there is one that we can recommend.

Additional options are possible such as:

  - off-line: use existing pristines; do not fetch or discard

The "off" and "off-line" modes imply basically the same behaviour; where
they differ is in the expectation that all pristines are present when we
choose "off" mode. I am not yet sure if we will want to keep such a
distinction in the end.


PERFORMANCE

The current pristines-on-demand' branch implementation does two scans of
the given WC subtree, one before and one after certain operations, as I
mentioned before.

  - "pristines-on-demand" mode: these scans are needed.

  - "off" and "off-line" modes: these can be skipped entirely.

  - "fetch-only" mode: the scan after the operation can be skipped,
while the scan before it will still be performed, even when all the
pristines (at least in the subtree) are already present.

Are we going to need to optimise until the cost is negligible at least
when pristines are all present, so that the user would never have need
to turn the feature "off" completely to match current performance?


IMPLEMENTATION

My patch initially uses a file '.svn/pristines-on-demand' as a
place-holder for wherever we might choose to store the setting properly
(in wc.db for example).

Help please: Where should we properly store this setting in the WC?

- in '.svn/entries' or '.svn/format'?
  (Both currently contain a single line saying "12". We could add an
extra line, or in general N extra lines each with one setting, for example.)
- in a new file such as '.svn/pristines-on-demand'?
- in the wc.db somewhere?

Do we have any precedent of user controlled settings in the WC? I can't
find any.

- Julian

Reply via email to