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', 'branch': 'main',
'commit': '20ba079dda7be1a72d64cebc9f55d909bf29f6c1', 'commit': '20ba079dda7be1a72d64cebc9f55d909bf29f6c1',
'env': { 'env': {
'ph_skip_linux': 'skip',
'ph_skip_generated': 'skip', 'ph_skip_generated': 'skip',
'ph_log_level': 'DEBUG', 'ph_log_level': 'DEBUG',
# 'ph_skip_windows': 'skip', 'ph_skip_linux': 'skip',
'ph_linux_agents': '{"queue": "linux-test"}', 'ph_linux_agents': '{"queue": "linux-test"}',
# 'ph_skip_windows': 'skip',
'ph_windows_agents': f'{{"name": "win-dev", "queue": "windows-test"}}', '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) print(d)
if (args.dryrun): if (args.dryrun):
@ -35,4 +37,5 @@ if __name__ == '__main__':
data=d, data=d,
headers={'Authorization': f'Bearer {token}'}) headers={'Authorization': f'Bearer {token}'})
print(re.status_code) 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...') logging.info(f'{path} does not exist, cloning repository...')
git.Repo.clone_from(FORK_REMOTE_URL, path) git.Repo.clone_from(FORK_REMOTE_URL, path)
repo = git.Repo(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) repo.remote('origin').set_url(FORK_REMOTE_URL)
if 'upstream' not in repo.remotes: if 'upstream' not in repo.remotes:
repo.create_remote('upstream', url=LLVM_GITHUB_URL) repo.create_remote('upstream', url=LLVM_GITHUB_URL)

View file

@ -44,7 +44,7 @@ class ApplyPatch:
- If D is not closed, it will download the patch for D and try to apply it locally. - If D is not closed, it will download the patch for D and try to apply it locally.
Once this class has applied all dependencies, it will apply the original diff. Once this class has applied all dependencies, it will apply the original diff.
This script must be called from the root folder of a local checkout of This script must be called from the root folder of a local checkout of
https://github.com/llvm/llvm-project or given a path to clone into. https://github.com/llvm/llvm-project or given a path to clone into.
""" """
@ -156,6 +156,13 @@ class ApplyPatch:
As origin is disjoint from upstream, it needs to be updated by this script. 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...') logging.info('Syncing local, origin and upstream...')
if 'upstream' not in self.repo.remotes: if 'upstream' not in self.repo.remotes:
self.repo.create_remote('upstream', url=LLVM_GITHUB_URL) self.repo.create_remote('upstream', url=LLVM_GITHUB_URL)