Skip to content

Commit

Permalink
Add special handler to handle the rename conflict. Ref jaraco/skeleto…
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Jun 21, 2023
1 parent 5fe0fe8 commit 4cd9613
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions jaraco/develop/update-projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import contextlib
import subprocess
import functools
import shutil

import path
import autocommand
Expand All @@ -34,6 +35,15 @@ def is_skeleton():
return 'badge/skeleton' in path.Path('README.rst').read_text()


def handle_rename(old_name, new_name):
status = subprocess.check_output(['git', 'status', '--porcelain'], text=True)
if f'UD {old_name}' not in status:
return
shutil.copyfile(old_name, new_name)
subprocess.check_call(['git', 'rm', old_name])
subprocess.check_call(['git', 'add', new_name])


def update_project(name, base):
if set(name.tags) & {'fork', 'base'}:
return
Expand All @@ -44,6 +54,7 @@ def update_project(name, base):
proc = subprocess.Popen(['git', 'pull', base, '--no-edit'])
code = proc.wait()
if code:
handle_rename('CHANGES.rst', 'NEWS.rst')
try:
subprocess.check_call(['git', 'mergetool', '-t', 'known-merge'])
except subprocess.CalledProcessError:
Expand Down

0 comments on commit 4cd9613

Please sign in to comment.