--- a/PerforceSourceCodeManager.st Tue Apr 19 13:54:02 2011 +0200
+++ b/PerforceSourceCodeManager.st Tue Apr 19 14:16:22 2011 +0200
@@ -21,7 +21,7 @@
Object subclass:#WorkSpaceDefinition
instanceVariableNames:'client host localDir owner repositoryDir root workSpaceName
- workSpaceDefinitionFilename'
+ workSpaceDefinitionFilename moduleName'
classVariableNames:''
poolDictionaries:''
privateIn:PerforceSourceCodeManager
@@ -529,7 +529,7 @@
instead, the code is checked in as given (Dangerous).
Return true if ok, false if not."
- |tempdir cmd checkoutName logMsg locRevision newestRevision binRevision modulePath newVersionString
+ |tempdir cmd checkoutName logMsg locRevision newestRevision binRevision newVersionString
workspaceDefinitionFile workSpaceName result checkInDefinition workSpaceDefinition depotRoot|
cls isPrivate ifTrue:[
@@ -567,8 +567,7 @@
tempdir notNil ifTrue:[
[
- modulePath := checkInDefinition modulePath.
- checkoutName := checkInDefinition checkoutName.
+ checkoutName := checkInDefinition classFileName.
workSpaceDefinition := self createWorkspaceFor:checkInDefinition.
workSpaceDefinition isNil ifTrue:[
@@ -828,7 +827,7 @@
Attention: if state = 'dead' that revision is no longer valid.
"
- |fullName modulePath inStream atEnd line inHeaderInfo workSpaceDefinition
+ |fullName inStream atEnd line inHeaderInfo workSpaceDefinition
info record revisionRecords headerOnly msg revArg inDirectory infoAndLogString elements newestRevision foundView|
@@ -843,42 +842,28 @@
]
].
workSpaceDefinition := self getWorkSpaceForModule:moduleName.
-self halt.
- moduleName notNil ifTrue:[
- moduleDir := Smalltalk packageDirectoryForPackageId:moduleName.
+
+ workSpaceDefinition isNil ifTrue:[
+ self error:('Perforce cant get workspace definition for module ', moduleName, '.').
+ ^ nil.
].
- modulePath := moduleDir pathName , '/' , packageDir.
- fullName := modulePath , '/' , classFileName.
-
headerOnly ifTrue:[
msg := 'fetching revision info '
] ifFalse:[
msg := 'reading revision log '
].
+ foundView := workSpaceDefinition getDepotPackageDirDorModule:packageDir classFileName:classFileName.
+
clsOrNil isNil ifTrue:[
- msg := msg , 'in ' , fullName.
+ msg := msg , 'in ' , foundView.
] ifFalse:[
msg := msg , 'of ', clsOrNil name.
].
self activityNotification:msg,'...'.
- workSpaceDefinition isNil ifTrue:[
- self error:('Perforce cant get workspace definition for module ', moduleName, '.').
- ^ nil.
- ].
- foundView := workSpaceDefinition at:#repositoryDir.
- workSpaceDefinition isNil ifTrue:[
- self error:('Perforce cant get repository path for module ', moduleName, '.').
- ^ nil.
- ].
- (foundView endsWith:'...') ifTrue:[
- foundView := foundView copyTo:(foundView size - 3).
- ].
- foundView := foundView , fullName.
-
cmd := ('filelog ' , foundView).
- inDirectory := (Filename currentDirectory asAbsoluteFilename construct:modulePath) pathName.
+ inDirectory := (Filename currentDirectory asAbsoluteFilename) pathName.
inStream := self executePerforceCommand:cmd
module:moduleName
inDirectory:inDirectory
@@ -915,7 +900,7 @@
].
info isEmpty ifTrue:[
- ('PerforceSourceCodeManager [warning]: no log for ', fullName) errorPrintCR.
+ ('PerforceSourceCodeManager [warning]: no log for ', foundView) errorPrintCR.
^ nil
].
@@ -1381,6 +1366,7 @@
('PerforceSourceCodeManager [error]: cannot open find my view in perforce client ') errorPrintCR.
^ nil
].
+ workSpaceDefinition moduleName:aModule.
workSpaceDefinition localDir:foundDir.
workSpaceDefinition repositoryDir:foundView.
^ workSpaceDefinition.
@@ -2324,6 +2310,14 @@
localDir := something.
!
+moduleName
+ ^ moduleName
+!
+
+moduleName:something
+ moduleName := something.
+!
+
owner
^ owner
!
@@ -2364,10 +2358,39 @@
workSpaceName := something.
! !
+!PerforceSourceCodeManager::WorkSpaceDefinition methodsFor:'queries'!
+
+getDepotPackageDirDorModule:modulePath classFileName:classFileName
+
+ |foundView localDirComponents localComponentsModulIndex|
+
+ foundView := self repositoryDir.
+ (foundView endsWith:'...') ifTrue:[
+ foundView := foundView copyTo:(foundView size - 3).
+ ].
+ localDirComponents := localDir components.
+ localComponentsModulIndex := localDirComponents findLast:[:aComponent| aComponent = moduleName].
+ localComponentsModulIndex = 0 ifTrue:[
+ ^ nil
+ ].
+ localDirComponents from:localComponentsModulIndex to:localDirComponents size do:[:aComponent|
+ aComponent ~= '...' ifTrue:[
+ foundView := foundView, '/', aComponent.
+ ].
+ ].
+ modulePath notNil ifTrue:[
+ foundView := foundView, '/', modulePath.
+ ].
+ classFileName notNil ifTrue:[
+ foundView := foundView, '/', classFileName.
+ ].
+ ^foundView
+! !
+
!PerforceSourceCodeManager class methodsFor:'documentation'!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic3/PerforceSourceCodeManager.st,v 1.7 2011-04-19 11:54:02 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic3/PerforceSourceCodeManager.st,v 1.8 2011-04-19 12:16:22 cg Exp $'
! !
PerforceSourceCodeManager initialize!