aboutsummaryrefslogtreecommitdiffstats
path: root/lib/pama/pama_test.go
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2023-11-24 16:03:10 +0100
committerRobin Jarry <robin@jarry.cc>2023-12-30 15:42:09 +0100
commitf8c9e7fff564667700c3dbc239d55db8fcd032a6 (patch)
tree2fbe2e87ed8e713e119aaadf0f2e317fb01d90fc /lib/pama/pama_test.go
parentcfcab6c5c883a08afa3a56c11e4f48d9725be2a0 (diff)
downloadaerc-f8c9e7fff564667700c3dbc239d55db8fcd032a6.tar.gz
patch: implement worktree support
Implement worktree support for the patch management. Use ":patch apply -w <commit-ish> <tag>" to create a new worktree and apply the selected messages to it. The worktree is linked to repo in the current project. Internally, the worktree is stored as a new project. When this project is deleted with ":patch delete", the underlying linked worktree is removed as well. ":patch list" shows when a project is a worktree and to what project it is linked to. Worktrees enable the users to create a new copy of the repo at a given commit and apply patches without interrupting the current work in the base repo. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'lib/pama/pama_test.go')
-rw-r--r--lib/pama/pama_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/pama/pama_test.go b/lib/pama/pama_test.go
index 7a4d1961..98258249 100644
--- a/lib/pama/pama_test.go
+++ b/lib/pama/pama_test.go
@@ -113,6 +113,14 @@ func (c *mockRevctrl) Remove(commit string) error {
return errNotFound
}
+func (c *mockRevctrl) CreateWorktree(_, _ string) error {
+ return nil
+}
+
+func (c *mockRevctrl) DeleteWorktree(_ string) error {
+ return nil
+}
+
func (c *mockRevctrl) ApplyCmd() string {
return ""
}
@@ -157,6 +165,10 @@ func (s *mockStore) Names() ([]string, error) {
return names, nil
}
+func (s *mockStore) Project(_ string) (models.Project, error) {
+ return models.Project{}, nil
+}
+
func (s *mockStore) Projects() ([]models.Project, error) {
var ps []models.Project
for _, p := range s.data {