You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Julian Foad <ju...@apache.org> on 2019/02/12 10:34:18 UTC

Shelving v3 started

On the 'shelving-v3' branch:

* shelving uses a separate 'real' WC to store each shelf

* copying local modifications between the (main) WC and a shelf is, at last, done the Right Way using an Editor API:
    - "open(user's WC).replay_local_mods()" piped to "open(shelf-storage-wc).local_mods_editor()".

Benefits:

* every kind of committable change will be supported

* no shelf-specific code for storing and manipulating changes, just high level glue code

Problems:

* bug in reverting shelved changes from the main WC after shelving them:
    - added nodes don't get deleted from disk, even with 'svn revert --remove-added'
    - https://issues.apache.org/jira/browse/SVN-4798
    - causing XFAIL in shelf_tests 18 "shelve mkdir" and 20 "shelve replace dir"

* unshelve doesn't attempt to merge
    - assumes it's writing to a WC that matches the shelf base state
    - causing XFAIL in shelf_tests for merge and conflict tests (25, 26, 27, 28, 30)

* copying the WC base state is crude, space-inefficient
    - currently using a simple recursive copy of the entire WC dir including '.svn' metadata
    - currently puts shelves outside the main WC, in a sibling dir named, "<wc-dir>.shelves";
      that's just to avoid infinite recursion when doing the recursive dir copy, and could be
      changed to "<wc-dir>/.svn/experimental/shelves/v3" with a little tweak.

The only reason this is committed to a branch rather than trunk is that it is writing to a directory outside the WC. It would be worth tweaking that back inside ".svn" as soon as possible, in order to move the development back onto trunk.


Julian Foad wrote on 2019-02-01:
[...]
> 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.

Yay, working!

>   (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".
[...]


-- 
- Julian

Re: Shelving v3 started

Posted by Julian Foad <ju...@apache.org>.
> >   (2) Better capture of base state.

[Summarizing from IRC.]

Today I'm trying to figure out how to get Shelving v3 from last week's initial demo state (email "Shelving v3 started", branch "shelving-v3") to something that could be considered experimentally usable in a v1.12 release. My overall approach is to aim for high level APIs to do the required functional blocks; I'm not going to hack the wc-db.

The current state is to make a shelf we:
  - copy the whole (user's) WC to somewhere else where it will become the shelf storage for this shelf-version;
  - revert all the modifications in that copy so it is now a copy of the base state of the user's WC;
  - to shelve the *requested* changes we use the new high-level wc-copy-mods API to copy the requested local modifications from the user's WC to this shelf storage WC;
  - Finally, if requested ("shelve" versus "shelf-save"), we revert the requested mods from the user's WC.

The bit that needs work next is making a copy of the base state of the user's WC.

Here's the plan for that bit:

(1) Create the WC base checkout by using existing "checkout" code, initially driven from the repository, using URLs and revnums read from the user's WC (as in "svn info --x-viewspec").
(1a) For the whole WC; (1b) trimmed down to a given path specification.

(2) Create the WC base reading API (limited to a given path-spec) and think of a way to test/exercise it in isolation.

(3) Wire up (1) and (2) together.


For (1): The existing high level API to create a WC with a given base state (and no local modifications) is the client side of "checkout". Of course we only need to copy the base of locally modified nodes in the requested portions of the user's WC, not the whole WC. So we need an API that creates (a bit like checkout) a new WC that includes just those paths. I wonder if we could do that by using the "checkout" client-side machinery, unmodified, to create the WC, being driven from a "pretend Repository Access API" driver that feeds "real" data for the given paths and sets all other paths to depth-exclude.

For (2) the base-reading API: The existing high level API to read the base state of a WC is ... seems to be missing. "export" is but a small subset of it, lacking properties and repository URLs and revisions metadata. I can investigate starting from existing "diff -r0:BASE" code and see if that's useful. However, it writes directly to the diff-tree-processor API and I'm not sure if that's convertible to editor API.

Moving the shelf-storage-WCs location back inside .svn/experimental/... will be trivial after step (1a).

-- 
- Julian