if workdir:
os.chdir(workdir)
- if quiet:
+ if quiet and not config.debug:
fd = os.open('/dev/null', os.O_WRONLY)
os.dup2(fd, 1)
os.dup2(fd, 2)
else:
return contents
-def peek_remote(url, quiet=False):
- args = ['peek-remote', url]
- return call(args, quiet=quiet, fail=not quiet) == 0
+def url_exists(url):
+ if ':' not in url and os.path.isdir(url):
+ if config.debug:
+ 'Local directory:', url
+ return True
+
+ args = ['ls-remote', '-h', url]
+ return call(args, quiet=True, fail=False) == 0
def clone(name, url, checkout=True):
options = []
if config.debug:
print 'Trying', url
- if git.peek_remote(url, quiet=True):
+ if git.url_exists(url):
if self.branch:
- branch = self.branch
- return url, branch
+ return url, self.branch
+ else:
+ return url, branch
raise Error('Failed to locate repository under any root: ' + \
'%s.git' % self.name)