def write(self):
if os.path.isfile(self.lib):
with open(self.lib) as f:
lib_repo = Repo.fromurl(f.read().strip())
if (formaturl(lib_repo.url, 'https') == formaturl(self.url, 'https') # match URLs in common format (https)
and (lib_repo.rev == self.rev # match revs, even if rev is None (valid for repos with no revisions)
or (lib_repo.rev and self.rev
and lib_repo.rev == self.rev[0:len(lib_repo.rev)]))): # match long and short rev formats
#print self.name, 'unmodified'
return
ref = (formaturl(self.url, 'https').rstrip('/') + '/' +
(('' if self.is_build else '#') +
self.rev if self.rev else ''))
action("Updating reference \"%s\" -> \"%s\"" % (relpath(cwd_root, self.path) if cwd_root != self.path else self.name, ref))
with open(self.lib, 'wb') as f:
with_auth = urlparse(ref)
f.write(with_auth._replace(netloc=with_auth.hostname).geturl())
f.write("\n")
评论列表
文章目录