mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 19:11:25 +01:00
feat(repo): add repo unarchive and repo rename, and report archive and delete
repo unarchive restores an archived repository, and repo rename renames one, moving the Git remote or the saved default repository that selected it to the new name. The archived-repository hint now points to tea repo unarchive. repo archive asks "Archive alice/x? It becomes read-only." and warns "! alice/x is already archived" without a request when there is nothing to do. Archive, unarchive, rename and delete confirm with a ✓ line on a terminal, and --json returns the repository. Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
6 files changed
+327
-46
No files matched your search
@@ -18,8 +18,10 @@ func TestRepositoryCommandsAcceptPositionalRepository(t *testing.T) {
|
||||
requests = append(requests, r.Method+" "+r.URL.Path)
|
||||
if r.Method == http.MethodPatch {
|
||||
requirePayload(t, `{"archived":true}`, r.Body)
|
||||
_, _ = w.Write([]byte(`{"full_name":"bob/tool","archived":true}`))
|
||||
return
|
||||
}
|
||||
_, _ = w.Write([]byte(`{"full_name":"bob/tool","archived":true}`))
|
||||
_, _ = w.Write([]byte(`{"full_name":"bob/tool"}`))
|
||||
}))
|
||||
defer server.Close()
|
||||
for _, test := range []struct {
|
||||
@@ -36,7 +38,7 @@ func TestRepositoryCommandsAcceptPositionalRepository(t *testing.T) {
|
||||
deps, out, _ := testDeps(t)
|
||||
deps.Getenv = serverEnv(server.URL, map[string]string{"TEA_REPO": "alice/project"})
|
||||
require.NoError(t, Execute(context.Background(), deps, append(test.args, "--no-input", "--json=full_name")))
|
||||
require.Equal(t, []string{test.want}, requests)
|
||||
require.Equal(t, test.want, requests[len(requests)-1])
|
||||
require.JSONEq(t, `{"full_name":"bob/tool"}`, out.String())
|
||||
})
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user