mercurial/HGRepositoriesResource.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 05 Feb 2013 15:24:24 +0100
changeset 219 475366f8ba6f
parent 212 8ec5884fba41
child 302 e078bdcef149
permissions -rw-r--r--
Bugfix: HGCommandParser>>parseCommandMerge: handle correctly clear merges.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     1
"
210
54a73fa50d40 Added copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 189
diff changeset
     2
 COPYRIGHT (c) 2012-2013 by Jan Vrany
54a73fa50d40 Added copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 189
diff changeset
     3
              All Rights Reserved
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
     4
210
54a73fa50d40 Added copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 189
diff changeset
     5
 This software is furnished under a license and may be used
54a73fa50d40 Added copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 189
diff changeset
     6
 only in accordance with the terms of that license and with the
54a73fa50d40 Added copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 189
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
54a73fa50d40 Added copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 189
diff changeset
     8
 be provided or otherwise made available to, or used by, any
54a73fa50d40 Added copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 189
diff changeset
     9
 other person.  No title to or ownership of the software is
54a73fa50d40 Added copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 189
diff changeset
    10
 hereby transferred.
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    11
"
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    12
"{ Package: 'stx:libscm/mercurial' }"
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    13
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    14
TestResource subclass:#HGRepositoriesResource
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    15
	instanceVariableNames:'repositoryDirectory'
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    16
	classVariableNames:'HGRepositoriesArchiveDir'
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    17
	poolDictionaries:''
69
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
    18
	category:'SCM-Mercurial-Tests'
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    19
!
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    20
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    21
!HGRepositoriesResource class methodsFor:'documentation'!
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    22
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    23
copyright
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    24
"
210
54a73fa50d40 Added copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 189
diff changeset
    25
 COPYRIGHT (c) 2012-2013 by Jan Vrany
54a73fa50d40 Added copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 189
diff changeset
    26
              All Rights Reserved
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    27
210
54a73fa50d40 Added copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 189
diff changeset
    28
 This software is furnished under a license and may be used
54a73fa50d40 Added copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 189
diff changeset
    29
 only in accordance with the terms of that license and with the
54a73fa50d40 Added copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 189
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
54a73fa50d40 Added copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 189
diff changeset
    31
 be provided or otherwise made available to, or used by, any
54a73fa50d40 Added copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 189
diff changeset
    32
 other person.  No title to or ownership of the software is
54a73fa50d40 Added copyright notice.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 189
diff changeset
    33
 hereby transferred.
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    34
"
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    35
! !
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    36
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    37
!HGRepositoriesResource class methodsFor:'class initialization'!
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    38
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    39
initialize
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    40
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    41
    HGRepositoriesArchiveDir := (Smalltalk packageDirectoryForPackageId:self package)
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    42
                    / 'tests' / 'repositories'
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    43
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    44
    "Created: / 09-12-2010 / 23:07:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    45
    "Modified (format): / 27-12-2011 / 18:07:34 / dundee"
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    46
    "Modified: / 17-10-2012 / 13:02:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    47
! !
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    48
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    49
!HGRepositoriesResource methodsFor:'accessing'!
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    50
93
2579830f6b61 Tests fixed. Not-yet-supported tests marked as skipped.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
    51
directoryForRepositories
2579830f6b61 Tests fixed. Not-yet-supported tests marked as skipped.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
    52
    ^repositoryDirectory
2579830f6b61 Tests fixed. Not-yet-supported tests marked as skipped.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
    53
2579830f6b61 Tests fixed. Not-yet-supported tests marked as skipped.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
    54
    "Created: / 22-11-2012 / 11:34:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2579830f6b61 Tests fixed. Not-yet-supported tests marked as skipped.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
    55
!
2579830f6b61 Tests fixed. Not-yet-supported tests marked as skipped.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
    56
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    57
directoryForRepositoryNamed: nm
174
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
    58
    ^self directoryForRepositoryNamed: nm unpack: true
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    59
174
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
    60
    "Created: / 19-09-2012 / 18:57:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
    61
    "Modified: / 14-01-2013 / 13:13:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
    62
