On Thu, Nov 19, 2009 at 03:54:58AM +0100, Martin Furter wrote: > > Hello > > I've written a little design document to specify 'views'. > > Attached is also a 'proof-of-concept' python script which should > behave pretty much the same as svn checkout does, except that it > supports views > (it's not very well tested since I'm stuck with svn 1.4 on linux and > had to debug it on WinDoS, but at least "--view srv-side -F views.conf" > should work fine). > > Please give me your feedback :) > > Thanks > Martin > > > [[[ > Contents > ======== > > 0. Goals > 1. Design > 2. User Interface > 3. Examples > 4. API Changes > > > 0. Goals > ======== > > Many users have very large trees of which they only want to > checkout certain parts. In Subversion 1.5 sparse directories > have been introduced. > > This proposal adds 'views' on top of sparse directories. A view > is a list of subdirs and files with depth information. On checkout > with '--view NAME' is checked out and those paths are updated to > the specified depth.
Nice idea! > 1. Design > ========= > > Views are defined in a simple text file. Empty lines and lines > starting with a '#' are ignored. All other lines must start with > 'view' or with one of the accepted depth values, followed by at > least one whitespace and an argument. > > 'view' starts a new section describing the view, and the argument > is the name of the view. All lines following the view up to the > next view or end of file belong to this view. > > Lines starting with a depth value have a path as argument. This > path is to be updated to the given depth. Intermediate directories > which are not specified for the view are updated to depth 'empty'. > It is an error to specify subdirs of a dir which has depth > 'infinity. The special path '.' is used to set the depth of the > root directory. The default depth for the root is 'empty'. > > Also a new property 'svn:views' is introduced. It is set on trunk > and its content is a relative path to the views configuration file. Why not put the view specification into the svn:views property directly, rather than into a separate file? Else, what happens if the file doesn't exist? Also, "set on trunk" is not generic enough. Many Subversion repositories do have a "trunk" but it's not required. So why not allow this property on any folder, and have it take effect if it is set on the folder which is being checked out, and if the view specified by the user is defined in the property at HEAD? Any svn:view properties above or below the folder being checked out would silently be ignored. > 2. User interface > ================= > > Checkout accepts the new option '--view' whose argument is the > name of the view to checkout. '--view' and '--depth' are > mutually exclusive since the depth of the root directory is > specified in the view config file. > > Additionally checkout accepts '-F' (--file) to specify a local > view config file. It is an error to use '-F' without '--view'. If the view is specified within the property, users could simply edit the property locally to test local changes. The -F flag would not be necessary. > > > 3. Examples > =========== > > Initializing the views: Create the file "views.conf" containing > three views, "dev", "docs" and "srv-side". > > cat > views.conf << EOF > view dev > files . > infinity build > infinity subversion > > view docs > empty . > infinity doc > infinity notes > infinity www > > view srv-side > empty . > infinity tools/server-side > infinity contrib/server-side > EOF > svn add views.conf > svn ps svn:views views.conf . > svn ci > > Checkout of the view "dev": > > svn co --view dev http://svn.apache.org/repos/asf/subversion/trunk > > > Checkout of the view "dev" using a local config file: > > svn co -F ./views.conf --view dev \ > http://svn.apache.org/repos/asf/subversion/trunk > > > > 4. API Changes > ============== > > Only the following public function is added, the parameters are > mostly the same as for svn_client_checkout3: Then why not add this new feature in a new version svn_client_checkout4()? > > svn_error_t* > svn_client_checkout_view(svn_revnum_t *result_rev, > const char *URL, const char *view_name, > const char *view_file, const char *path, > const svn_opt_revision_t *peg_revision, > const svn_opt_revision_t *revision, > svn_boolean_t ignore_externals, > svn_boolean_t allow_unver_obstructions, > svn_client_ctx_t *ctx, apr_pool_t *pool); > > view_name: > Name of the view to checkout, must be non-null and non-empty. And this parameter would be allowed to be NULL meaning "I'm not selecting any view, behave like a normal checkout"? > > view_file: > Null if the views have to be read from the repository. If > non-null it must be a path to a local views config file. This parameter could also be dropped. Also, AFAIK it's currently not possible to update to a more shallow depth, but that's a problem with the depth feature rather than with views. But we need to specify how "svn update" should behave when svn:view properties (or config files) are modified, and how this interacts with the --set-depth option. Thanks, it's a lovely idea and builds nicely on top of an existing feature to enhance usability. Stefan