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

@ -3,6 +3,8 @@ from django.db import models
from django.urls import reverse
from django.utils.timezone import datetime, make_aware
from .jujutsu import JJController
THINKS_DIR = settings.THINKS_DIR
# Create your models here.
@ -21,6 +23,13 @@ class Think(models.Model):
def root(self):
return (THINKS_DIR / self.slug).resolve()
@property
def jj_controller(self):
return JJController(self)
def has_jj(self):
return (self.root / '.jj').exists()
def get_absolute_url(self):
return reverse('think', kwargs={'slug': self.slug})