New Ticket     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #16373 (new enhancement)

Opened 3 years ago

Last modified 6 months ago

svn git and hg fetch type should maintain a persistent working copy

Reported by: ryandesign@… Owned by: macports-tickets@…
Priority: Normal Milestone: MacPorts Future
Component: base Version: 1.7.0
Keywords: performance fetch Cc: jeremyhu@…
Port:

Description

"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 reverting 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  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.)

Change History

Changed 6 months ago by jeremyhu@…

  • keywords performance fetch added
  • summary changed from svn fetch type should maintain a persistent working copy to svn git and hg fetch type should maintain a persistent working copy

This should be done for mercurial and git as well. It's quite annoying to have to redownload sources every time through my debug itteration even though they haven't changed.

Changed 6 months ago by jeremyhu@…

  • cc jeremyhu@… added

Cc Me!

Note: See TracTickets for help on using tickets.