Refactoring (part 2): Rename SCMAbstractPackageModel>>workingCopy to temporaryWorkingCopy
"{ Package: 'stx:libscm/mercurial' }"
SCMAbstractPackageModelRegistry subclass:#HGPackageModelRegistry
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'SCM-Mercurial-StX'
!
!HGPackageModelRegistry methodsFor:'accessing'!
packageNamed:package
"Returns a HGPackageModel for given package."
| dir repo |
packages at: package ifPresent: [ :pkg | ^ pkg ].
wcs at: package ifPresent:[ :wc | ^ wc ].
dir := Smalltalk getPackageDirectoryForPackage: package.
dir := HGRepository discover: dir.
dir isNil ifTrue:[
HGError raiseErrorString: 'No repository found for package ',package.
^nil.
].
repo := repositories at: dir ifAbsentPut: [ HGRepository on: dir ].
^packages at: package ifAbsentPut: [ HGPackageModel new name: package repository: repo ].
"Created: / 14-11-2012 / 00:15:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 16-11-2012 / 19:52:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!HGPackageModelRegistry methodsFor:'initialization'!
flush: pattern
"Flushes all cached data packages matching given name."
| toFlush |
toFlush := OrderedCollection new.
packages valuesDo:[:package|
(package name matches: pattern) ifTrue:[toFlush add: package]].
toFlush do:[:package|
| wcdir |
repositories removeKey: package repository path ifAbsent:[nil].
wcdir := package temporaryWorkingCopy path.
[ wcdir recursiveRemove ] on: Error do:[
OperatingSystem isMSWINDOWSlike ifTrue:[
Delay waitForSeconds: 1.
wcdir recursiveRemove.
].
].
packages removeKey: package name
].
"Created: / 16-11-2012 / 19:40:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 22-11-2012 / 16:03:07 / jv"
"Modified: / 01-12-2012 / 00:32:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!HGPackageModelRegistry class methodsFor:'documentation'!
version_HG
^ '$Changeset: <not expanded> $'
!
version_SVN
^ '§Id:: §'
! !