aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/pama/drop.go (renamed from lib/pama/remove.go)14
-rw-r--r--lib/pama/drop_test.go (renamed from lib/pama/remove_test.go)18
-rw-r--r--lib/pama/models/models.go4
-rw-r--r--lib/pama/pama_test.go2
-rw-r--r--lib/pama/revctrl/git.go4
5 files changed, 21 insertions, 21 deletions
diff --git a/lib/pama/remove.go b/lib/pama/drop.go
index d74874a1..595bc87d 100644
--- a/lib/pama/remove.go
+++ b/lib/pama/drop.go
@@ -7,7 +7,7 @@ import (
"git.sr.ht/~rjarry/aerc/log"
)
-func (m PatchManager) RemovePatch(patch string) error {
+func (m PatchManager) DropPatch(patch string) error {
p, err := m.CurrentProject()
if err != nil {
return err
@@ -31,7 +31,7 @@ func (m PatchManager) RemovePatch(patch string) error {
for _, c := range p.Commits {
if !rc.Exists(c.ID) {
log.Errorf("failed to find commit. %v", c)
- return fmt.Errorf("Cannot remove patch. " +
+ return fmt.Errorf("Cannot drop patch. " +
"Please rebase first with ':patch rebase'")
}
if c.Tag == patch {
@@ -44,18 +44,18 @@ func (m PatchManager) RemovePatch(patch string) error {
commitID := toRemove[i].ID
beforeIDs, err := rc.History(commitID)
if err != nil {
- log.Errorf("failed to remove %v (commits before): %v", toRemove[i], err)
+ log.Errorf("failed to drop %v (commits before): %v", toRemove[i], err)
continue
}
- err = rc.Remove(commitID)
+ err = rc.Drop(commitID)
if err != nil {
- log.Errorf("failed to remove %v (remove): %v", toRemove[i], err)
+ log.Errorf("failed to drop %v: %v", toRemove[i], err)
continue
}
removed[commitID] = struct{}{}
afterIDs, err := rc.History(p.Base.ID)
if err != nil {
- log.Errorf("failed to remove %v (commits after): %v", toRemove[i], err)
+ log.Errorf("failed to drop %v (commits after): %v", toRemove[i], err)
continue
}
afterIDs = afterIDs[len(afterIDs)-len(beforeIDs):]
@@ -77,7 +77,7 @@ func (m PatchManager) RemovePatch(patch string) error {
}
if len(removed) < len(toRemove) {
- return fmt.Errorf("Failed to remove commits. Removed %d of %d.",
+ return fmt.Errorf("Failed to drop commits. Dropped %d of %d.",
len(removed), len(toRemove))
}
diff --git a/lib/pama/remove_test.go b/lib/pama/drop_test.go
index c9ce6c65..84bc2864 100644
--- a/lib/pama/remove_test.go
+++ b/lib/pama/drop_test.go
@@ -8,7 +8,7 @@ import (
"git.sr.ht/~rjarry/aerc/lib/pama/models"
)
-func TestPatchmgmt_Remove(t *testing.T) {
+func TestPatchmgmt_Drop(t *testing.T) {
setup := func(p models.Project) (pama.PatchManager, models.RevisionController, models.PersistentStorer) {
return newTestManager(
[]string{"0", "1", "2", "3", "4", "5"},
@@ -19,21 +19,21 @@ func TestPatchmgmt_Remove(t *testing.T) {
tests := []struct {
name string
- remove string
+ drop string
commits []models.Commit
want []models.Commit
}{
{
- name: "remove only patch",
- remove: "patch1",
+ name: "drop only patch",
+ drop: "patch1",
commits: []models.Commit{
newCommit("1", "a", "patch1"),
},
want: []models.Commit{},
},
{
- name: "remove second one of two patch",
- remove: "patch2",
+ name: "drop second one of two patch",
+ drop: "patch2",
commits: []models.Commit{
newCommit("1", "a", "patch1"),
newCommit("2", "b", "patch2"),
@@ -43,8 +43,8 @@ func TestPatchmgmt_Remove(t *testing.T) {
},
},
{
- name: "remove first one of two patch",
- remove: "patch1",
+ name: "drop first one of two patch",
+ drop: "patch1",
commits: []models.Commit{
newCommit("1", "a", "patch1"),
newCommit("2", "b", "patch2"),
@@ -63,7 +63,7 @@ func TestPatchmgmt_Remove(t *testing.T) {
}
mgr, rc, _ := setup(p)
- err := mgr.RemovePatch(test.remove)
+ err := mgr.DropPatch(test.drop)
if err != nil {
t.Errorf("test '%s' failed. %v", test.name, err)
}
diff --git a/lib/pama/models/models.go b/lib/pama/models/models.go
index 9b21f0f5..5d1a9c44 100644
--- a/lib/pama/models/models.go
+++ b/lib/pama/models/models.go
@@ -70,9 +70,9 @@ type RevisionController interface {
Author(string) string
// Date returns the date for the provided commit hash.
Date(string) string
- // Remove removes the commit with the provided commit hash from the
+ // Drop removes the commit with the provided commit hash from the
// repository.
- Remove(string) error
+ Drop(string) error
// ApplyCmd returns a string with an executable command that is used to
// apply patches with the :pipe command.
ApplyCmd() string
diff --git a/lib/pama/pama_test.go b/lib/pama/pama_test.go
index 98258249..e07cbab6 100644
--- a/lib/pama/pama_test.go
+++ b/lib/pama/pama_test.go
@@ -96,7 +96,7 @@ func (c *mockRevctrl) Date(commit string) string {
return ""
}
-func (c *mockRevctrl) Remove(commit string) error {
+func (c *mockRevctrl) Drop(commit string) error {
for i, s := range c.commitIDs {
if s == commit {
c.commitIDs = append(c.commitIDs[:i], c.commitIDs[i+1:]...)
diff --git a/lib/pama/revctrl/git.go b/lib/pama/revctrl/git.go
index 7be9de58..2a35754e 100644
--- a/lib/pama/revctrl/git.go
+++ b/lib/pama/revctrl/git.go
@@ -68,10 +68,10 @@ func (g git) Date(commit string) string {
return s
}
-func (g git) Remove(commit string) error {
+func (g git) Drop(commit string) error {
_, exitcode, err := g.do("rebase", "--onto", commit+"^", commit)
if exitcode > 0 {
- return fmt.Errorf("failed to remove commit %s", commit)
+ return fmt.Errorf("failed to drop commit %s", commit)
}
return err
}