Skip to content

Commit

Permalink
Update merge resolvers to honor the new PROJECT placeholders. Ref jar…
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed May 28, 2023
1 parent 21fe6ba commit 8709b5f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
v7.19.0
=======

* Replaced the "skeleton" merge resolver with a "project"
merge resolver, based on the changes planned for
jaraco/skeleton#70.

v7.18.0
=======

Expand Down
16 changes: 11 additions & 5 deletions jaraco/develop/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,16 @@ def replace(self, repl, orig):
return orig.replace(self.match.group(0), repl)


def resolve_skeleton(conflict):
assert 'skeleton' in conflict.right
name = re.search('name = (.*)', Path('setup.cfg').read_text()).group(1)
return conflict.right.replace('skeleton', name)
def resolve_project(conflict):
"""
If the text "PROJECT" appears in the conflict on the right,
assume the whole conflict is about downstream customization
and prefer the downstream (left).
See jaraco/skeleton#70 for more context.
"""
assert 'PROJECT' in conflict.right
return conflict.left


def resolve_shebang(conflict):
Expand All @@ -85,7 +91,7 @@ def resolve_shebang(conflict):


def resolve(conflict):
for resolver in (resolve_skeleton, resolve_shebang):
for resolver in (resolve_project, resolve_shebang):
with contextlib.suppress(Exception):
return resolver(conflict)
raise ValueError("Unable to resolve")
Expand Down

0 comments on commit 8709b5f

Please sign in to comment.