git/GitCheckoutStrategy.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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     1
"{ Package: 'stx:libscm/git' }"
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     2
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     3
SharedPool subclass:#GitCheckoutStrategy
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     4
	instanceVariableNames:''
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     5
	classVariableNames:'GIT_CHECKOUT_DEFAULT GIT_CHECKOUT_OVERWRITE_MODIFIED
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     6
		GIT_CHECKOUT_CREATE_MISSING GIT_CHECKOUT_REMOVE_UNTRACKED
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     7
		GIT_CHECKOUT_NONE'
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     8
	poolDictionaries:''
29
621143a76ec5 - GitTests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 12
diff changeset
     9
	category:'SCM-Git-Core-Internal-Constants'
12
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    10
!
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    11
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    12
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    13
!GitCheckoutStrategy class methodsFor:'initialization'!
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    14
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    15
initialize
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    16
    "Invoked at system start or when the class is dynamically loaded."
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    17
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    18
    GIT_CHECKOUT_DEFAULT :=             1.
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    19
    GIT_CHECKOUT_OVERWRITE_MODIFIED :=  2.
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    20
    GIT_CHECKOUT_CREATE_MISSING :=      4.
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    21
    GIT_CHECKOUT_REMOVE_UNTRACKED :=    8.
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    22
    GIT_CHECKOUT_NONE := GIT_CHECKOUT_DEFAULT. "/ more meaningfull alias
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    23
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    24
    "Modified: / 19-09-2012 / 18:35:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    25
! !
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    26
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    27
!GitCheckoutStrategy class methodsFor:'documentation'!
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    28
31
d96d7eff6efc - GitDiffDeltaStructure
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 29
diff changeset
    29
version_GIT
d96d7eff6efc - GitDiffDeltaStructure
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 29
diff changeset
    30
    "Never, ever change this method. Ask JV or CG why"
d96d7eff6efc - GitDiffDeltaStructure
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 29
diff changeset
    31
    ^thisContext method mclass theNonMetaclass instVarNamed: #revision
d96d7eff6efc - GitDiffDeltaStructure
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 29
diff changeset
    32
!
d96d7eff6efc - GitDiffDeltaStructure
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 29
diff changeset
    33
12
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    34
version_SVN
481
0cfef855baa2 Initial import from upstream repository
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 31
diff changeset
    35
    ^ '$Id$'
12
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    36
! !
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    37
59d59fc32b71 - added infrastructure for tests
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    38
GitCheckoutStrategy initialize!