diff options
-rw-r--r-- | commands/patch/drop.go (renamed from commands/patch/remove.go) | 18 | ||||
-rw-r--r-- | config/binds.conf | 2 | ||||
-rw-r--r-- | doc/aerc-patch.7.scd | 12 | ||||
-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.go | 4 | ||||
-rw-r--r-- | lib/pama/pama_test.go | 2 | ||||
-rw-r--r-- | lib/pama/revctrl/git.go | 4 |
8 files changed, 37 insertions, 37 deletions
diff --git a/commands/patch/remove.go b/commands/patch/drop.go index 29849e51..06457c72 100644 --- a/commands/patch/remove.go +++ b/commands/patch/drop.go @@ -10,23 +10,23 @@ import ( "git.sr.ht/~rjarry/aerc/log" ) -type Remove struct { +type Drop struct { Tag string `opt:"tag" complete:"CompleteTag"` } func init() { - register(Remove{}) + register(Drop{}) } -func (Remove) Context() commands.CommandContext { +func (Drop) Context() commands.CommandContext { return commands.GLOBAL } -func (Remove) Aliases() []string { - return []string{"remove"} +func (Drop) Aliases() []string { + return []string{"drop"} } -func (*Remove) CompleteTag(arg string) []string { +func (*Drop) CompleteTag(arg string) []string { patches, err := pama.New().CurrentPatches() if err != nil { log.Errorf("failed to get current patches: %v", err) @@ -35,13 +35,13 @@ func (*Remove) CompleteTag(arg string) []string { return commands.FilterList(patches, arg, nil) } -func (r Remove) Execute(args []string) error { +func (r Drop) Execute(args []string) error { patch := r.Tag - err := pama.New().RemovePatch(patch) + err := pama.New().DropPatch(patch) if err != nil { return err } - app.PushStatus(fmt.Sprintf("Patch %s has been removed", patch), + app.PushStatus(fmt.Sprintf("Patch %s has been dropped", patch), 10*time.Second) return nil } diff --git a/config/binds.conf b/config/binds.conf index 2247a9d5..4c2efa47 100644 --- a/config/binds.conf +++ b/config/binds.conf @@ -81,7 +81,7 @@ S = :vsplit<Enter> pl = :patch list<Enter> pa = :patch apply <Tab> -pr = :patch remove <Tab> +pd = :patch drop <Tab> pb = :patch rebase<Enter> pt = :patch term<Enter> ps = :patch switch <Tab> diff --git a/doc/aerc-patch.7.scd b/doc/aerc-patch.7.scd index 7b5579a6..3196031a 100644 --- a/doc/aerc-patch.7.scd +++ b/doc/aerc-patch.7.scd @@ -13,7 +13,7 @@ be challenging. With the local patch management system, *aerc* facilitates this bookkeeping process. When applying a patch set, *aerc* creates a tag for those commits. With this -tag, the patch set can be tracked and later removed if needed. Patches are +tag, the patch set can be tracked and later dropped if needed. Patches are stored in a project data structure which also keeps track of the directory where the repository is. Multiple code bases can be tracked by defining a separate project for each. @@ -68,8 +68,8 @@ The following *:patch* sub-commands are supported: :patch apply -w origin/master fix_v2 ``` -*:patch remove* _<tag>_ - Removes the patch _<tag>_ from the repository. +*:patch drop* _<tag>_ + Drops the patch _<tag>_ from the repository. *:patch rebase* [_<commit-ish>_] Rebases the patch data on commit _<commit-ish>_. @@ -152,7 +152,7 @@ series and apply it: This will apply the selected patch set and assigns the _fix_v2_ tag to those commits. The tag helps to keep the commits grouped together, and will be helpful -when we want to remove this exact patch set at a later point. +when we want to drop this exact patch set at a later point. With *:patch list* you can verify that the patch set was correctly applied. @@ -169,10 +169,10 @@ This will open an editor where you can adjust the correct tags again. You could also change the rebase point by providing an optional argument (e.g. a commit hash, or even _HEAD~3_ or _origin/master_, etc.). -To remove a patch set, use the tag that was assigned during applying: +To drop a patch set, use the tag that was assigned during applying: ``` -:patch remove fix_v2 +:patch drop fix_v2 ``` And to delete the project data in *aerc*: 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 } |