package Ġcom . lo vel ys ystem s . gradle Ċ Ċ import Ġorg . junit . rules . Temporary Folder Ċ import Ġjava . io . File Ċ Ċ fun ĠLS Git . create Version ed File ( ĊĠĠĠĠĠĠĠ Ġname : ĠString , Ġcommit : ĠBoolean Ġ= Ġtrue , Ġtag : ĠString Ġ= Ġ"", ĊĠĠĠĠĠĠĠ Ġcontent : ĠString ? Ġ= Ġnull Ċ ) Ġ{ ĊĠĠĠ ĠFile ("${ dir . absolute Path }/ $ name "). print Writer (). use Ġ{ Ġout Ġ-> ĊĠĠĠĠĠĠĠ Ġout . print ( content Ġ?: Ġ" content Ġof Ġ$ name ") ĊĠĠĠ Ġ} ĊĠĠĠ Ġgit Cmd (" add ", Ġname ) ĊĠĠĠ Ġif Ġ( commit ) Ġ{ ĊĠĠĠĠĠĠĠ Ġgit Cmd (" commit ", Ġ"- m ", Ġ"' added Ġ$ name '") ĊĠĠĠ Ġ} ĊĠĠĠ Ġif Ġ( tag . isNotEmpty ()) Ġ{ ĊĠĠĠĠĠĠĠ Ġgit Cmd (" tag ", Ġtag ) ĊĠĠĠ Ġ} Ċ } Ċ Ċ fun Ġcreate Sample Repos ( tmp : ĠTemporary Folder ): ĠPair < LS Git , ĠLS Git > Ġ{ ĊĠĠĠ Ġval Ġupstream Path Ġ= Ġtmp . new Folder (" upstream ") ĊĠĠĠ Ġval Ġdownstream Path Ġ= Ġtmp . new Folder (" down stream ") ĊĊĠĠĠ Ġval Ġupstream Ġ= ĠLS Git ( upstream Path ) ĊĠĠĠ Ġupstream . git Cmd (" init ") ĊĠĠĠ Ġupstream . git Cmd (" config ", Ġ" receive . deny Current Branch ", Ġ" warn ") ĊĠĠĠ Ġupstream . create Version ed File (" CHANG ES . md ", Ġcontent Ġ= Ġreleased Log [" md "]) ĊĠĠĠ Ġupstream . git Cmd (" tag ", Ġ"- a ", Ġ" 0 . 0 . 1 ", Ġ"- m ", Ġ" release Ġtag Ġfrom Ġupstream ") ĊĠĠĠ Ġupstream . create Version ed File (". gitignore ", Ġcontent Ġ= Ġ". gradle \ n ") ĊĊĠĠĠ Ġval Ġdownstream Ġ= ĠLS Git ( down stream Path ) ĊĠĠĠ Ġdownstream . git Cmd (" clone ", Ġ"${ upstream Path . absolute Path }/. git ", Ġ"./ ") ĊĊĠĠĠ Ġreturn ĠPair ( upstream , Ġdownstream ) Ċ }