refactor: rename oil to canola across entire codebase
Problem: the codebase still used the upstream \`oil\` naming everywhere — URL schemes, the \`:Oil\` command, highlight groups, user events, module paths, filetypes, buffer/window variables, LuaCATS type annotations, vimdoc help tags, syntax groups, and internal identifiers. Solution: mechanical rename of every reference. URL schemes now use \`canola://\` (plus \`canola-ssh://\`, \`canola-s3://\`, \`canola-sss://\`, \`canola-trash://\`, \`canola-test://\`). The \`:Canola\` command replaces \`:Oil\`. All highlight groups, user events, augroups, namespaces, filetypes, require paths, type annotations, help tags, and identifiers follow suit. The \`upstream\` remote to \`stevearc/oil.nvim\` has been removed and the \`vim.g.oil\` deprecation shim dropped.
This commit is contained in:
parent
67ad0632a6
commit
e6b42168c9
70 changed files with 1571 additions and 1555 deletions
|
|
@ -1,7 +1,7 @@
|
|||
local cache = require('oil.cache')
|
||||
local constants = require('oil.constants')
|
||||
local mutator = require('oil.mutator')
|
||||
local test_adapter = require('oil.adapters.test')
|
||||
local cache = require('canola.cache')
|
||||
local constants = require('canola.constants')
|
||||
local mutator = require('canola.mutator')
|
||||
local test_adapter = require('canola.adapters.test')
|
||||
local test_util = require('spec.test_util')
|
||||
|
||||
local FIELD_ID = constants.FIELD_ID
|
||||
|
|
@ -15,7 +15,7 @@ describe('mutator', function()
|
|||
|
||||
describe('build actions', function()
|
||||
it('empty diffs produce no actions', function()
|
||||
vim.cmd.edit({ args = { 'oil-test:///foo/' } })
|
||||
vim.cmd.edit({ args = { 'canola-test:///foo/' } })
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local actions = mutator.create_actions_from_diffs({
|
||||
[bufnr] = {},
|
||||
|
|
@ -24,7 +24,7 @@ describe('mutator', function()
|
|||
end)
|
||||
|
||||
it('constructs CREATE actions', function()
|
||||
vim.cmd.edit({ args = { 'oil-test:///foo/' } })
|
||||
vim.cmd.edit({ args = { 'canola-test:///foo/' } })
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local diffs = {
|
||||
{ type = 'new', name = 'a.txt', entry_type = 'file' },
|
||||
|
|
@ -36,14 +36,14 @@ describe('mutator', function()
|
|||
{
|
||||
type = 'create',
|
||||
entry_type = 'file',
|
||||
url = 'oil-test:///foo/a.txt',
|
||||
url = 'canola-test:///foo/a.txt',
|
||||
},
|
||||
}, actions)
|
||||
end)
|
||||
|
||||
it('constructs DELETE actions', function()
|
||||
local file = test_adapter.test_set('/foo/a.txt', 'file')
|
||||
vim.cmd.edit({ args = { 'oil-test:///foo/' } })
|
||||
vim.cmd.edit({ args = { 'canola-test:///foo/' } })
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local diffs = {
|
||||
{ type = 'delete', name = 'a.txt', id = file[FIELD_ID] },
|
||||
|
|
@ -55,14 +55,14 @@ describe('mutator', function()
|
|||
{
|
||||
type = 'delete',
|
||||
entry_type = 'file',
|
||||
url = 'oil-test:///foo/a.txt',
|
||||
url = 'canola-test:///foo/a.txt',
|
||||
},
|
||||
}, actions)
|
||||
end)
|
||||
|
||||
it('constructs COPY actions', function()
|
||||
local file = test_adapter.test_set('/foo/a.txt', 'file')
|
||||
vim.cmd.edit({ args = { 'oil-test:///foo/' } })
|
||||
vim.cmd.edit({ args = { 'canola-test:///foo/' } })
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local diffs = {
|
||||
{ type = 'new', name = 'b.txt', entry_type = 'file', id = file[FIELD_ID] },
|
||||
|
|
@ -74,15 +74,15 @@ describe('mutator', function()
|
|||
{
|
||||
type = 'copy',
|
||||
entry_type = 'file',
|
||||
src_url = 'oil-test:///foo/a.txt',
|
||||
dest_url = 'oil-test:///foo/b.txt',
|
||||
src_url = 'canola-test:///foo/a.txt',
|
||||
dest_url = 'canola-test:///foo/b.txt',
|
||||
},
|
||||
}, actions)
|
||||
end)
|
||||
|
||||
it('constructs MOVE actions', function()
|
||||
local file = test_adapter.test_set('/foo/a.txt', 'file')
|
||||
vim.cmd.edit({ args = { 'oil-test:///foo/' } })
|
||||
vim.cmd.edit({ args = { 'canola-test:///foo/' } })
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local diffs = {
|
||||
{ type = 'delete', name = 'a.txt', id = file[FIELD_ID] },
|
||||
|
|
@ -95,15 +95,15 @@ describe('mutator', function()
|
|||
{
|
||||
type = 'move',
|
||||
entry_type = 'file',
|
||||
src_url = 'oil-test:///foo/a.txt',
|
||||
dest_url = 'oil-test:///foo/b.txt',
|
||||
src_url = 'canola-test:///foo/a.txt',
|
||||
dest_url = 'canola-test:///foo/b.txt',
|
||||
},
|
||||
}, actions)
|
||||
end)
|
||||
|
||||
it('correctly orders MOVE + CREATE', function()
|
||||
local file = test_adapter.test_set('/a.txt', 'file')
|
||||
vim.cmd.edit({ args = { 'oil-test:///' } })
|
||||
vim.cmd.edit({ args = { 'canola-test:///' } })
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local diffs = {
|
||||
{ type = 'delete', name = 'a.txt', id = file[FIELD_ID] },
|
||||
|
|
@ -117,13 +117,13 @@ describe('mutator', function()
|
|||
{
|
||||
type = 'move',
|
||||
entry_type = 'file',
|
||||
src_url = 'oil-test:///a.txt',
|
||||
dest_url = 'oil-test:///b.txt',
|
||||
src_url = 'canola-test:///a.txt',
|
||||
dest_url = 'canola-test:///b.txt',
|
||||
},
|
||||
{
|
||||
type = 'create',
|
||||
entry_type = 'file',
|
||||
url = 'oil-test:///a.txt',
|
||||
url = 'canola-test:///a.txt',
|
||||
},
|
||||
}, actions)
|
||||
end)
|
||||
|
|
@ -131,7 +131,7 @@ describe('mutator', function()
|
|||
it('resolves MOVE loops', function()
|
||||
local afile = test_adapter.test_set('/a.txt', 'file')
|
||||
local bfile = test_adapter.test_set('/b.txt', 'file')
|
||||
vim.cmd.edit({ args = { 'oil-test:///' } })
|
||||
vim.cmd.edit({ args = { 'canola-test:///' } })
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local diffs = {
|
||||
{ type = 'delete', name = 'a.txt', id = afile[FIELD_ID] },
|
||||
|
|
@ -143,25 +143,25 @@ describe('mutator', function()
|
|||
local actions = mutator.create_actions_from_diffs({
|
||||
[bufnr] = diffs,
|
||||
})
|
||||
local tmp_url = 'oil-test:///a.txt__oil_tmp_510852'
|
||||
local tmp_url = 'canola-test:///a.txt__canola_tmp_510852'
|
||||
assert.are.same({
|
||||
{
|
||||
type = 'move',
|
||||
entry_type = 'file',
|
||||
src_url = 'oil-test:///a.txt',
|
||||
src_url = 'canola-test:///a.txt',
|
||||
dest_url = tmp_url,
|
||||
},
|
||||
{
|
||||
type = 'move',
|
||||
entry_type = 'file',
|
||||
src_url = 'oil-test:///b.txt',
|
||||
dest_url = 'oil-test:///a.txt',
|
||||
src_url = 'canola-test:///b.txt',
|
||||
dest_url = 'canola-test:///a.txt',
|
||||
},
|
||||
{
|
||||
type = 'move',
|
||||
entry_type = 'file',
|
||||
src_url = tmp_url,
|
||||
dest_url = 'oil-test:///b.txt',
|
||||
dest_url = 'canola-test:///b.txt',
|
||||
},
|
||||
}, actions)
|
||||
end)
|
||||
|
|
@ -171,11 +171,11 @@ describe('mutator', function()
|
|||
it('Creates files inside dir before move', function()
|
||||
local move = {
|
||||
type = 'move',
|
||||
src_url = 'oil-test:///a',
|
||||
dest_url = 'oil-test:///b',
|
||||
src_url = 'canola-test:///a',
|
||||
dest_url = 'canola-test:///b',
|
||||
entry_type = 'directory',
|
||||
}
|
||||
local create = { type = 'create', url = 'oil-test:///a/hi.txt', entry_type = 'file' }
|
||||
local create = { type = 'create', url = 'canola-test:///a/hi.txt', entry_type = 'file' }
|
||||
local actions = { move, create }
|
||||
local ordered_actions = mutator.enforce_action_order(actions)
|
||||
assert.are.same({ create, move }, ordered_actions)
|
||||
|
|
@ -184,11 +184,11 @@ describe('mutator', function()
|
|||
it('Moves file out of parent before deleting parent', function()
|
||||
local move = {
|
||||
type = 'move',
|
||||
src_url = 'oil-test:///a/b.txt',
|
||||
dest_url = 'oil-test:///b.txt',
|
||||
src_url = 'canola-test:///a/b.txt',
|
||||
dest_url = 'canola-test:///b.txt',
|
||||
entry_type = 'file',
|
||||
}
|
||||
local delete = { type = 'delete', url = 'oil-test:///a', entry_type = 'directory' }
|
||||
local delete = { type = 'delete', url = 'canola-test:///a', entry_type = 'directory' }
|
||||
local actions = { delete, move }
|
||||
local ordered_actions = mutator.enforce_action_order(actions)
|
||||
assert.are.same({ move, delete }, ordered_actions)
|
||||
|
|
@ -197,14 +197,14 @@ describe('mutator', function()
|
|||
it('Handles parent child move ordering', function()
|
||||
local move1 = {
|
||||
type = 'move',
|
||||
src_url = 'oil-test:///a/b',
|
||||
dest_url = 'oil-test:///b',
|
||||
src_url = 'canola-test:///a/b',
|
||||
dest_url = 'canola-test:///b',
|
||||
entry_type = 'directory',
|
||||
}
|
||||
local move2 = {
|
||||
type = 'move',
|
||||
src_url = 'oil-test:///a',
|
||||
dest_url = 'oil-test:///b/a',
|
||||
src_url = 'canola-test:///a',
|
||||
dest_url = 'canola-test:///b/a',
|
||||
entry_type = 'directory',
|
||||
}
|
||||
local actions = { move2, move1 }
|
||||
|
|
@ -215,13 +215,13 @@ describe('mutator', function()
|
|||
it('Handles a delete inside a moved folder', function()
|
||||
local del = {
|
||||
type = 'delete',
|
||||
url = 'oil-test:///a/b.txt',
|
||||
url = 'canola-test:///a/b.txt',
|
||||
entry_type = 'file',
|
||||
}
|
||||
local move = {
|
||||
type = 'move',
|
||||
src_url = 'oil-test:///a',
|
||||
dest_url = 'oil-test:///b',
|
||||
src_url = 'canola-test:///a',
|
||||
dest_url = 'canola-test:///b',
|
||||
entry_type = 'directory',
|
||||
}
|
||||
local actions = { move, del }
|
||||
|
|
@ -232,8 +232,8 @@ describe('mutator', function()
|
|||
it('Detects move directory loops', function()
|
||||
local move = {
|
||||
type = 'move',
|
||||
src_url = 'oil-test:///a',
|
||||
dest_url = 'oil-test:///a/b',
|
||||
src_url = 'canola-test:///a',
|
||||
dest_url = 'canola-test:///a/b',
|
||||
entry_type = 'directory',
|
||||
}
|
||||
assert.has_error(function()
|
||||
|
|
@ -244,8 +244,8 @@ describe('mutator', function()
|
|||
it('Detects copy directory loops', function()
|
||||
local move = {
|
||||
type = 'copy',
|
||||
src_url = 'oil-test:///a',
|
||||
dest_url = 'oil-test:///a/b',
|
||||
src_url = 'canola-test:///a',
|
||||
dest_url = 'canola-test:///a/b',
|
||||
entry_type = 'directory',
|
||||
}
|
||||
assert.has_error(function()
|
||||
|
|
@ -256,8 +256,8 @@ describe('mutator', function()
|
|||
it('Detects nested copy directory loops', function()
|
||||
local move = {
|
||||
type = 'copy',
|
||||
src_url = 'oil-test:///a',
|
||||
dest_url = 'oil-test:///a/b/a',
|
||||
src_url = 'canola-test:///a',
|
||||
dest_url = 'canola-test:///a/b/a',
|
||||
entry_type = 'directory',
|
||||
}
|
||||
assert.has_error(function()
|
||||
|
|
@ -267,10 +267,10 @@ describe('mutator', function()
|
|||
|
||||
describe('change', function()
|
||||
it('applies CHANGE after CREATE', function()
|
||||
local create = { type = 'create', url = 'oil-test:///a/hi.txt', entry_type = 'file' }
|
||||
local create = { type = 'create', url = 'canola-test:///a/hi.txt', entry_type = 'file' }
|
||||
local change = {
|
||||
type = 'change',
|
||||
url = 'oil-test:///a/hi.txt',
|
||||
url = 'canola-test:///a/hi.txt',
|
||||
entry_type = 'file',
|
||||
column = 'TEST',
|
||||
value = 'TEST',
|
||||
|
|
@ -283,13 +283,13 @@ describe('mutator', function()
|
|||
it('applies CHANGE after COPY src', function()
|
||||
local copy = {
|
||||
type = 'copy',
|
||||
src_url = 'oil-test:///a/hi.txt',
|
||||
dest_url = 'oil-test:///b.txt',
|
||||
src_url = 'canola-test:///a/hi.txt',
|
||||
dest_url = 'canola-test:///b.txt',
|
||||
entry_type = 'file',
|
||||
}
|
||||
local change = {
|
||||
type = 'change',
|
||||
url = 'oil-test:///a/hi.txt',
|
||||
url = 'canola-test:///a/hi.txt',
|
||||
entry_type = 'file',
|
||||
column = 'TEST',
|
||||
value = 'TEST',
|
||||
|
|
@ -302,13 +302,13 @@ describe('mutator', function()
|
|||
it('applies CHANGE after COPY dest', function()
|
||||
local copy = {
|
||||
type = 'copy',
|
||||
src_url = 'oil-test:///b.txt',
|
||||
dest_url = 'oil-test:///a/hi.txt',
|
||||
src_url = 'canola-test:///b.txt',
|
||||
dest_url = 'canola-test:///a/hi.txt',
|
||||
entry_type = 'file',
|
||||
}
|
||||
local change = {
|
||||
type = 'change',
|
||||
url = 'oil-test:///a/hi.txt',
|
||||
url = 'canola-test:///a/hi.txt',
|
||||
entry_type = 'file',
|
||||
column = 'TEST',
|
||||
value = 'TEST',
|
||||
|
|
@ -321,13 +321,13 @@ describe('mutator', function()
|
|||
it('applies CHANGE after MOVE dest', function()
|
||||
local move = {
|
||||
type = 'move',
|
||||
src_url = 'oil-test:///b.txt',
|
||||
dest_url = 'oil-test:///a/hi.txt',
|
||||
src_url = 'canola-test:///b.txt',
|
||||
dest_url = 'canola-test:///a/hi.txt',
|
||||
entry_type = 'file',
|
||||
}
|
||||
local change = {
|
||||
type = 'change',
|
||||
url = 'oil-test:///a/hi.txt',
|
||||
url = 'canola-test:///a/hi.txt',
|
||||
entry_type = 'file',
|
||||
column = 'TEST',
|
||||
value = 'TEST',
|
||||
|
|
@ -342,10 +342,10 @@ describe('mutator', function()
|
|||
describe('perform actions', function()
|
||||
it('creates new entries', function()
|
||||
local actions = {
|
||||
{ type = 'create', url = 'oil-test:///a.txt', entry_type = 'file' },
|
||||
{ type = 'create', url = 'canola-test:///a.txt', entry_type = 'file' },
|
||||
}
|
||||
test_util.await(mutator.process_actions, 2, actions)
|
||||
local files = cache.list_url('oil-test:///')
|
||||
local files = cache.list_url('canola-test:///')
|
||||
assert.are.same({
|
||||
['a.txt'] = {
|
||||
[FIELD_ID] = 1,
|
||||
|
|
@ -358,10 +358,10 @@ describe('mutator', function()
|
|||
it('deletes entries', function()
|
||||
local file = test_adapter.test_set('/a.txt', 'file')
|
||||
local actions = {
|
||||
{ type = 'delete', url = 'oil-test:///a.txt', entry_type = 'file' },
|
||||
{ type = 'delete', url = 'canola-test:///a.txt', entry_type = 'file' },
|
||||
}
|
||||
test_util.await(mutator.process_actions, 2, actions)
|
||||
local files = cache.list_url('oil-test:///')
|
||||
local files = cache.list_url('canola-test:///')
|
||||
assert.are.same({}, files)
|
||||
assert.is_nil(cache.get_entry_by_id(file[FIELD_ID]))
|
||||
assert.has_error(function()
|
||||
|
|
@ -374,13 +374,13 @@ describe('mutator', function()
|
|||
local actions = {
|
||||
{
|
||||
type = 'move',
|
||||
src_url = 'oil-test:///a.txt',
|
||||
dest_url = 'oil-test:///b.txt',
|
||||
src_url = 'canola-test:///a.txt',
|
||||
dest_url = 'canola-test:///b.txt',
|
||||
entry_type = 'file',
|
||||
},
|
||||
}
|
||||
test_util.await(mutator.process_actions, 2, actions)
|
||||
local files = cache.list_url('oil-test:///')
|
||||
local files = cache.list_url('canola-test:///')
|
||||
local new_entry = {
|
||||
[FIELD_ID] = file[FIELD_ID],
|
||||
[FIELD_TYPE] = 'file',
|
||||
|
|
@ -390,7 +390,7 @@ describe('mutator', function()
|
|||
['b.txt'] = new_entry,
|
||||
}, files)
|
||||
assert.are.same(new_entry, cache.get_entry_by_id(file[FIELD_ID]))
|
||||
assert.equals('oil-test:///', cache.get_parent_url(file[FIELD_ID]))
|
||||
assert.equals('canola-test:///', cache.get_parent_url(file[FIELD_ID]))
|
||||
end)
|
||||
|
||||
it('copies entries', function()
|
||||
|
|
@ -398,13 +398,13 @@ describe('mutator', function()
|
|||
local actions = {
|
||||
{
|
||||
type = 'copy',
|
||||
src_url = 'oil-test:///a.txt',
|
||||
dest_url = 'oil-test:///b.txt',
|
||||
src_url = 'canola-test:///a.txt',
|
||||
dest_url = 'canola-test:///b.txt',
|
||||
entry_type = 'file',
|
||||
},
|
||||
}
|
||||
test_util.await(mutator.process_actions, 2, actions)
|
||||
local files = cache.list_url('oil-test:///')
|
||||
local files = cache.list_url('canola-test:///')
|
||||
local new_entry = {
|
||||
[FIELD_ID] = file[FIELD_ID] + 1,
|
||||
[FIELD_TYPE] = 'file',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue