Skip to content

Commit f258539

Browse files
committed
Preserve existing repo branches in dev build mode
When a repo already exists, just pull latest changes on current branch instead of forcing checkout to develop. This allows using feature branches during development installations.
1 parent daf163a commit f258539

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

scripts/RunUpdate.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,17 @@ def updatepyenv(self, dev_build):
234234
os.path.join(script_dir, '../base_packages/requirements_wwpdb_dependencies.txt'))
235235
with open(path_to_list_of_repo) as list_of_repo:
236236
for repo in list_of_repo:
237-
command = 'git clone --recursive git@github.com:wwPDB/{0}.git; cd {0}; git checkout develop; cd ..'.format(
238-
repo.rstrip())
237+
repo_name = repo.rstrip()
238+
repo_path = os.path.join(source_dir, repo_name)
239+
if os.path.isdir(repo_path):
240+
# Repo already exists - just pull latest changes on current branch
241+
print("Repository {} already exists, pulling latest changes".format(repo_name))
242+
command = 'cd {0}; git pull'.format(repo_name)
243+
else:
244+
# Clone new repo and checkout develop
245+
command = 'git clone --recursive git@github.com:wwPDB/{0}.git; cd {0}; git checkout develop'.format(repo_name)
239246
self.__exec(command, working_directory=source_dir)
240-
command = 'pip install {} --edit {}'.format(pip_extra_urls, repo)
247+
command = 'pip install {} --edit {}'.format(pip_extra_urls, repo_name)
241248
self.__exec(command, working_directory=source_dir)
242249
else:
243250
command = 'pip install -U {} -r {}'.format(pip_extra_urls, reqfile)

0 commit comments

Comments
 (0)