git/GitReference.st
author Jan Vrany <jan.vrany@labware.com>
Fri, 19 Feb 2021 08:29:41 +0000
changeset 924 4d92f234f671
parent 481 0cfef855baa2
permissions -rw-r--r--
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' }"

GitLibraryObject subclass:#GitReference
	instanceVariableNames:'name'
	classVariableNames:''
	poolDictionaries:''
	category:'SCM-Git-Core'
!


!GitReference methodsFor:'accessing'!

name
    name isNil ifTrue:[
        name := (GitPrimitives prim_git_reference_name: handle) 
    ].
    ^name

    "Created: / 25-09-2012 / 11:00:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

oid

    ^ GitOid fromBytes: (GitPrimitives prim_git_reference_oid: handle).

    "Created: / 25-09-2012 / 10:48:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GitReference methodsFor:'initialization & release'!

free
    handle notNil ifTrue:[
        GitPrimitives prim_git_reference_free: handle. 
        handle := nil.
    ].

    "Created: / 25-09-2012 / 10:44:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GitReference methodsFor:'private-accessing'!

getHandleClass
    ^GitReferenceHandle

    "Created: / 25-09-2012 / 10:44:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GitReference methodsFor:'testing'!

isGitReference
    ^true

    "Created: / 02-10-2012 / 16:12:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!GitReference class methodsFor:'documentation'!

version_GIT
    "Never, ever change this method. Ask JV or CG why"
    ^thisContext method mclass theNonMetaclass instVarNamed: #revision
!

version_SVN
    ^ '$Id$'
! !