def _check_scm(self): try: self.info('Checking whether {0} is a mercurial repository'.format(self.scm_url)) parsing_result = remote_parser.parse_url(self.scm_url, 'tip') except Exception as e: try: self.info('Checking whether {0} is a git repository'.format(self.scm_url)) self.files = set(lsgit.list_git_files(self.scm_url, allow_depth=False)) self.scm = 'git' except Exception as e: self.info('Checking whether {0} is a subversion repository'.format(self.scm_url)) # FIXME detect directory # Plugin for which detection is useful: #2805 self.scm_url = 'https://' + self.name + '.googlecode.com/svn' scm_cache = get_scm_cache() try: self.files = scm_cache[self.scm_url] self.debug('Obtained file list from cache for URL {0}'.format(self.scm_url)) except KeyError: self.files = set(lssvn.list_svn_files(self.scm_url)) self.info('Subversion files: {0!r}'.format(self.files)) trunkfiles = {tf[6:] for tf in self.files if tf.startswith('trunk/')} if trunkfiles: self.scm_url += '/trunk' self.files = trunkfiles self.info('Found trunk/ directory, leaving only files in there: {0!r}'.format(self.files)) self.scm = 'svn' else: self.files = set(next(iter(parsing_result['tips'])).files) self.scm = 'hg'
def __init__(self, *args, **kwargs): global remote_parser super(BitbucketMatch, self).__init__(*args, **kwargs) self.name = self.match.group(2) self.scm_url = 'https://bitbucket.org/' + self.match.group(1) + '/' + self.name try: self.info('Checking whether {0} is a mercurial repository'.format(self.scm_url)) parsing_result = remote_parser.parse_url(self.scm_url, 'tip') except Exception as e: self.info('Checking whether {0} is a git repository'.format(self.scm_url)) self.files = lsgit.list_git_files(self.scm_url) self.scm = 'git' else: self.files = list(next(iter(parsing_result['tips'])).files) self.scm = 'hg'
def __init__(self, *args, **kwargs): global remote_parser super(BitbucketMatch, self).__init__(*args, **kwargs) self.name = self.match.group(2) self.scm_url = "https://bitbucket.org/" + self.match.group(1) + "/" + self.name try: self.info("Checking whether {0} is a mercurial repository".format(self.scm_url)) parsing_result = remote_parser.parse_url(self.scm_url, "tip") except Exception as e: self.info("Checking whether {0} is a git repository".format(self.scm_url)) self.files = lsgit.list_git_files(self.scm_url) self.scm = "git" else: self.files = list(next(iter(parsing_result["tips"])).files) self.scm = "hg"
def _check_scm(self): self._check_presence() try: if self.scm_url.endswith('.git'): self.info('Assuming {0} is not a mercurial repository'.format(self.scm_url)) self.scm_url = self.scm_url[:-4] raise NotLoggedError self.info('Checking whether {0} is a mercurial repository'.format(self.scm_url)) parsing_result = remote_parser.parse_url(self.scm_url, 'tip') except Exception as e: self.info('Checking whether {0} is a git repository'.format(self.scm_url)) self.files = set(lsgit.list_git_files(self.scm_url)) self.scm = 'git' else: self.files = set(next(iter(parsing_result['tips'])).files) self.scm = 'hg'
def _check_scm(self): self._check_presence() try: if self.scm_url.endswith('.git'): self.info('Assuming {0} is not a mercurial repository'.format( self.scm_url)) self.scm_url = self.scm_url[:-4] raise NotLoggedError self.info('Checking whether {0} is a mercurial repository'.format( self.scm_url)) parsing_result = remote_parser.parse_url(self.scm_url, 'tip') except Exception as e: self.info('Checking whether {0} is a git repository'.format( self.scm_url)) self.files = set(lsgit.list_git_files(self.scm_url)) self.scm = 'git' else: self.files = set(next(iter(parsing_result['tips'])).files) self.scm = 'hg'
def _check_scm(self): try: self.info('Checking whether {0} is a mercurial repository'.format( self.scm_url)) parsing_result = remote_parser.parse_url(self.scm_url, 'tip') except Exception as e: try: self.info('Checking whether {0} is a git repository'.format( self.scm_url)) self.files = set( lsgit.list_git_files(self.scm_url, allow_depth=False)) self.scm = 'git' except Exception as e: self.info( 'Checking whether {0} is a subversion repository'.format( self.scm_url)) # FIXME detect directory # Plugin for which detection is useful: #2805 self.scm_url = 'https://' + self.name + '.googlecode.com/svn' scm_cache = get_scm_cache() try: self.files = scm_cache[self.scm_url] self.debug( 'Obtained file list from cache for URL {0}'.format( self.scm_url)) except KeyError: self.files = set(lssvn.list_svn_files(self.scm_url)) self.info('Subversion files: {0!r}'.format(self.files)) trunkfiles = { tf[6:] for tf in self.files if tf.startswith('trunk/') } if trunkfiles: self.scm_url += '/trunk' self.files = trunkfiles self.info( 'Found trunk/ directory, leaving only files in there: {0!r}' .format(self.files)) self.scm = 'svn' else: self.files = set(next(iter(parsing_result['tips'])).files) self.scm = 'hg'
def files(self): try: return set(lsgit.list_git_files(self.scm_url)) except Exception as e: logger.exception(e) return lsgit.list_git_files(self.scm_url, allow_depth=False)