mirror of
https://gitea.com/gitea/tea.git
synced 2025-09-01 09:28:30 +02:00
tea branches list/protect/unprotect (#645)
Hello, This is a proposal to support consulting / protecting / unprotecting branches for a specific repository. I copied the existing code for "issues" report and adapted to branches. There is no change of legacy code so I do not expect any impact. Supported commands are "list", "protect", "unprotect": - "List" print the list of branches with some available fields from gitea.Branch type. - "protect" creates a gitea.BranchProtection with some default parameters for some specific branches - "unprotect" destroys gitea.BranchProtection for some specific branches What is printed now could be enriched with additional information gitea datatypes already offer. Could you please evaluate this proposal? I would be happy to receive any comment or remark to take into account. **tea branches unprotect** --login opsi --repo opensky main **tea branches list** --login opsi --repo opensky --fields name,protected,user-can-merge,user-can-push,protection [name protected user-can-merge user-can-push protection] +--------+-----------+----------------+---------------+------------+ | NAME | PROTECTED | USER-CAN-MERGE | USER-CAN-PUSH | PROTECTION | +--------+-----------+----------------+---------------+------------+ | b_test | false | true | true | <None> | | main | false | true | true | <None> | +--------+-----------+----------------+---------------+------------+ **tea branches protect** --login opsi --repo opensky main **tea branches list** --login opsi --repo opensky --fields name,protected,user-can-merge,user-can-push,protection [name protected user-can-merge user-can-push protection] +--------+-----------+----------------+---------------+----------------------+ | NAME | PROTECTED | USER-CAN-MERGE | USER-CAN-PUSH | PROTECTION | +--------+-----------+----------------+---------------+----------------------+ | b_test | false | true | true | <None> | | main | true | true | false | - enable-push: false | | | | | | - approving: - | | | | | | merging: - pushing: | | | | | | | +--------+-----------+----------------+---------------+----------------------+ Following commands run OK: > make test > make fmt > make lint Co-authored-by: Leonard Vimond <leonard.vimond.e@thalesdigital.io> Co-authored-by: techknowlogick <techknowlogick@noreply.gitea.com> Reviewed-on: https://gitea.com/gitea/tea/pulls/645 Reviewed-by: techknowlogick <techknowlogick@noreply.gitea.com> Co-authored-by: leonard.vimond <leonard.vimond@noreply.gitea.com> Co-committed-by: leonard.vimond <leonard.vimond@noreply.gitea.com>
This commit is contained in:

committed by
techknowlogick

parent
22370698bf
commit
20479663f0
82
docs/CLI.md
82
docs/CLI.md
@ -1119,6 +1119,88 @@ Migrate a repository
|
||||
|
||||
**--wiki**: Copy the wiki
|
||||
|
||||
## branches, branch, b
|
||||
|
||||
Consult branches
|
||||
|
||||
**--comments**: Whether to display comments (will prompt if not provided & run interactively)
|
||||
|
||||
**--fields, -f**="": Comma-separated list of fields to print. Available values:
|
||||
name,protected,user-can-merge,user-can-push,protection
|
||||
(default: name,protected,user-can-merge,user-can-push)
|
||||
|
||||
**--limit, --lm**="": specify limit of items per page
|
||||
|
||||
**--login, -l**="": Use a different Gitea Login. Optional
|
||||
|
||||
**--output, -o**="": Output format. (simple, table, csv, tsv, yaml, json)
|
||||
|
||||
**--page, -p**="": specify page, default is 1
|
||||
|
||||
**--remote, -R**="": Discover Gitea login from remote. Optional
|
||||
|
||||
**--repo, -r**="": Override local repository path or gitea repository slug to interact with. Optional
|
||||
|
||||
### list, ls
|
||||
|
||||
List branches of the repository
|
||||
|
||||
**--fields, -f**="": Comma-separated list of fields to print. Available values:
|
||||
name,protected,user-can-merge,user-can-push,protection
|
||||
(default: name,protected,user-can-merge,user-can-push)
|
||||
|
||||
**--limit, --lm**="": specify limit of items per page
|
||||
|
||||
**--login, -l**="": Use a different Gitea Login. Optional
|
||||
|
||||
**--output, -o**="": Output format. (simple, table, csv, tsv, yaml, json)
|
||||
|
||||
**--page, -p**="": specify page, default is 1
|
||||
|
||||
**--remote, -R**="": Discover Gitea login from remote. Optional
|
||||
|
||||
**--repo, -r**="": Override local repository path or gitea repository slug to interact with. Optional
|
||||
|
||||
### protect, P
|
||||
|
||||
Protect branches
|
||||
|
||||
**--fields, -f**="": Comma-separated list of fields to print. Available values:
|
||||
name,protected,user-can-merge,user-can-push,protection
|
||||
(default: name,protected,user-can-merge,user-can-push)
|
||||
|
||||
**--limit, --lm**="": specify limit of items per page
|
||||
|
||||
**--login, -l**="": Use a different Gitea Login. Optional
|
||||
|
||||
**--output, -o**="": Output format. (simple, table, csv, tsv, yaml, json)
|
||||
|
||||
**--page, -p**="": specify page, default is 1
|
||||
|
||||
**--remote, -R**="": Discover Gitea login from remote. Optional
|
||||
|
||||
**--repo, -r**="": Override local repository path or gitea repository slug to interact with. Optional
|
||||
|
||||
### unprotect, U
|
||||
|
||||
Unprotect branches
|
||||
|
||||
**--fields, -f**="": Comma-separated list of fields to print. Available values:
|
||||
name,protected,user-can-merge,user-can-push,protection
|
||||
(default: name,protected,user-can-merge,user-can-push)
|
||||
|
||||
**--limit, --lm**="": specify limit of items per page
|
||||
|
||||
**--login, -l**="": Use a different Gitea Login. Optional
|
||||
|
||||
**--output, -o**="": Output format. (simple, table, csv, tsv, yaml, json)
|
||||
|
||||
**--page, -p**="": specify page, default is 1
|
||||
|
||||
**--remote, -R**="": Discover Gitea login from remote. Optional
|
||||
|
||||
**--repo, -r**="": Override local repository path or gitea repository slug to interact with. Optional
|
||||
|
||||
## comment, c
|
||||
|
||||
Add a comment to an issue / pr
|
||||
|
Reference in New Issue
Block a user