mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Implement merge-files only using @bukzor's method.
This commit is contained in:
parent
94d626691f
commit
5810ee4315
5 changed files with 115 additions and 23 deletions
|
|
@ -1,5 +1,7 @@
|
|||
from __future__ import absolute_import
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import pytest
|
||||
import time
|
||||
import yaml
|
||||
|
|
@ -126,3 +128,29 @@ def repo_with_passing_hook(config_for_script_hooks_repo, empty_git_dir):
|
|||
def repo_with_failing_hook(failing_hook_repo, empty_git_dir):
|
||||
_make_repo_from_configs(_make_config(failing_hook_repo, 'failing_hook', ''))
|
||||
yield empty_git_dir
|
||||
|
||||
|
||||
@pytest.yield_fixture
|
||||
def in_merge_conflict(repo_with_passing_hook):
|
||||
local['git']['add', C.CONFIG_FILE]()
|
||||
local['git']['commit', '-m' 'add hooks file']()
|
||||
local['git']['clone', '.', 'foo']()
|
||||
with local.cwd('foo'):
|
||||
local['git']['checkout', 'origin/master', '-b', 'foo']()
|
||||
with open('conflict_file', 'w') as conflict_file:
|
||||
conflict_file.write('herp\nderp\n')
|
||||
local['git']['add', 'conflict_file']()
|
||||
with open('foo_only_file', 'w') as foo_only_file:
|
||||
foo_only_file.write('foo')
|
||||
local['git']['add', 'foo_only_file']()
|
||||
local['git']['commit', '-m', 'conflict_file']()
|
||||
local['git']['checkout', 'origin/master', '-b', 'bar']()
|
||||
with open('conflict_file', 'w') as conflict_file:
|
||||
conflict_file.write('harp\nddrp\n')
|
||||
local['git']['add', 'conflict_file']()
|
||||
with open('bar_only_file', 'w') as bar_only_file:
|
||||
bar_only_file.write('bar')
|
||||
local['git']['add', 'bar_only_file']()
|
||||
local['git']['commit', '-m', 'conflict_file']()
|
||||
local['git']['merge', 'foo'](retcode=None)
|
||||
yield os.path.join(repo_with_passing_hook, 'foo')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue