fix gitea.py
This commit is contained in:
6
gitea.py
6
gitea.py
@ -80,15 +80,14 @@ def change_to_gitea(doit, *repos):
|
||||
dirty = True
|
||||
if write_when_new(doit, '.git/hooks/pre-commit', PRE_COMMIT_HOOK):
|
||||
dirty = True
|
||||
if doit:
|
||||
dothis = False
|
||||
try:
|
||||
if parser.get('credential', 'helper') != str(gitdir / hooks / 'get_gitea_token'):
|
||||
dothis = True
|
||||
print('need to change gitea credential helper')
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
dothis = True
|
||||
print('missing gitea credential helper')
|
||||
print('missing gitea credential helper', e)
|
||||
try:
|
||||
if parser.get('remote "origin"', 'url') != GITEA_URL % repo:
|
||||
dothis = True
|
||||
@ -98,6 +97,7 @@ def change_to_gitea(doit, *repos):
|
||||
print('missing remote url')
|
||||
if dothis:
|
||||
dirty = True
|
||||
if doit:
|
||||
os.system(f'git config credential.helper "{os.getcwd()}/.git/hooks/get_gitea_token"')
|
||||
os.system(f'git remote set-url origin {GITEA_URL}')
|
||||
finally:
|
||||
|
@ -19,6 +19,7 @@ from pathlib import Path
|
||||
from subprocess import Popen, PIPE
|
||||
from ipaddress import IPv4Interface
|
||||
from os.path import getmtime
|
||||
from gitea import change_to_gitea
|
||||
|
||||
|
||||
def exit():
|
||||
|
Reference in New Issue
Block a user