Rework and fix HGSourceCodeManager >> #revisionLogOf:...directory:module:`
This commit changes the logic in two ways:
1. #newestRevision is now the newest revision in the branch that
*contains* given file (not necesarily modidfes it). If there are
multiple heads in that branch, pretty much random one is returned.
This changes old behavior and therefore this commit updates
tests.
2. If a specific single revision is requested, i.e., both from and to revisions
are the same, revision log with that single revision is returned
no matter whether it modifies the file or even contains that file
at all. This is essentially a workaround to fix issue #305.
Moreover, this commit simplifies the code a lot by delegating all the
changeset searching and filtering to mercurial using revset expressions.
See https://swing.fit.cvut.cz/projects/stx-jv/ticket/305#comment:3
"{ Package: 'stx:libscm/git' }"
GitStructure subclass:#GitStringArray
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'SCM-Git-Core-Internal-Structures'
!
!GitStringArray class methodsFor:'documentation'!
documentation
"
A git_strarray wrapper. GitStringArray is for internal usage only.
Do not use it your code
[author:]
Jan Vrany <jan.vrany@fit.cvut.cz>
[instance variables:]
[class variables:]
[see also:]
"
! !
!GitStringArray class methodsFor:'accessing'!
libraryName
OperatingSystem isUNIXlike ifTrue:[^'libgit2.so'].
OperatingSystem isMSWINDOWSlike ifTrue:[^'git2.dll'].
self error:'Library name for host OS is not known'
!
structSize
"Returns size of undelaying structure in bytes"
^8
! !
!GitStringArray methodsFor:'accessing'!
collect: aBlock
| strings newCollection |
"Reimplemented for speed"
strings := self strings.
newCollection := Array new: self count.
1 to: self count do:[:index|
| val |
val := aBlock value: (strings pointerAt: ((index - 1) * ExternalBytes sizeofPointer) + 1) copyCStringFromHeap.
newCollection at: index put: val.
].
^newCollection
"Created: / 30-09-2012 / 20:32:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
do: aBlock
| strings |
"Reimplemented for speed"
strings := self strings.
1 to: self count do:[:index|
aBlock value: (strings pointerAt: ((index - 1) * ExternalBytes sizeofPointer) + 1) copyCStringFromHeap
]
"Created: / 30-09-2012 / 20:13:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GitStringArray methodsFor:'accessing-private'!
count
"Returns a Cface::CLongNode"
^self longAt:1 + 4
"Modified: / 30-09-2012 / 20:23:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
count: value
self longLongAt:1 + 4 put:value
!
strings
"Returns (pointer-to (pointer-to char))"
^ExternalBytes
address:(self longAt:1 + 0)
size:(self count * ExternalBytes sizeofPointer)
"Modified: / 30-09-2012 / 20:32:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
strings: value
self pointerAt:1 + 0 put:value
! !
!GitStringArray methodsFor:'adding'!
addAll:aCollection
self shouldNotImplement. "/ Cannot grow!!
"Created: / 30-09-2012 / 19:56:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GitStringArray methodsFor:'finalization'!
finalize
GitPrimitives prim_git_strarray_free: self.
self setAddress:0 size:0
"Created: / 30-09-2012 / 19:58:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GitStringArray class methodsFor:'documentation'!
version_GIT
"Never, ever change this method. Ask JV or CG why"
^thisContext method mclass theNonMetaclass instVarNamed: #revision
!
version_SVN
^ '$Id$'
! !