overwrite=True causes unnecessary re-cloning of git repositories
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
codetree |
Confirmed
|
Medium
|
Unassigned |
Bug Description
If codetree is asked to fetch a git branch with overwrite=True, then it always removes any existing repository. This makes some Mojo specs very slow to run on slow connections (e.g. doing even simple operations on lp:~ubuntuone-pqm-team/canonical-mojo-specs/mojo-ols-snap-store takes me half an hour), because they keep re-cloning fairly large charm repositories over and over again.
The relevant chunk of code looks like this:
if options.
if not log_failure(
else:
if not self.check_
if ref is None: # default to master for the checkout of any updated repo
This is just one possibility for an improved structure and I haven't tested it, but I think that something like this would work better:
try:
except (NotABranch, NotSameBranch):
if options.
if updated:
if ref is None: # default to master for the checkout of any updated repo
elif options.
if not log_failure(
else:
Seems like a reasonable change, would obviously need testing.