fix(git): merge branch rename route into branches/{name}, tidy imports
ZhenYi committed
Modified lib/git/src/routes.rs lib/git/src/routes.rs +13 −17 View lib/git/src/routes.rs
@@ -1,5 +1,3 @@
1use axum::routing::{delete, get, patch, post, put};
2use axum::{Extension, Router};
31use crate::handler::analysis::code_activity::code_activity;
42use crate::handler::analysis::contributors::contributors;
53use crate::handler::analysis::languages::languages;
@@ -46,16 +44,17 @@
4644use crate::handler::graphql::graphql_get;
4745use crate::handler::graphql::graphql_post;
4846use crate::handler::hooks::execute_script::execute_script;
49use crate::handler::logs::commits_between::log_commits_between;
50use crate::handler::logs::graph::log_graph;
51use crate::handler::logs::last_commit::log_last_commit as log_last;
52use crate::handler::logs::list::log_list as log_list_handler;
5347use crate::handler::lfs::cleanup_unreferenced::cleanup_unreferenced;
5448use crate::handler::lfs::list_locks::list_locks;
5549use crate::handler::lfs::lock::lock;
5650use crate::handler::lfs::unlock::unlock;
5751use crate::handler::lfs::unlock_by_id::unlock_by_id;
5852use crate::handler::lfs::verify_locks::verify_locks;
53use crate::handler::licenses::{get_license, list_licenses, upsert_license};
54use crate::handler::logs::commits_between::log_commits_between;
55use crate::handler::logs::graph::log_graph;
56use crate::handler::logs::last_commit::log_last_commit as log_last;
57use crate::handler::logs::list::log_list as log_list_handler;
5958use crate::handler::maintenance::fsck::fsck;
6059use crate::handler::maintenance::prune::prune;
6160use crate::handler::packs::ingest::ingest as pack_ingest;
@@ -89,6 +88,7 @@
8988use crate::handler::repos::update::update_repo as repo_update;
9089use crate::handler::signatures::verify_commit::verify_commit;
9190use crate::handler::signatures::verify_tag::verify_tag;
91use crate::handler::stars::{is_starred, list_stargazers, star_repo, unstar_repo};
9292use crate::handler::submodules::list::submodule_list as submodules_list;
9393use crate::handler::submodules::resolve::submodule_resolve as submodules_resolve;
9494use crate::handler::tags::create::create_tag as tag_create;
@@ -96,23 +96,23 @@
9696use crate::handler::tags::get::get_tag as tag_get;
9797use crate::handler::tags::list::list_tags as tag_list;
9898use crate::handler::tags::verify::verify_tag as tag_verify;
99use crate::handler::topics::{
100 add_topic_to_repo, create_topic, get_topic, list_repo_topics, list_repos_by_topic, list_topics,
101 remove_topic_from_repo,
102};
99103use crate::handler::trees::follow::tree_follow;
100104use crate::handler::trees::last_updated::tree_last_updated;
101105use crate::handler::trees::read::tree_read;
102106use crate::handler::trees::resolve_path::tree_resolve_path;
103107use crate::handler::trees::walk::tree_walk;
104use crate::handler::licenses::{get_license, list_licenses, upsert_license};
105use crate::handler::stars::{is_starred, list_stargazers, star_repo, unstar_repo};
106use crate::handler::topics::{
107 add_topic_to_repo, create_topic, get_topic, list_repo_topics, list_repos_by_topic, list_topics,
108 remove_topic_from_repo,
109};
110108use crate::handler::watches::{get_watch_mode, list_watchers, unwatch, upsert_watch};
111109use crate::handler::whitelists::{
112110 add_branch_whitelist, add_tag_whitelist, list_branch_whitelists, list_tag_whitelists,
113111 remove_branch_whitelist, remove_tag_whitelist,
114112};
115113use crate::service::GitService;
114use axum::routing::{delete, get, post, put};
115use axum::{Extension, Router};
116116
117117pub fn router(service: GitService) -> Router<GitService> {
118118 let schema = crate::graphql::build_schema(service.state.clone());
@@ -135,11 +135,7 @@
135135 .route("/{space_name}/{repo_name}/branches", get(branch_list).post(branch_create))
136136 .route(
137137 "/{space_name}/{repo_name}/branches/{name}",
138 get(branch_get).delete(branch_delete),
139 )
140 .route(
141 "/{space_name}/{repo_name}/branches/{from}",
142 patch(branch_rename),
138 get(branch_get).delete(branch_delete).patch(branch_rename),
143139 )
144140 .route(
145141 "/{space_name}/{repo_name}/branches/{name}/default",