def get_local_url_list(): """ Get a list off all local repositories remote url's """ url_list = [] for repo in get_dir_list_from_filesystem(): os.chdir(repo[:-4]) url_list.append(git(['config', '--get', 'remote.origin.url']).rstrip()) return url_list
def get_all_possible_git_dirs(): """ There are two ways in getting git repo locations There are two ways to locate salt related git repos: 1. Via the salt config when looking into file_root and pillar_root and 2. via get_dir_list_from_filesystem We have to go both paths and then unify the results """ salt_root_dir = get_salt_root_dirs() all_git_dirs_found = [x[:-5] for x in get_dir_list_from_filesystem()] possible_git_dirs = set(salt_root_dir + all_git_dirs_found) checked_git_dirs = [x for x in possible_git_dirs if is_git_repo(x)] return sorted(checked_git_dirs)
def test_get_dir_list_from_filesystem_no_filter(self, mock_gsrd, mock_oswalk): self.assertEqual(['/fooo/.git'], get_dir_list_from_filesystem())