@@ -219,11 +219,7 @@ export function extractPullRequestNumbersForCommit(commit: CommitContext): numbe
219219 return [ ...new Set ( prNumbers ) ] ;
220220}
221221
222- /**
223- * Strip revert-N- prefixes from a branch name and count nesting depth.
224- * e.g. "revert-572-revert-571-romain/bac-39" → { depth: 2, inner: "romain/bac-39" }
225- */
226- export function parseRevertBranch ( branchName : string ) : { depth : number ; inner : string } {
222+ function parseRevertBranch ( branchName : string ) : { depth : number ; inner : string } {
227223 // Full refs can have org/ prefixes (e.g. "org/revert-571-..."), strip to the revert pattern.
228224 // Non-greedy so we stop at the first revert-N- match, not the last (preserves nested depth).
229225 let name = branchName . replace ( / ^ .* ?\/ (? = r e v e r t - \d + - ) / i, "" ) ;
@@ -235,16 +231,16 @@ export function parseRevertBranch(branchName: string): { depth: number; inner: s
235231 return { depth, inner : name } ;
236232}
237233
234+ /**
235+ * Strip revert-N- prefixes from a branch name and count nesting depth.
236+ * e.g. "revert-572-revert-571-romain/bac-39" → { depth: 2, inner: "romain/bac-39" }
237+ */
238238export function getRevertBranchDepth ( branchName : string | null | undefined ) : number {
239239 if ( ! branchName ) return 0 ;
240240 return parseRevertBranch ( branchName ) . depth ;
241241}
242242
243- /**
244- * Unwrap Revert "..." layers from a commit message and count nesting depth.
245- * e.g. 'Revert "Revert "DRIVE-320: Fix""' → { depth: 2, inner: "DRIVE-320: Fix" }
246- */
247- export function parseRevertMessage ( message : string ) : { depth : number ; inner : string } {
243+ function parseRevertMessage ( message : string ) : { depth : number ; inner : string } {
248244 let text = message ;
249245 let depth = 0 ;
250246 while ( / ^ R e v e r t " / i. test ( text ) ) {
@@ -256,6 +252,10 @@ export function parseRevertMessage(message: string): { depth: number; inner: str
256252 return { depth, inner : text } ;
257253}
258254
255+ /**
256+ * Unwrap Revert "..." layers from a commit message and count nesting depth.
257+ * e.g. 'Revert "Revert "DRIVE-320: Fix""' → { depth: 2, inner: "DRIVE-320: Fix" }
258+ */
259259export function getRevertMessageDepth ( message : string | null | undefined ) : number {
260260 if ( ! message ) return 0 ;
261261 return parseRevertMessage ( message ) . depth ;
0 commit comments