feat: 多 remote 远程仓库支持 (v0.3.1)\n\n后端:\n- 新增 RemoteList/AddRemote/RemoveRemote 远程仓库管理\n- 所有远程操作(Push/Pull/Fetch/PushTag/DeleteTag/DeleteRemoteBranch等)支持指定 remote\n- 新增 PushTo/PullFrom/FetchRemote/PushTagTo/DeleteRemoteTagFrom 等方法\n- BatchPull/BatchPush 支持 remote 参数\n\n前端:\n- 顶部信息栏新增 remote 选择器下拉菜单\n- 支持切换当前操作的远程仓库\n- 支持添加/删除远程仓库\n- Pull/Push/Fetch/标签推送/远程分支删除等操作均使用选中的 remote
Some checks failed
Release / build-windows (push) Has been cancelled

This commit is contained in:
zyj
2026-03-12 10:57:27 +08:00
parent 3d6874f79e
commit 3ec453cc38
10 changed files with 536 additions and 78 deletions

View File

@@ -53,6 +53,17 @@ export function AddProject(platform, username, name, path) {
return $Call.ByID(2299402672, platform, username, name, path);
}
/**
* AddRemote 添加远程仓库
* @param {string} path
* @param {string} name
* @param {string} url
* @returns {$CancellablePromise<void>}
*/
export function AddRemote(path, name, url) {
return $Call.ByID(3697916441, path, name, url);
}
/**
* AddUser 添加用户到指定平台
* @param {string} platform
@@ -67,10 +78,11 @@ export function AddUser(platform, username, token) {
/**
* BatchPull 批量拉取指定项目
* @param {string[]} paths
* @param {string} remote
* @returns {$CancellablePromise<$models.BatchPullResult[]>}
*/
export function BatchPull(paths) {
return $Call.ByID(758996647, paths).then(/** @type {($result: any) => any} */(($result) => {
export function BatchPull(paths, remote) {
return $Call.ByID(758996647, paths, remote).then(/** @type {($result: any) => any} */(($result) => {
return $$createType1($result);
}));
}
@@ -78,10 +90,11 @@ export function BatchPull(paths) {
/**
* BatchPush 批量推送指定项目
* @param {string[]} paths
* @param {string} remote
* @returns {$CancellablePromise<$models.BatchPullResult[]>}
*/
export function BatchPush(paths) {
return $Call.ByID(794082076, paths).then(/** @type {($result: any) => any} */(($result) => {
export function BatchPush(paths, remote) {
return $Call.ByID(794082076, paths, remote).then(/** @type {($result: any) => any} */(($result) => {
return $$createType1($result);
}));
}
@@ -165,20 +178,22 @@ export function DeleteBranch(path, name, force) {
* DeleteRemoteBranch 删除远程分支
* @param {string} path
* @param {string} branch
* @param {string} remote
* @returns {$CancellablePromise<void>}
*/
export function DeleteRemoteBranch(path, branch) {
return $Call.ByID(2626609049, path, branch);
export function DeleteRemoteBranch(path, branch, remote) {
return $Call.ByID(2626609049, path, branch, remote);
}
/**
* DeleteTag 删除标签(本地+远程)
* @param {string} path
* @param {string} name
* @param {string} remote
* @returns {$CancellablePromise<void>}
*/
export function DeleteTag(path, name) {
return $Call.ByID(873653241, path, name);
export function DeleteTag(path, name, remote) {
return $Call.ByID(873653241, path, name, remote);
}
/**
@@ -192,12 +207,13 @@ export function DiscardFiles(path, files) {
}
/**
* FetchProject 拉取远程信息
* FetchProject 拉取远程信息(指定 remote空则 fetch --all
* @param {string} path
* @param {string} remote
* @returns {$CancellablePromise<string>}
*/
export function FetchProject(path) {
return $Call.ByID(3541106829, path);
export function FetchProject(path, remote) {
return $Call.ByID(3541106829, path, remote);
}
/**
@@ -383,14 +399,26 @@ export function GetProjectTree() {
/**
* GetRemoteBranches 获取远程分支列表
* @param {string} path
* @param {string} remote
* @returns {$CancellablePromise<$models.BranchInfo[]>}
*/
export function GetRemoteBranches(path) {
return $Call.ByID(994796370, path).then(/** @type {($result: any) => any} */(($result) => {
export function GetRemoteBranches(path, remote) {
return $Call.ByID(994796370, path, remote).then(/** @type {($result: any) => any} */(($result) => {
return $$createType8($result);
}));
}
/**
* GetRemotes 获取项目所有远程仓库列表
* @param {string} path
* @returns {$CancellablePromise<$models.RemoteItem[]>}
*/
export function GetRemotes(path) {
return $Call.ByID(975520027, path).then(/** @type {($result: any) => any} */(($result) => {
return $$createType26($result);
}));
}
/**
* GetStashList 获取贮藏列表
* @param {string} path
@@ -398,7 +426,7 @@ export function GetRemoteBranches(path) {
*/
export function GetStashList(path) {
return $Call.ByID(1948257945, path).then(/** @type {($result: any) => any} */(($result) => {
return $$createType26($result);
return $$createType28($result);
}));
}
@@ -409,7 +437,7 @@ export function GetStashList(path) {
*/
export function GetTags(path) {
return $Call.ByID(3979169621, path).then(/** @type {($result: any) => any} */(($result) => {
return $$createType28($result);
return $$createType30($result);
}));
}
@@ -421,7 +449,7 @@ export function GetTags(path) {
*/
export function GetUserInfo(platform, username) {
return $Call.ByID(2674655707, platform, username).then(/** @type {($result: any) => any} */(($result) => {
return $$createType30($result);
return $$createType32($result);
}));
}
@@ -455,31 +483,34 @@ export function MergeBranch(path, branch) {
}
/**
* PullProject 拉取项目(当前分支)
* PullProject 拉取项目(当前分支,指定 remote
* @param {string} path
* @param {string} remote
* @returns {$CancellablePromise<string>}
*/
export function PullProject(path) {
return $Call.ByID(4145813996, path);
export function PullProject(path, remote) {
return $Call.ByID(4145813996, path, remote);
}
/**
* PushProject 推送项目(当前分支)
* PushProject 推送项目(当前分支,指定 remote
* @param {string} path
* @param {string} remote
* @returns {$CancellablePromise<string>}
*/
export function PushProject(path) {
return $Call.ByID(3887901113, path);
export function PushProject(path, remote) {
return $Call.ByID(3887901113, path, remote);
}
/**
* PushTag 推送标签到远程
* @param {string} path
* @param {string} name
* @param {string} remote
* @returns {$CancellablePromise<void>}
*/
export function PushTag(path, name) {
return $Call.ByID(1424810524, path, name);
export function PushTag(path, name, remote) {
return $Call.ByID(1424810524, path, name, remote);
}
/**
@@ -502,6 +533,16 @@ export function RemoveProject(platform, username, name) {
return $Call.ByID(2748109581, platform, username, name);
}
/**
* RemoveRemote 删除远程仓库
* @param {string} path
* @param {string} name
* @returns {$CancellablePromise<void>}
*/
export function RemoveRemote(path, name) {
return $Call.ByID(2915623022, path, name);
}
/**
* RemoveUser 从平台删除用户
* @param {string} platform
@@ -748,9 +789,11 @@ const $$createType21 = $models.ProjectStatus.createFrom;
const $$createType22 = $Create.Nullable($$createType21);
const $$createType23 = $models.TreeNode.createFrom;
const $$createType24 = $Create.Array($$createType23);
const $$createType25 = $models.StashInfo.createFrom;
const $$createType25 = $models.RemoteItem.createFrom;
const $$createType26 = $Create.Array($$createType25);
const $$createType27 = $models.TagInfo.createFrom;
const $$createType27 = $models.StashInfo.createFrom;
const $$createType28 = $Create.Array($$createType27);
const $$createType29 = $models.UserInfo.createFrom;
const $$createType30 = $Create.Nullable($$createType29);
const $$createType29 = $models.TagInfo.createFrom;
const $$createType30 = $Create.Array($$createType29);
const $$createType31 = $models.UserInfo.createFrom;
const $$createType32 = $Create.Nullable($$createType31);

View File

@@ -19,6 +19,7 @@ export {
PlatformInfo,
ProjectOverview,
ProjectStatus,
RemoteItem,
StashInfo,
TagInfo,
TreeNode,

View File

@@ -507,6 +507,20 @@ export class ProjectStatus {
*/
this["remoteUrl"] = "";
}
if (!("remotes" in $$source)) {
/**
* @member
* @type {RemoteItem[]}
*/
this["remotes"] = [];
}
if (!("currentRemote" in $$source)) {
/**
* @member
* @type {string}
*/
this["currentRemote"] = "";
}
if (!("changedFiles" in $$source)) {
/**
* @member
@@ -525,14 +539,56 @@ export class ProjectStatus {
*/
static createFrom($$source = {}) {
const $$createField2_0 = $$createType1;
const $$createField4_0 = $$createType3;
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
if ("remotes" in $$parsedSource) {
$$parsedSource["remotes"] = $$createField2_0($$parsedSource["remotes"]);
}
if ("changedFiles" in $$parsedSource) {
$$parsedSource["changedFiles"] = $$createField2_0($$parsedSource["changedFiles"]);
$$parsedSource["changedFiles"] = $$createField4_0($$parsedSource["changedFiles"]);
}
return new ProjectStatus(/** @type {Partial<ProjectStatus>} */($$parsedSource));
}
}
/**
* RemoteItem 远程仓库信息
*/
export class RemoteItem {
/**
* Creates a new RemoteItem instance.
* @param {Partial<RemoteItem>} [$$source = {}] - The source object to create the RemoteItem.
*/
constructor($$source = {}) {
if (!("name" in $$source)) {
/**
* @member
* @type {string}
*/
this["name"] = "";
}
if (!("url" in $$source)) {
/**
* @member
* @type {string}
*/
this["url"] = "";
}
Object.assign(this, $$source);
}
/**
* Creates a new RemoteItem instance from a string or object.
* @param {any} [$$source = {}]
* @returns {RemoteItem}
*/
static createFrom($$source = {}) {
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
return new RemoteItem(/** @type {Partial<RemoteItem>} */($$parsedSource));
}
}
/**
* StashInfo 贮藏信息
*/
@@ -692,7 +748,7 @@ export class TreeNode {
* @returns {TreeNode}
*/
static createFrom($$source = {}) {
const $$createField4_0 = $$createType3;
const $$createField4_0 = $$createType5;
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
if ("children" in $$parsedSource) {
$$parsedSource["children"] = $$createField4_0($$parsedSource["children"]);
@@ -740,7 +796,9 @@ export class UserInfo {
}
// Private type creation functions
const $$createType0 = FileInfo.createFrom;
const $$createType0 = RemoteItem.createFrom;
const $$createType1 = $Create.Array($$createType0);
const $$createType2 = TreeNode.createFrom;
const $$createType2 = FileInfo.createFrom;
const $$createType3 = $Create.Array($$createType2);
const $$createType4 = TreeNode.createFrom;
const $$createType5 = $Create.Array($$createType4);