@@ -603,6 +603,43 @@ export class RepositoriesStore extends TypedBaseStore<
603603 )
604604 }
605605
606+ /**
607+ * Inherits the GitHub repository association, group name, default branch, workflow preferences, editor override, and login from the old repository
608+ *
609+ * @param newRepo The new repository to update with the old repository's configuration
610+ * @param oldRepo The repository to copy the configuration from
611+ * @returns
612+ */
613+ public async inheritConfiguration (
614+ newRepo : Repository ,
615+ oldRepo : Repository
616+ ) : Promise < Repository > {
617+ await this . db . transaction ( 'rw' , this . db . repositories , ( ) =>
618+ this . db . repositories . update ( newRepo . id , {
619+ gitHubRepositoryID : oldRepo . gitHubRepository ?. dbID ?? null ,
620+ groupName : oldRepo . groupName ,
621+ defaultBranch : oldRepo . defaultBranch ,
622+ workflowPreferences : oldRepo . workflowPreferences ,
623+ customEditorOverride : oldRepo . customEditorOverride ,
624+ } )
625+ )
626+ this . emitUpdatedRepositories ( )
627+
628+ return new Repository (
629+ newRepo . path ,
630+ newRepo . id ,
631+ oldRepo . gitHubRepository ,
632+ newRepo . missing ,
633+ newRepo . alias ,
634+ oldRepo . groupName ,
635+ oldRepo . defaultBranch ,
636+ oldRepo . workflowPreferences ,
637+ oldRepo . customEditorOverride ,
638+ newRepo . isTutorialRepository ,
639+ oldRepo . overrideLogin
640+ )
641+ }
642+
606643 public async setGitHubRepository ( repo : Repository , ghRepo : GitHubRepository ) {
607644 // If nothing has changed we can skip writing to the database and (more
608645 // importantly) avoid telling store consumers that the repo store has
0 commit comments