!
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
    63
212
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
    64
directoryForRepositoryNamed: nm init: init
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
    65
    "Returns path to repository named nm.
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
    66
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
    67
     If `init` is true, then the repository is created and initialized
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
    68
     (with no content at all). If 'init' is false, then only directory
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
    69
     name is returned (without creating it)."
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
    70
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
    71
    ^self directoryForRepositoryNamed: nm unpack: false init: init
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
    72
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
    73
    "Created: / 01-02-2013 / 13:38:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
    74
!
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
    75
174
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
    76
directoryForRepositoryNamed: nm unpack: unpack
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    77
    "Returns path to repository named nm.
174
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
    78
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
    79
     If `unpack` is true, then the repository is frechly created and thus
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
    80
     empty. If 'unpack' is true, then initial content of repository will 
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
    81
     be loaded from zip archive located in
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    82
        <package path>/stx/libsvn/tests/repositories/<name>.git.zip
174
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
    83
     If the files does not exists, an error is raised"
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
    84
212
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
    85
    ^self directoryForRepositoryNamed: nm unpack: unpack init: true
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
    86
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
    87
    "Created: / 14-01-2013 / 13:13:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
    88
    "Modified: / 01-02-2013 / 13:39:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
    89
!
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
    90
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
    91
directoryForRepositoryNamed: nm unpack: unpack init: init
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
    92
    "Returns path to repository named nm.
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
    93
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
    94
     If `unpack` is true, then the repository is frechly created and thus
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
    95
     empty, unless 'init' is false (in that case, only a name of directory
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
    96
     that does not exists yet ir returned.
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
    97
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
    98
     If 'unpack' is true, then initial content of repository will 
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
    99
     be loaded from zip archive located in
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   100
        <package path>/stx/libsvn/tests/repositories/<name>.git.zip
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   101
     If the files does not exists, an error is raised"
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   102
166
dbf0f7eb0dc9 Performance fix in HFSourceCodeManager revision log access.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 115
diff changeset
   103
    | archiveNm archive repo dir  ok |
212
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   104
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   105
    unpack ifTrue:[
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   106
        self assert: init description: 'Cannot unpack non-initialized repo!!'
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   107
    ].
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   108
69
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   109
    archiveNm := nm copy 
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   110
                    replaceAll:$/ with:$_; 
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   111
                    yourself.
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   112
    archive := HGRepositoriesArchiveDir / (archiveNm , '.hg.zip').
174
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   113
    unpack ifTrue:[
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   114
        self assert:archive exists description:'dump file does not exist'.
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   115
    ].
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   116
    self assert:repositoryDirectory exists description:'repository directory does not exist'.
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   117
93
2579830f6b61 Tests fixed. Not-yet-supported tests marked as skipped.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
   118
    dir := "/Filename newTemporaryDirectoryIn: 
2579830f6b61 Tests fixed. Not-yet-supported tests marked as skipped.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
   119
                repositoryDirectory.
2579830f6b61 Tests fixed. Not-yet-supported tests marked as skipped.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
   120
212
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   121
    init ifFalse:[
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   122
        ^ (dir asAbsoluteFilename / nm) pathName.
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   123
    ].
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   124
174
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   125
    unpack ifTrue:[
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   126
        ok := true.
166
dbf0f7eb0dc9 Performance fix in HFSourceCodeManager revision log access.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 115
diff changeset
   127
        OperatingSystem 
dbf0f7eb0dc9 Performance fix in HFSourceCodeManager revision log access.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 115
diff changeset
   128
            executeCommand:('unzip %1' bindWith: (archive asAbsoluteFilename pathName))
dbf0f7eb0dc9 Performance fix in HFSourceCodeManager revision log access.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 115
diff changeset
   129
            inDirectory:dir 
174
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   130
            onError:[:status | ok := false].
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   131
        ok ifFalse:[
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   132
            OperatingSystem 
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   133
                executeCommand:('unzip %1' bindWith: (archive asAbsoluteFilename pathName))
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   134
                inDirectory:dir 
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   135
                onError:[:status | self assert:false description:'unzip failed'].
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   136
        ].
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   137
    ] ifFalse:[
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   138
        | repodir |
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   139
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   140
        repodir := (dir asAbsoluteFilename / nm).
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   141
        repodir directory recursiveMakeDirectory.
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   142
        OperatingSystem 
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   143
                executeCommand:('hg init %1' bindWith: (repodir baseName))
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   144
                inDirectory:repodir directory pathName 
0d293012a897 Fixed commit to freshly created repository.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 166
diff changeset
   145
                onError:[:status | self assert:false description:'hg init failed'].
166
dbf0f7eb0dc9 Performance fix in HFSourceCodeManager revision log access.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 115
diff changeset
   146
    ].
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   147
93
2579830f6b61 Tests fixed. Not-yet-supported tests marked as skipped.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 69
diff changeset
   148
    repo := (dir asAbsoluteFilename / nm).
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   149
    self assert: repo exists.
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   150
    self assert: (repo / '.hg') exists.
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   151
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   152
    ^repo pathName
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   153
212
8ec5884fba41 Fixed bugs introduced on 2013-01-22.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 210
diff changeset
   154
    "Created: / 01-02-2013 / 13:35:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   155
! !
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   156
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   157
!HGRepositoriesResource methodsFor:'running'!
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   158
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   159
setUp
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   160
69
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   161
    repositoryDirectory := Filename newTemporaryDirectory.
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   162
    Smalltalk packagePath: (Smalltalk packagePath asOrderedCollection
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   163
                                addFirst: repositoryDirectory pathName;
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   164
                                yourself)
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   165
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   166
    "Created: / 09-12-2010 / 23:53:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   167
    "Modified (format): / 27-12-2011 / 18:07:04 / dundee"
69
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   168
    "Modified: / 16-11-2012 / 20:16:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   169
!
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   170
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   171
tearDown
69
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   172
    Smalltalk packagePath: (Smalltalk packagePath 
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   173
                                remove: repositoryDirectory pathName;
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   174
                                yourself).
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   175
    [
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   176
        repositoryDirectory recursiveRemove
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   177
    ] on: Error do:[
69
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   178
        "Stupid windows!!"
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   179
    ]
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   180
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   181
    "Created: / 09-12-2010 / 23:54:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   182
    "Modified: / 30-09-2012 / 05:26:04 / jv"
69
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   183
    "Modified: / 16-11-2012 / 20:16:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   184
! !
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   185
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   186
!HGRepositoriesResource methodsFor:'testing'!
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   187
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   188
isAvailable
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   189
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   190
    ^HGRepositoriesArchiveDir exists and:[OperatingSystem canExecuteCommand:'unzip']
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   191
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   192
    "Created: / 09-12-2010 / 23:06:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   193
    "Modified (format): / 27-12-2011 / 18:05:57 / dundee"
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   194
    "Modified: / 17-10-2012 / 13:02:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   195
! !
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   196
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   197
!HGRepositoriesResource class methodsFor:'documentation'!
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   198
54
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 34
diff changeset
   199
version_HG
115
b1ed2d29054b version_HG changed to return string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 93
diff changeset
   200
b1ed2d29054b version_HG changed to return string.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 93
diff changeset
   201
    ^ '$Changeset: <not expanded> $'
54
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 34
diff changeset
   202
!
66045198bfbc More changes towards self hosting. Some work on model is still missing...
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 34
diff changeset
   203
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   204
version_SVN
69
17045d49309f Refactoring: preparation for accessing changeset contents.
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents: 54
diff changeset
   205
    ^ '§Id::                                                                                                                        §'
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   206
! !
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   207
189
3d6c123a7295 HGChangesetId>>readFrom: now supports revno-only and hash-only form of CS IDs.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 174
diff changeset
   208
34
0ef61b36cfa7 - First bits
vranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
parents:
diff changeset
   209
HGRepositoriesResource initialize!