@@ -608,31 +608,29 @@ export class PatchSeries {
608
608
const midMatch = mails [ 0 ] . match ( / \n M e s s a g e - I D : < ( .* ) > / i) ;
609
609
let coverMid = midMatch ? midMatch [ 1 ] : undefined ;
610
610
611
- if ( this . metadata . pullRequestURL ) {
612
- if ( ! coverMid ) {
613
- throw new Error ( "Could not extract cover letter Message-ID" ) ;
614
- }
615
- const mid = coverMid ;
616
-
617
- const tsMatch = coverMid . match ( / c o v e r \. ( [ 0 - 9 ] + ) \. / ) ;
618
- const timeStamp = tsMatch ? tsMatch [ 1 ] : `${ Date . now ( ) } ` ;
619
- const emailMatch = thisAuthor . match ( / < ( .* ) > / ) ;
620
- if ( ! emailMatch ) {
621
- throw new Error ( `Could not parse email of '${ thisAuthor } ` ) ;
622
- }
623
- const email = emailMatch [ 1 ] ;
624
-
625
- const prMatch = this . metadata . pullRequestURL . match ( / \/ ( [ ^ / ] + ) \/ ( [ ^ / ] + ) \/ p u l l \/ ( \d + ) $ / ) ;
626
- if ( prMatch ) {
627
- const infix = this . metadata . iteration > 1 ? `.v${ this . metadata . iteration } ` : "" ;
628
- const repoInfix = prMatch [ 1 ] === this . config . repo . owner ? prMatch [ 2 ] : `${ prMatch [ 1 ] } .${ prMatch [ 2 ] } ` ;
629
- const newCoverMid = `pull.${ prMatch [ 3 ] } ${ infix } .${ repoInfix } .${ timeStamp } .${ email } ` ;
630
- mails . map ( ( value : string , index : number ) : void => {
631
- // cheap replace-all
632
- mails [ index ] = value . split ( mid ) . join ( newCoverMid ) ;
633
- } ) ;
634
- coverMid = newCoverMid ;
635
- }
611
+ if ( ! coverMid ) {
612
+ throw new Error ( "Could not extract cover letter Message-ID" ) ;
613
+ }
614
+ const originalCoverMid = coverMid ;
615
+
616
+ const tsMatch = coverMid . match ( / c o v e r \. ( [ 0 - 9 ] + ) \. / ) ;
617
+ const timeStamp = tsMatch ? tsMatch [ 1 ] : `${ Date . now ( ) } ` ;
618
+ const emailMatch = thisAuthor . match ( / < ( .* ) > / ) ;
619
+ if ( ! emailMatch ) {
620
+ throw new Error ( `Could not parse email of '${ thisAuthor } ` ) ;
621
+ }
622
+ const email = emailMatch [ 1 ] ;
623
+
624
+ const prMatch = this . metadata . pullRequestURL . match ( / \/ ( [ ^ / ] + ) \/ ( [ ^ / ] + ) \/ p u l l \/ ( \d + ) $ / ) ;
625
+ if ( prMatch ) {
626
+ const infix = this . metadata . iteration > 1 ? `.v${ this . metadata . iteration } ` : "" ;
627
+ const repoInfix = prMatch [ 1 ] === this . config . repo . owner ? prMatch [ 2 ] : `${ prMatch [ 1 ] } .${ prMatch [ 2 ] } ` ;
628
+ const newCoverMid = `pull.${ prMatch [ 3 ] } ${ infix } .${ repoInfix } .${ timeStamp } .${ email } ` ;
629
+ mails . map ( ( value : string , index : number ) : void => {
630
+ // cheap replace-all
631
+ mails [ index ] = value . split ( originalCoverMid ) . join ( newCoverMid ) ;
632
+ } ) ;
633
+ coverMid = newCoverMid ;
636
634
}
637
635
this . metadata . coverLetterMessageId = coverMid ;
638
636
@@ -643,15 +641,10 @@ export class PatchSeries {
643
641
this . project . midUrlPrefix ,
644
642
this . metadata . referencesMessageIds ,
645
643
) ;
646
- let tagName : string | undefined ;
647
- if ( ! this . metadata . pullRequestURL ) {
648
- tagName = `${ this . project . headCommit } -v${ this . metadata . iteration } ` ;
649
- } else {
650
- const prKey = getPullRequestKeyFromURL ( this . metadata . pullRequestURL ) ;
651
- const branch = this . metadata . headLabel . replace ( / : / g, "/" ) ;
652
- const tagPrefix = prKey . owner === this . config . repo . owner ? "pr-" : `pr-${ prKey . owner } -` ;
653
- tagName = `${ tagPrefix } ${ prKey . pull_number } /${ branch } -v${ this . metadata . iteration } ` ;
654
- }
644
+ const prKey = getPullRequestKeyFromURL ( this . metadata . pullRequestURL ) ;
645
+ const branch = this . metadata . headLabel . replace ( / : / g, "/" ) ;
646
+ const tagPrefix = prKey . owner === this . config . repo . owner ? "pr-" : `pr-${ prKey . owner } -` ;
647
+ const tagName = `${ tagPrefix } ${ prKey . pull_number } /${ branch } -v${ this . metadata . iteration } ` ;
655
648
656
649
this . metadata . latestTag = tagName ;
657
650
@@ -794,7 +787,7 @@ export class PatchSeries {
794
787
firstPatchLine,
795
788
} as IMailMetadata ;
796
789
await this . notes . set ( mid , mailMeta , true ) ;
797
- if ( globalOptions && originalCommit && this . metadata . pullRequestURL ) {
790
+ if ( globalOptions && originalCommit ) {
798
791
if ( ! globalOptions . activeMessageIDs ) {
799
792
globalOptions . activeMessageIDs = { } ;
800
793
}
@@ -807,7 +800,7 @@ export class PatchSeries {
807
800
}
808
801
}
809
802
810
- if ( globalOptions && this . metadata . pullRequestURL ) {
803
+ if ( globalOptions ) {
811
804
if ( ! globalOptions . openPRs ) {
812
805
globalOptions . openPRs = { } ;
813
806
}
@@ -816,7 +809,7 @@ export class PatchSeries {
816
809
}
817
810
818
811
if ( ! this . options . dryRun ) {
819
- const key = this . metadata . pullRequestURL || this . project . headCommit ;
812
+ const key = this . metadata . pullRequestURL ;
820
813
await this . notes . set ( key , this . metadata , true ) ;
821
814
}
822
815
0 commit comments