def test_get_conflicted_files(in_merge_conflict): resolve_conflict() with open('other_file', 'w') as other_file: other_file.write('oh hai') cmd_output('git', 'add', 'other_file') ret = set(git.get_conflicted_files()) assert ret == set(('conflict_file', 'other_file'))
def test_get_conflicted_files(in_merge_conflict): resolve_conflict() with open('other_file', 'w') as other_file: other_file.write('oh hai') cmd_output('git', 'add', 'other_file') ret = set(git.get_conflicted_files()) assert ret == {'conflict_file', 'other_file'}
def test_get_conflicted_files(in_merge_conflict): resolve_conflict() with open("other_file", "w") as other_file: other_file.write("oh hai") cmd_output("git", "add", "other_file") ret = set(git.get_conflicted_files()) assert ret == set(("conflict_file", "other_file"))
def test_get_conflicted_files_unstaged_files(in_merge_conflict): """This case no longer occurs, but it is a useful test nonetheless""" resolve_conflict() # Make unstaged file. with open('bar_only_file', 'w') as bar_only_file: bar_only_file.write('new contents!\n') ret = set(git.get_conflicted_files()) assert ret == {'conflict_file'}
def test_get_conflicted_files_unstaged_files(in_merge_conflict): # If they for whatever reason did pre-commit run --no-stash during a # conflict resolve_conflict() # Make unstaged file. with open('bar_only_file', 'w') as bar_only_file: bar_only_file.write('new contents!\n') ret = set(git.get_conflicted_files()) assert ret == {'conflict_file'}
def test_get_conflicted_files_unstaged_files(in_merge_conflict): # If they for whatever reason did pre-commit run --no-stash during a # conflict resolve_conflict() # Make unstaged file. with open("bar_only_file", "w") as bar_only_file: bar_only_file.write("new contents!\n") ret = set(git.get_conflicted_files()) assert ret == set(("conflict_file",))
def _all_filenames(args: argparse.Namespace) -> Collection[str]: if args.origin and args.source: return git.get_changed_files(args.origin, args.source) elif args.hook_stage in {'prepare-commit-msg', 'commit-msg'}: return (args.commit_msg_filename, ) elif args.files: return args.files elif args.all_files: return git.get_all_files() elif git.is_in_merge_conflict(): return git.get_conflicted_files() else: return git.get_staged_files()
def _all_filenames(args): if args.origin and args.source: return git.get_changed_files(args.origin, args.source) elif args.hook_stage == 'commit-msg': return (args.commit_msg_filename, ) elif args.files: return args.files elif args.all_files: return git.get_all_files() elif git.is_in_merge_conflict(): return git.get_conflicted_files() else: return git.get_staged_files()
def _all_filenames(args): if args.origin and args.source: return git.get_changed_files(args.origin, args.source) elif args.hook_stage in {'prepare-commit-msg', 'commit-msg'}: return (args.commit_msg_filename,) elif args.files: return args.files elif args.all_files: return git.get_all_files() elif git.is_in_merge_conflict(): return git.get_conflicted_files() else: return git.get_staged_files()
def _all_filenames(args: argparse.Namespace) -> Collection[str]: if args.hook_stage == 'post-checkout': # no files for post-checkout return () elif args.hook_stage in {'prepare-commit-msg', 'commit-msg'}: return (args.commit_msg_filename, ) elif args.from_ref and args.to_ref: return git.get_changed_files(args.from_ref, args.to_ref) elif args.files: return args.files elif args.all_files: return git.get_all_files() elif git.is_in_merge_conflict(): return git.get_conflicted_files() else: return git.get_staged_files()
def _all_filenames(args: argparse.Namespace) -> Collection[str]: # these hooks do not operate on files if args.hook_stage in {"post-checkout", "post-commit"}: return () elif args.hook_stage in {"prepare-commit-msg", "commit-msg"}: return (args.commit_msg_filename,) elif args.from_ref and args.to_ref: return git.get_changed_files(args.from_ref, args.to_ref) elif args.files: return args.files elif args.all_files: return git.get_all_files() elif git.is_in_merge_conflict(): return git.get_conflicted_files() else: return git.get_staged_files()
def test_get_conflicted_files_non_ascii(in_merge_conflict): open('интервью', 'a').close() cmd_output('git', 'add', '.') ret = git.get_conflicted_files() assert ret == {'conflict_file', 'интервью'}
def test_get_conflicted_files_in_submodule(in_conflicting_submodule): resolve_conflict() assert set(git.get_conflicted_files()) == {'conflict_file'}
def test_get_conflicted_files_in_submodule(in_conflicting_submodule): resolve_conflict() assert set(git.get_conflicted_files()) == set(('conflict_file',))