fix init_jj; add force argument

This commit is contained in:
Christian Lawson-Perfect 2025-03-18 15:52:52 +00:00
parent fed63118d0
commit d061110d88

View file

@ -26,14 +26,19 @@ class JJController:
)
return res
def init_jj(self):
def init_jj(self, force=False):
print("Init jj")
if not (self.root / '.jj').exists():
res = self.run(['jj','git','remote','list'])
if force or not (self.root / '.jj').exists():
self.run(['jj','git','init'])
self.ignore_paths(['.make.*'])
git_url = settings.GIT_REPO_URL_TEMPLATE.format(name=self.think.slug)
self.run(['jj','git','remote','add','origin', git_url])
def clean_paths(self, paths):
paths = [self.root / p for p in paths]
return [str(p.relative_to(self.root)) for p in paths if p.is_relative_to(self.root)]
@ensure_jj
def ignore_paths(self, paths):
paths = self.clean_paths(paths)