def test_identify_git_parent(): with TemporaryDirectory() as td: td = Path(td) (td / '.git').mkdir() subdir = (td / 'subdir') subdir.mkdir() with cwd(subdir): assert vcs.identify_vcs(Path('.')).name == 'git'
def find_tracked_files(self): vcs_mod = identify_vcs(self.srcdir) untracked_deleted = vcs_mod.list_untracked_deleted_files(self.srcdir) if list(filter(include_path, untracked_deleted)): raise VCSError( "Untracked or deleted files in the source directory. " "Commit, undo or ignore these files in your VCS.", self.srcdir) files = vcs_mod.list_tracked_files(self.srcdir) log.info("Found %d files tracked in %s", len(files), vcs_mod.name) return sorted(filter(include_path, files))
def select_files(self): vcs_mod = identify_vcs(self.cfgdir) if vcs_mod is not None: untracked_deleted = vcs_mod.list_untracked_deleted_files(self.cfgdir) if any(include_path(p) and not self.excludes.match_file(p) for p in untracked_deleted): raise VCSError( "Untracked or deleted files in the source directory. " "Commit, undo or ignore these files in your VCS.", self.cfgdir) files = [os.path.normpath(p) for p in vcs_mod.list_tracked_files(self.cfgdir)] files = sorted(filter(include_path, files)) log.info("Found %d files tracked in %s", len(files), vcs_mod.name) else: files = super().select_files() return files