// ĠCopyright Ġ 2 0 0 0 - 2 0 1 9 Ġ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 . vcs . commit Ċ Ċ import Ġcom . intellij . openapi . diagnostic . logger Ċ import Ġcom . intellij . openapi . project . Project Ċ import Ġcom . intellij . openapi . vcs . Abstract V cs Ċ import Ġcom . intellij . openapi . vcs . V cs Bundle . message Ċ import Ġcom . intellij . openapi . vcs . changes .* Ċ import Ġcom . intellij . openapi . vcs . changes . ui . Commit Change List Dialog . DIALOG _ TITLE Ċ import Ġcom . intellij . openapi . vcs . check in . Check in Change List Specific Component Ċ import Ġcom . intellij . openapi . vcs . check in . Check in Handler Ċ import Ġcom . intellij . openapi . vcs . impl . Partial Changes Util Ċ import Ġcom . intellij . util . ui . UI Util . remove Mnemonic Ċ import Ġcom . intellij . vcs . commit . Single Change List Commit ter . Companion . moveTo Failed List Ċ Ċ private Ġval ĠLOG Ġ= Ġlogger < Single Change List Commit Workflow >() Ċ Ċ internal Ġval ĠCommit Options . change List Specific Options : ĠSequence < Check in Change List Specific Component > ĊĠ Ġget () Ġ= Ġall Options . filter Is Instance < Check in Change List Specific Component >() Ċ Ċ internal Ġfun ĠCommit Options . change List Changed ( change List : ĠLocal Change List ) Ġ= Ġchange List Specific Options . forEach Ġ{ ĊĠ Ġit . onChange List Selected ( change List ) Ċ } Ċ Ċ internal Ġfun ĠCommit Options . save Change List Specific Options () Ġ= Ġchange List Specific Options . forEach Ġ{ Ġit . save State () Ġ} Ċ Ċ internal Ġfun Ġremove El lipsis Suffix ( s : ĠString ) Ġ= Ġs . remove Suffix (" ... "). remove Suffix ("\ u 2 0 2 6 ") Ċ internal Ġfun ĠCommit Executor . get Present able Text () Ġ= Ġremove El lipsis Suffix ( remove Mnemonic ( action Text )) Ċ Ċ open Ġclass ĠSingle Change List Commit Workflow ( ĊĠ Ġproject : ĠProject , ĊĠ Ġval Ġinitially Included : ĠCollection <* >, ĊĠ Ġval Ġinitial Change List : ĠLocal Change List ? Ġ= Ġnull , ĊĠ Ġexec utors : ĠList < Commit Executor > Ġ= Ġempty List (), ĊĠ Ġfinal Ġoverride Ġval Ġis Default Commit Enabled : ĠBoolean Ġ= Ġexec utors . isEmpty (), ĊĠ Ġval Ġv cs To Commit : ĠAbstract V cs < *> ? Ġ= Ġnull , ĊĠ Ġaffected Vc ses : ĠSet < Abstract V cs <* >> Ġ= Ġif Ġ( vcs To Commit Ġ!= Ġnull ) Ġset Of ( vcs To Commit ) Ġelse Ġempty Set (), ĊĠ Ġprivate Ġval Ġis Default Change List Fully Included : ĠBoolean Ġ= Ġtrue , ĊĠ Ġval Ġinitial Commit Message : ĠString ? Ġ= Ġnull , ĊĠ Ġprivate Ġval Ġresult Handler : ĠCommit Result Handler ? Ġ= Ġnull Ċ ) Ġ: ĠAbstract Commit Workflow ( project ) Ġ{ ĊĊĠ Ġinit Ġ{ ĊĠĠĠ Ġupdate Vc ses ( affected Vc ses ) ĊĠĠĠ Ġinit Commit Executors ( exec utors ) ĊĠ Ġ} ĊĊĠ Ġval Ġis Partial Commit Enabled : ĠBoolean Ġ= ĊĠĠĠ Ġvc ses . any Ġ{ Ġit . are Partial Change lists Supported () Ġ} Ġ&& Ġ( is Default Commit Enabled Ġ|| Ġcommit Executors . any Ġ{ Ġit . supports Partial Commit () Ġ}) ĊĊĠ Ġval Ġcommit Message Policy : ĠSingle Change List Commit Message Policy Ġ= ĠSingle Change List Commit Message Policy ( project , Ġinitial Commit Message ) ĊĊĠ Ġinternal Ġlateinit Ġvar Ġcommit State : ĠChange List Commit State ĊĊĠ Ġoverride Ġfun Ġprocess Execute Default Checks Result ( result : ĠCheck in Handler . Return Result ) Ġ= Ġwhen Ġ( result ) Ġ{ ĊĠĠĠ ĠCheck in Handler . Return Result . COMMIT Ġ-> ĠDefault Name Change List Clean er ( project , Ġcommit State ). use Ġ{ Ġdo Commit ( commit State ) Ġ} ĊĠĠĠ ĠCheck in Handler . Return Result . CLOSE _ WINDOW Ġ-> ĊĠĠĠĠĠ Ġmove To Failed List ( project , Ġcommit State , Ġmessage (" commit . dialog . rejected . commit . template ", Ġcommit State . change List . name )) ĊĠĠĠ ĠCheck in Handler . Return Result . CANCEL Ġ-> ĠUnit ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġexecute Custom ( executor : ĠCommit Executor , Ġsession : ĠCommit Session ) Ġ= ĊĠĠĠ Ġexecute Custom ( executor , Ġsession , Ġcommit State . changes , Ġcommit State . commit Message ) ĊĊĠ Ġoverride Ġfun Ġprocess Execute Custom Checks Result ( executor : ĠCommit Executor , Ġsession : ĠCommit Session , Ġresult : ĠCheck in Handler . Return Result ) Ġ= ĊĠĠĠ Ġwhen Ġ( result ) Ġ{ ĊĠĠĠĠĠ ĠCheck in Handler . Return Result . COMMIT Ġ-> Ġdo Commit Custom ( executor , Ġsession ) ĊĠĠĠĠĠ ĠCheck in Handler . Return Result . CLOSE _ WINDOW Ġ-> ĊĠĠĠĠĠĠĠ Ġmove To Failed List ( project , Ġcommit State , Ġmessage (" commit . dialog . rejected . commit . template ", Ġcommit State . change List . name )) ĊĠĠĠĠĠ ĠCheck in Handler . Return Result . CANCEL Ġ-> ĠUnit ĊĠĠĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġdo Run Before Commit Checks ( checks : ĠRunnable ) Ġ= ĊĠĠĠ ĠPartial Changes Util . run Under Change List ( project , Ġcommit State . change List , Ġchecks ) ĊĊĠ Ġprotected Ġopen Ġfun Ġdo Commit ( commit State : ĠChange List Commit State ) Ġ{ ĊĠĠĠ ĠLOG . debug (" Do Ġactual Ġcommit ") ĊĊĠĠĠ Ġwith ( Single Change List Commit ter ( project , Ġcommit State , Ġcommit Context , Ġv cs To Commit , ĠDIALOG _ TITLE , Ġis Default Change List Fully Included )) Ġ{ ĊĠĠĠĠĠ Ġadd Result Handler ( Commit Handlers Notifier ( commit Handlers )) ĊĠĠĠĠĠ Ġadd Result Handler ( get Commit EventDispatcher ()) ĊĠĠĠĠĠ Ġadd Result Handler ( result Handler Ġ?: ĠShow Notification Commit Result Handler ( this )) ĊĊĠĠĠĠĠ Ġrun Commit ( DIALOG _ TITLE , Ġfalse ) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġdo Commit Custom ( executor : ĠCommit Executor , Ġsession : ĠCommit Session ) Ġ{ ĊĠĠĠ Ġval Ġcleaner Ġ= ĠDefault Name Change List Clean er ( project , Ġcommit State ) ĊĊĠĠĠ Ġwith ( Custom Commit ter ( project , Ġsession , Ġcommit State . changes , Ġcommit State . commit Message )) Ġ{ ĊĠĠĠĠĠ Ġadd Result Handler ( Commit Handlers Notifier ( commit Handlers )) ĊĠĠĠĠĠ Ġadd Result Handler ( Commit Result Handler Ġ{ Ġcleaner . clean () Ġ}) ĊĠĠĠĠĠ Ġadd Result Handler ( get Commit Custom EventDispatcher ()) ĊĠĠĠĠĠ Ġresult Handler ?. let Ġ{ Ġadd Result Handler ( it ) Ġ} ĊĊĠĠĠĠĠ Ġrun Commit ( executor . action Text ) ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ } Ċ Ċ private Ġclass ĠDefault Name Change List Clean er ( val Ġproject : ĠProject , Ġcommit State : ĠChange List Commit State ) Ġ{ ĊĠ Ġprivate Ġval Ġis Change List Fully Included Ġ= Ġcommit State . change List . changes . size Ġ== Ġcommit State . changes . size ĊĠ Ġprivate Ġval Ġis Default Name Change List Ġ= Ġcommit State . change List . has Default Name () ĊĊĠ Ġfun Ġuse ( block : Ġ() Ġ-> ĠUnit ) Ġ{ ĊĠĠĠ Ġblock () ĊĠĠĠ Ġclean () ĊĠ Ġ} ĊĊĠ Ġfun Ġclean () Ġ{ ĊĠĠĠ Ġif Ġ( is Default Name Change List Ġ&& Ġis Change List Fully Included ) Ġ{ ĊĠĠĠĠĠ ĠChange List Manager . getInstance ( project ). edit Comment ( Local Change List . DEFAULT _ NAME , Ġ"") ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ }