#16373: svn fetch type should maintain a persistent working copy -------------------------------------+-------------------------------------- Reporter: ryandesign@macports.org | Owner: macports-tickets@lists.macosforge.org Type: enhancement | Status: new Priority: Normal | Milestone: MacPorts base enhancements Component: base | Version: 1.7.0 Keywords: | -------------------------------------+-------------------------------------- "`fetch.type svn`" is inefficient in that it checks out a new working copy every time, directly to the work area. That would be like a normal port downloading the distfile every time. Instead, we should check out a working copy to that port's distpath, and then in the extract phase we should `svn export` it to the work area. Some checks will be needed in the fetch phase to ensure that an existing working copy: * has no modifications: check `svn status`. Ideally we would try to clean up the working copy, for example by `svn revert`ing modified or added or deleted files, and then in a second `svn status` run, delete any unversioned files. But it's already an improvement if we just discard the working copy if `svn status --ignore-externals` produces any output. * is from the right URL: check `svn info`: check if the "URL" is the one we want. If not, check that the "Repository Root" is a substring of the repository we want. If yes, try to `svn switch` to the URL and revision we want; if not, discard the working copy. So the fetch phase would go something like... {{{ if {working copy exists} { if {working copy has modifications} { delete working copy } } if {working copy exists} { if {working copy url is the one we want} { svn update to the desired revision } else { if {working copy repository root matches beginning of desired url} { try to svn switch to the desired url and revision if {an error occurred} { delete working copy } } else { delete working copy } } } if {working copy doesn't exist} { check out working copy } }}} And the extract phase is simply to `svn export` the working copy from the distpath to the worksrcpath. (There is [http://subversion.tigris.org/issues/show_bug.cgi?id=2429 one problem] if the working copy has externals and the user is using Subversion earlier than 1.5, for example Subversion 1.4.whatever which is included with Leopard. But rather than spend time working around this in base, I think this is a case where the port should depend on MacPorts subversion.) -- Ticket URL: <http://trac.macports.org/ticket/16373> MacPorts <http://www.macports.org/> Ports system for Mac OS