Re: [RFC] Shelving and Checkpointing
From: Julian Foad <julian_at_assembla.com>
Date: Mon, 10 Jul 2017 14:03:41 +0100
Shelving and Checkpointing Dev.
Local History Operations for Subversion
The Problem
Checkpointing
The Solution
Checkpointing
Feature/Benefit Matrix; Comparison with Existing Options
Role Models
The Design
Extensions / Not Supported Initially
Integrate Shelving with Changelists
Checkpointing
Checkpointing Option 1
Checkpointing Option 2
Checkpointing Option 3
Extensions / Not Supported Initially
Rebasing Checkpoints
Integrating Checkpoints with Shelving
GUI Considerations
Complete WC State Shelving
Existing Issues to Overcome
References:
1.
Shelving-Checkpointing Dev
Shelving-Checkpointing UI
issue SVN-3625 <https://issues.apache.org/jira/browse/SVN-3625> "Commit
issue SVN-3626 <https://issues.apache.org/jira/browse/SVN-3626> "Commit
Svn Wiki page "Design: SavePoints
The Problem
This is the problem we are looking to solve. We will use this to determine
While developing one change, you need to stop and work on an urgent fix or
Priorities: fast, offline.
While developing a change, you reach a state which you want to save. The
In other words, you want successive local commits, and then be able to:
-
discard the entire work, or
roll back to an intermediate state, or
commit as a whole, or
commit all the separate steps.
Priorities: fast, offline.
One-click patch management on top of 'svn diff' and 'svn patch'.
-
similar to "git stash"
backward-compatible extension to WC format
(old clients still work, just not seeing the shelved changes)
Functions:
-
shelve/stash: save a WC diff as a patch and revert it from WC
unshelve/stash-pop: apply specified patch to WC and delete the patch
list shelved patches and the files that they affect
delete shelved patches
shelving supports exactly the same kinds of change as 'svn patch' and
Compared to manual patch management:
-
one-click simplicity
don't need to choose a filename or remember where it is
still can't save & restore WC base state (in v1)
Checkpointing
Options:
1.
further patch management built on a series of shelved changes
local commits tightly integrated
checkpoints are commits in a local repository
Option 1 looks and feels like an extension -- clunky, new commands,
-
key benefit: roll back to a checkpoint
key drawback: limited support for viewing current work against last
backward-compatible extension to WC format
(old clients still work, just not seeing the checkpoints)
Option 2 looks and feels like a Subversion version of DVCS local commits. A
-
key benefit: view the current work against the last checkpoint
key drawback: not very feasible to implement in current state of
incompatible change of WC format
Option 3 looks and feels like using native Subversion on a local branch,
-
key benefit: works exactly like normal svn commits in many ways
key drawback: a simple implementation will increase WC size by 50% and
backward-compatible extension to WC format
(when checkpoints are in use, an old client would see only the
Feature/Benefit Matrix; Comparison with Existing Options
Shelving
(& Checkpoints)
server branch
patch files
extra WCs
Shelving (patches)
Chkpt 1
Chkpt 2
Chkpt 3
works offline
no
yes
yes
yes
yes
yes
yes
one-click simplicity
no
no
no
yes
yes
yes
yes
fast
no
yes
medium
yes
yes
yes
yes
low disk space requirement
yes
yes
no
yes
yes
yes
yes
incremental re-build
yes
yes
no
yes
yes
yes
yes
save & restore WC base state
no
no
yes
no
no
yes
yes
save & restore uncommittable state (conflicts, etc.)
no
no
yes
no
n/a
n/a
n/a
can discard the entire work
no
yes
yes
yes
yes
yes
yes
back-compatible WC format
n/a
n/a
n/a
yes
yes
no
yes
Checkpoints
(additional)
server branch
patch files
extra WCs
Checkpt 1 (patches)
Checkpt 2 (special)
Checkpt 3 (local repo)
roll back to any checkpoint
yes
yes
yes
yes
yes
yes
commit as a whole
yes
yes
yes
yes
yes
yes
commit all the separate steps
yes
awkward
awkward
yes
yes
yes
incremental view in WC
yes
no
no
no
yes
yes
automatic checkpoints to enable rolling back a conflicting update
no
no
no
no
can do
maybe
Note: "Automatic checkpoint" is listed as a separate feature, under the
With Shelving, we are catching up with a feature that most current VCSs
SHELVING
git stashing <https://git-scm.com/book/en/v1/Git-Tools-Stashing>
hg shelving <https://www.selenic.com/mercurial/hg.1.html#shelve>
bzr shelving
p4 shelving
IntelliJ
NetBeans
general
well integrated
simple patch
stored where?
local repo
WC/.hg/
WC/.bzr/
the depot (shareable)
local (project dir by default)
~/.netbeans/
stored how?
special commit
git patch
special commit?
special commit (changelist)
svn+git patch
patch + MIME binary support
changelist integration
n/a
tight: a shelf is a p4 change
cl <==> shelf strong association
no
pop vs. apply
pop or keep
backup or keep
pop or keep
pop
backup or keep
pop or keep
access in other cmds
yes
diff,diff2,files,print
(no)
(no)
merge & conflicts
regular merge
temp. commit + merge + continue
regular merge
The Design
For UI design, see Shelving-Checkpointing UI
Implementation in libsvn_client with 'svn' command-line UI.
Main functionality:
-
shelve/stash [name] [paths/changelist]: save a WC diff
if no name given, automatically generate a name
reverts the successfully shelved changes from the WC
unshelve/stash-pop: apply specified patch to WC
optionally removes the patch
can apply to any revision or branch
list/delete shelved patches
stores patches in '.svn' dir, e.g. in '.svn/patches/'
standard svn patch file format; paths relative to WC root
Extensions / Not Supported Initially
Kinds of change that can be shelved:
WC State or Change
starting point
fair usability
good usability
committable changes
file text, file delete/add, most properties
yes
yes
yes
mergeinfo changes
no
yes
yes
copies and moves
no
yes
yes
directories (mkdir/rmdir/...)
no
yes
yes
binary files & properties
no
yes
yes
uncommittable state
unresolved conflicts
no
no
yes
changelist assignment
no
no
yes
unversioned items (git stash -u/-a)
no
no
no
inconsistent WC states (missing/obstructed)
no
no
no
WC base state (rev, URL, switched, depth)
no
no
no
Other shelving extensions to consider:
-
remember the order; 'unshelve' takes newest patch by default
allow showing a shelf's content -- like 'svn log' options
keep a backup when unshelving
allow a description (log message) in shelves and changelists
show it when listing shelves/changelists
use it when committing from a changelist that has a log msg
handle conflicts better, using a proper merge rather than patching
Integrate Shelving with Changelists
I hate to add complexity without simplifying something at the same time.
-
a changelist is a named set of file-paths in the WC; each path may be
a shelved change is a named set of file-patches that is not currently
Integrate them like this:
-
shelved changes and changelists share the same namespace
shelving means making a separate patch for each changelist (and one for
unshelving means converting shelved changes to changelists
Benefits:
-
clear and simple relationship with no overlap
changelists remain backwards-compatible
Main issues:
-
a changelist can include unmodified paths:
should a shelved patch also include unmodified paths?
a path can appear in multiple shelves, but only in one changelist:
what to do when unshelving if a path clashes?
-
any extensions should apply uniformly to both shelving and changelists
Role models:
-
changelists in IntelliJ IDEA
changelists in Perforce
CheckpointingCheckpointing Option 1
Further patch management built on a series of shelved changes. The working
Take design ideas from Mercurial Queues?
Functionality:
-
all existing svn WC commands operate against original base revision
status, diff, revert, commit, etc.
some new commands operate against last (or any) checkpoint
status, diff, etc.
limited subset and not exactly equivalent functionality
new commands for new operations such as commit-all-separately and
'svn update' disallowed, as it implies rebasing the checkpoints
Checkpointing Option 2
Local commits tightly integrated into svn WC functionality & command syntax.
Functionality:
-
all svn WC commands operate against latest checkpoint by default
status, diff, revert, etc.
all svn WC commands can operate against any intermediate checkpoint
using extended revision-selector syntax
'svn update' disallowed, as it implies rebasing the checkpoints
Main design tasks:
-
pseudo-revision syntax to address local commits, in all WC and higher
WC storage for multiple versions
WC able to switch the 'current base version' to an arbitrary stored
internal ability to:
diff & merge arbitrary versions (local as well as repository versions)
send merge output to any WC layer (base or working or checkpoint)
UI and high level implementation of the new checkpointing features
No feasible implementation plan for this option.
Checkpoints are commits in a local repository embedded in the WC.
Functionality:
-
all svn WC commands operate against latest checkpoint by default
status, diff, revert, etc.
all svn WC commands can operate against any intermediate checkpoint
using standard svn repository-access syntax
all svn repository operations by default only see the checkpoints
e.g. 'svn update' moves only from one checkpoint to another
Design points:
-
each series of checkpoints is stored in a new local repository
committing a first checkpoint creates a new local repository, stores the
convenient access to the original repository is limited to specific new
Extensions / Not Supported Initially
-
rebasing checkpoints
Rebasing Checkpoints
It is desirable to be able to rebase a series of checkpoints, when pulling
Rebasing checkpoints is more important in trunk-based, less important in
How are shelving and checkpoints related conceptually?
In other words, what do we expect to happen if we start working, make some
1.
one series of checkpoints, plus a set of stashed working states
each stashed working state is relative to a particular checkpoint
each stashed working state is relative to the original base
multiple shelves, each holding a series of checkpoints plus a working
all shelves are based on the same "original" base state
(A checkpoint is a committable change; a working state is a committable
And is there also a degenerate option where we simply don't track what each
Needs design.
GUI priorities tend to be a little different from a CLI.
-
APIs that do the job simply and reliably
progress indication and cancel, for any long-running ops
hopefully we won't have any long-running ops
ability to undo
we don't have to implement undo, just provide enough hooks so caller
Complete WC State Shelving
A key concern will be to have APIs that do the job simply and reliably.
We should have two complementary APIs:
-
a "shelve" API should visit the WC reporting absolutely everything about
a "diff" API should report the subset of this that is committable;
an "unshelve" API should be able to recreate any such state, using input
a "patch" API should accept the subset of this that is committable.
To what extent do such APIs exist?
We should write automatic round-trip testing for diff-&-patch and for
For states that we can't shelve, a GUI wants to know in advance that this
-
an API to efficiently tell whether the WC state can be shelved (or why
Existing Issues to Overcome
Bugs and deficiencies:
-
svn patch to handle mergeinfo: SVN-3747
svn diff/patch to handle binary files (is partly done -- in "svn diff
svn diff/patch to handle copies and moves: SVN-1056
svn diff/patch to handle directories (mkdir, rm, cp, mv)
------------------------------
|
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.