def update(): ''' Execute a git fetch on all of the repos ''' gitfs = salt.utils.gitfs.GitFS(__opts__) gitfs.init_remotes(__opts__['gitfs_remotes'], PER_REMOTE_OVERRIDES) gitfs.update()
def setUp(self): ''' We don't want to check in another .git dir into GH because that just gets messy. Instead, we'll create a temporary repo on the fly for the tests to examine. ''' if not gitfs.__virtual__(): self.skipTest("GitFS could not be loaded. Skipping GitFS tests!") self.integration_base_files = os.path.join(FILES, 'file', 'base') # Create the dir if it doesn't already exist try: shutil.copytree(self.integration_base_files, self.tmp_repo_dir + '/') except OSError: # We probably caught an error because files already exist. Ignore pass try: repo = git.Repo(self.tmp_repo_dir) except git.exc.InvalidGitRepositoryError: repo = git.Repo.init(self.tmp_repo_dir) if 'USERNAME' not in os.environ: try: os.environ['USERNAME'] = pwd.getpwuid(os.geteuid()).pw_name except AttributeError: log.error('Unable to get effective username, falling back to ' '\'root\'.') os.environ['USERNAME'] = '******' repo.index.add( [x for x in os.listdir(self.tmp_repo_dir) if x != '.git']) repo.index.commit('Test') gitfs.update()