Jujutsu/git integration

The editor now has a button to commit changes to a Jujutsu repository,
which is automatically created if it's not present.

A git remote is automatically set up using the URL template in
settings.py. I use this with Forgejo's create-on-push feature to
automatically create repositories on my Forgejo instance.
This commit is contained in:
Christian Lawson-Perfect 2025-02-10 10:05:00 +00:00
parent 500eb38774
commit d474a394f5
13 changed files with 913 additions and 376 deletions

View file

@ -223,3 +223,22 @@ class LogView(ThinkMixin, generic.DetailView):
think = self.get_object()
return HttpResponse(think.get_log(), content_type='text/plain; charset=utf-8')
class JJStatusView(ThinkMixin, generic.detail.DetailView):
def get(self, request, *args, **kwargs):
status = self.get_object().jj_controller.status()
return JsonResponse({'status': status})
class JJCommitView(ThinkMixin, generic.UpdateView):
form_class = forms.GitCommitForm
def form_valid(self, form):
message = form.cleaned_data['message']
think = form.instance
jj = think.jj_controller
res = jj.commit(message)
return JsonResponse({'ok': res.returncode == 0, 'think': think.pk, 'stdout': res.stdout, 'stderr': res.stderr})