1
0
Fork 0

remove index.lock just in case

This commit is contained in:
Mikhail Goncharov 2022-12-09 11:01:16 +01:00
parent edd0c10f10
commit f96092cfb1
3 changed files with 22 additions and 5 deletions

View file

@ -14,13 +14,15 @@ if __name__ == '__main__':
'branch': 'main',
'commit': '20ba079dda7be1a72d64cebc9f55d909bf29f6c1',
'env': {
'ph_skip_linux': 'skip',
'ph_skip_generated': 'skip',
'ph_log_level': 'DEBUG',
# 'ph_skip_windows': 'skip',
'ph_skip_linux': 'skip',
'ph_linux_agents': '{"queue": "linux-test"}',
# 'ph_skip_windows': 'skip',
'ph_windows_agents': f'{{"name": "win-dev", "queue": "windows-test"}}',
'ph_scripts_refspec': 'windows-vscmd',
# 'ph_windows_agents': f'{{"queue": "windows"}}',
# 'ph_scripts_refspec': 'windows-vscmd',
'ph_projects': 'clang',
}})
print(d)
if (args.dryrun):
@ -35,4 +37,5 @@ if __name__ == '__main__':
data=d,
headers={'Authorization': f'Bearer {token}'})
print(re.status_code)
print(re)
j = re.json()
print(j['web_url'])

View file

@ -25,6 +25,13 @@ def initLlvmFork(path: str) -> git.Repo:
logging.info(f'{path} does not exist, cloning repository...')
git.Repo.clone_from(FORK_REMOTE_URL, path)
repo = git.Repo(path)
# Remove index lock just in case.
lock_file = f"{repo.working_tree_dir}/.git/index.lock"
try:
os.remove(lock_file)
logging.info(f"removed {lock_file}")
except FileNotFoundError:
logging.info(f"{lock_file} does not exist")
repo.remote('origin').set_url(FORK_REMOTE_URL)
if 'upstream' not in repo.remotes:
repo.create_remote('upstream', url=LLVM_GITHUB_URL)

View file

@ -156,6 +156,13 @@ class ApplyPatch:
As origin is disjoint from upstream, it needs to be updated by this script.
"""
# Remove index lock just in case.
lock_file = f"{self.repo.working_tree_dir}/.git/index.lock"
try:
os.remove(lock_file)
logging.info(f"removed {lock_file}")
except FileNotFoundError:
logging.info(f"{lock_file} does not exist")
logging.info('Syncing local, origin and upstream...')
if 'upstream' not in self.repo.remotes:
self.repo.create_remote('upstream', url=LLVM_GITHUB_URL)