@@ -153,64 +153,3 @@ export async function createBranchMentionsFromData(
153153
154154 return mentions . filter ( isDefined )
155155}
156-
157- /**
158- * Parses a query string to extract repository name, branch, and path components.
159- * Supports formats like:
160- * - "repo" -> { repoName: "repo" }
161- * - "repo:" -> { repoName: "repo", showBranches: true }
162- * - "repo:@" -> { repoName: "repo", branchSearch: true }
163- * - "repo:@branch" -> { repoName: "repo", branch: "branch" }
164- * - "repo:@branch:path" -> { repoName: "repo", branch: "branch", path: "path" }
165- * - "repo:path" -> { repoName: "repo", path: "path" }
166- */
167- export interface ParsedQuery {
168- repoName : string
169- showBranches ?: boolean
170- branchSearch ?: boolean
171- branch ?: string
172- path ?: string
173- }
174-
175- export function parseRemoteQuery ( query : string ) : ParsedQuery | null {
176- if ( ! query || ! query . includes ( ':' ) ) {
177- return query ? { repoName : query . trim ( ) } : null
178- }
179-
180- const parts = query . split ( ':' )
181- const repoName = parts [ 0 ] ?. trim ( )
182-
183- if ( ! repoName ) {
184- return null
185- }
186-
187- // If just "repo:", show branches
188- if ( parts . length === 2 && ! parts [ 1 ] ?. trim ( ) ) {
189- return { repoName, showBranches : true }
190- }
191-
192- const secondPart = parts [ 1 ] ?. trim ( ) ?? ''
193-
194- // Handle branch selection: "repo:@" or "repo:@branch"
195- if ( secondPart . startsWith ( '@' ) ) {
196- const branchQuery = secondPart . substring ( 1 ) // Remove @
197-
198- // If just "repo:@", show branch search
199- if ( ! branchQuery ) {
200- return { repoName, branchSearch : true }
201- }
202-
203- // If "repo:@branch" with no path part, return branch
204- if ( parts . length === 2 ) {
205- return { repoName, branch : branchQuery }
206- }
207-
208- // If "repo:@branch:path", return branch and path
209- const path = parts . slice ( 2 ) . join ( ':' ) . trim ( )
210- return { repoName, branch : branchQuery , path }
211- }
212-
213- // Default case: "repo:path"
214- const path = parts . slice ( 1 ) . join ( ':' ) . trim ( )
215- return { repoName, path }
216- }
0 commit comments