// ĠCopyright Ġ 2 0 0 0 - 2 0 2 0 ĠJetBrains Ġs . r . o . ĠUse Ġof Ġthis Ġsource Ġcode Ġis Ġgoverned Ġby Ġthe ĠApache Ġ 2 . 0 Ġlicense Ġthat Ġcan Ġbe Ġfound Ġin Ġthe ĠLICENSE Ġfile . Ċ package Ġcom . intellij . openapi . vcs . actions Ċ Ċ import Ġcom . intellij . openapi . project . Project Ċ import Ġcom . intellij . openapi . vcs . Abstract V cs Ċ import Ġcom . intellij . openapi . vcs . FilePath Ċ import Ġcom . intellij . openapi . vcs . File Status Ċ import Ġcom . intellij . openapi . vcs . V cs Bundle . message Ċ import Ġcom . intellij . openapi . vcs . changes . Change List Manager Ċ import Ġcom . intellij . openapi . vcs . changes . Local Change List Ċ import Ġcom . intellij . openapi . vfs . Virtual File Ċ import Ġcom . intellij . util . containers . Container Util . intersect s Ċ import Ġcom . intellij . vcs Util . V cs Util . get V cs For Ċ import Ġkotlin . streams . as Sequence Ċ Ċ private Ġfun ĠV cs Context . getRoot s (): ĠSequence < FilePath > Ġ= Ġselected FilePath s Stream . as Sequence () Ċ Ċ private Ġfun ĠV cs Context . get Common V cs (): ĠAbstract V cs ? Ġ{ ĊĠ Ġval Ġproject Ġ= Ġproject Ġ?: Ġreturn Ġnull ĊĠ Ġreturn Ġget Roots (). map NotNull Ġ{ Ġget V cs For ( project , Ġit ) Ġ}. distinct (). single OrNull () Ċ } Ċ Ċ open Ġclass ĠCommon Check in Files Action Ġ: ĠAbstract Common Check in Action () Ġ{ ĊĠ Ġoverride Ġfun Ġget Action Name ( data Context : ĠV cs Context ): ĠString Ġ{ ĊĠĠĠ Ġval Ġaction Name Ġ= Ġdata Context . get Common V cs ()?. check in Environment ?. check in Operation Name ĊĊĠĠĠ Ġreturn Ġappend Subject ( data Context , Ġaction Name Ġ?: Ġmessage (" vcs . command . name . check in ")) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġappend Subject ( data Context : ĠV cs Context , Ġcheck in Action Name : ĠString ): ĠString Ġ{ ĊĠĠĠ Ġval Ġroots Ġ= Ġdata Context . getRoot s (). take ( 2 ). toList () ĊĠĠĠ Ġif Ġ( roots . isEmpty ()) Ġreturn Ġcheck in Action Name ĊĊĠĠĠ Ġif Ġ( roots [ 0 ]. isDirectory ) Ġ{ ĊĠĠĠĠĠ Ġreturn Ġmessage (" action . name . check in . directory ", Ġcheck in Action Name , Ġroots . size ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġelse Ġ{ ĊĠĠĠĠĠ Ġreturn Ġmessage (" action . name . check in . file ", Ġcheck in Action Name , Ġroots . size ) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġget Init ially Selected Change List ( context : ĠV cs Context , Ġproject : ĠProject ): ĠLocal Change List Ġ{ ĊĠĠĠ Ġval Ġmanager Ġ= ĠChange List Manager . getInstance ( project ) ĊĠĠĠ Ġval Ġdefault Change List Ġ= Ġmanager . default Change List ĊĠĠĠ Ġvar Ġresult : ĠLocal Change List ? Ġ= Ġnull ĊĊĠĠĠ Ġfor Ġ( root Ġin Ġget Roots ( context )) Ġ{ ĊĠĠĠĠĠ Ġif Ġ( root . virtual File Ġ== Ġnull ) Ġcontinue ĊĊĠĠĠĠĠ Ġval Ġchanges Ġ= Ġmanager . get Changes In ( root ) ĊĠĠĠĠĠ Ġif Ġ( intersect s ( changes , Ġdefault Change List . changes )) Ġreturn Ġdefault Change List ĊĊĠĠĠĠĠ Ġresult Ġ= Ġchanges . first OrNull ()?. let Ġ{ Ġmanager . get Change List ( it ) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġreturn Ġresult Ġ?: Ġdefault Change List ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġapproximately Has Roots ( data Context : ĠV cs Context ): ĠBoolean Ġ= ĊĠĠĠ Ġdata Context . getRoot s (). any Ġ{ Ġis Applicable Root ( it , Ġdata Context ) Ġ} ĊĊĠ Ġprotected Ġopen Ġfun Ġis Applicable Root ( path : ĠFilePath , Ġdata Context : ĠV cs Context ): ĠBoolean Ġ{ ĊĠĠĠ Ġval Ġstatus Ġ= ĠChange List Manager . getInstance ( data Context . project !! ). getStatus ( path ) ĊĊĠĠĠ Ġ@ Suppress (" DE PREC ATION ") ĊĠĠĠ Ġreturn Ġ( path . isDirectory Ġ|| Ġstatus Ġ!= ĠFile Status . NOT _ CHANGED ) Ġ&& Ġstatus Ġ!= ĠFile Status . IG NO RED ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġget Roots ( data Context : ĠV cs Context ): ĠArray < FilePath > Ġ= Ġdata Context . selected FilePath s ĊĊĠ Ġoverride Ġfun Ġis Force Update Commit State From Context (): ĠBoolean Ġ= Ġtrue Ċ } Ċ