[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Unshelving through the new WC editor API

From: Julian Foad <julianfoad_at_apache.org>
Date: Fri, 01 Feb 2019 13:06:24 +0000

Julian Foad wrote on 2019-01-14:
> I'm starting to re-implement "unshelve" using the new WC editor API. [...]
> What I'll want to do now is drive a WC-mods-editor with the changes found: [...]

That's committed and working.

Next I'll want to use the editor API for pushing changes *into* a shelf. And there's not much point in that unless I also upgrade the shelf storage to support all or more of the possible ("committable") changes that the editor API supports -- especially operations on directories (mkdir, rmdir) and copies.

I put my thoughts on IRC the other day, like this:

I was starting to rewrite the shelf storage to be driven by a delta editor, and at the same time thinking how to make it able to store "copy" operations. That's becoming more and more like a real WC. Realizing how complex it is to write that from scratch, I'm now thinking it's time to ditch the current storage and use a "real" WC to store a shelf, as the next development iteration.

Now, at last, a "real" WC supports delta-editor for input (svn_client__wc_editor) and output (svn_client__wc_replay) of local-modifications. That means it's becoming feasible to "simply" copy changes from one to another -- the "svn x-wc-copy-mods" command implements this and (mostly) works. I don't claim it's complete and bug-free yet. I think "svn_client__wc_replay" mostly is complete and correct, but svn_client__wc_editor isn't. But it's fairly close.

And this isn't everything we need to implement decent shelving. The next thing we need is ability to copy a WC-base. Copying a WC-base can be done partly with the (unfinished) "svn info --x-viewspec" thing, which basically serializes a "reporter" drive. I have an idea to look into, about how to implement efficiently the receiver end of that.

And, to make shelving better, we want to augment the "local mods editor". Currently, based on delta_editor_t, it only supports committable changes. That means shelving won't preserve "local move" info, as well as all other uncommittable WC states (conflicts, changelists, unversioned files, etc.) To support uncommittable WC state, we need to upgrade to another API that extends or augments svn_delta_editor_t adding those other things. Ultimately, I believe every kind of state that a WC can store should be able to be input and output (symmetrically) through such an API.

Back to the local-mods delta-editor support. One more piece is still needed. To implement the delta-editor "copy" operation, we need a way to fetch the base of the copy. The delta-editor API doesn't provide this; it assumes its user will be able to use any copy-from-URL to contact a repository and reference the copy-base in there. I propose that the first implementation of shelving using delta-editor will do just that: contact the repository whenever it needs the base of a copy.

Later I can formalize an extension to the delta-editor API, that's something like a callback for fetching a subtree from a source that isn't necessarily a repository but could be a WC or shelf instead, in a standard way.

There's a more major issue with wc_editor at the moment. I haven't been clear whether it's meant to apply edits against the WC base state, or whether it's meant to apply edits against the current working state. The latter is what I've mainly meant it to do, but I need to check it's consistent. And I haven't been clear to what extent it should attempt to do merging, if the existing WC state differs from the base state of the given edits. Maybe more than one variant will be needed.

Baby steps, in order:
  (1) Shelve committable changes, with very simple capture of WC base state (maybe assumes single-revision, for example): a good enough first step.
  (2) Better capture of base state.
  (3) Better replay of "copy" operations, reading WC local storage to fetch their base rather than contacting the repo.
  (4) Support some uncommittable changes such as "local move".

Etc. Each step extends the relevant interface, which is a single interface definition and two or more implementations of it (into-wc, out-of-wc, and maybe into-shelf, out-of-shelf if a shelf is not equal to a WC).

Right now I'm starting to implement Shelving v3 using a WC for shelf storage. To copy changes between shelf storage WC and user's WC, it uses the equivalent of "svn x-wc-copy-mods" which is implemented with svn_client__wc_replay() piped to svn_client__wc_editor().

Using a whole WC for each shelf-version is space-inefficient. I'm putting up with that, in the initial implementation, for the sake of developing the right architecture and APIs, which is my priority. Because this isn't just about creating some kind of shelving that works well enough to be usable (though that's nice to have).

-- 
- Julian
Received on 2019-02-01 14:06:32 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.