SVN__ExportCommand.st
changeset 943 fd0ba6614fd8
equal deleted inserted replaced
942:e580271efd33 943:fd0ba6614fd8
       
     1 "
       
     2  Copyright (c) 2007-2010 Jan Vrany
       
     3  Copyright (c) 2009-2010 eXept Software AG
       
     4 
       
     5  Permission is hereby granted, free of charge, to any person
       
     6  obtaining a copy of this software and associated documentation
       
     7  files (the 'Software'), to deal in the Software without
       
     8  restriction, including without limitation the rights to use,
       
     9  copy, modify, merge, publish, distribute, sublicense, and/or sell
       
    10  copies of the Software, and to permit persons to whom the
       
    11  Software is furnished to do so, subject to the following
       
    12  conditions:
       
    13 
       
    14  The above copyright notice and this permission notice shall be
       
    15  included in all copies or substantial portions of the Software.
       
    16 
       
    17  THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
       
    18  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
       
    19  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
       
    20  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
       
    21  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
       
    22  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
       
    23  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
       
    24  OTHER DEALINGS IN THE SOFTWARE.
       
    25 "
       
    26 "{ Package: 'stx:libsvn' }"
       
    27 
       
    28 "{ NameSpace: SVN }"
       
    29 
       
    30 BranchCommand subclass:#ExportCommand
       
    31 	instanceVariableNames:'path destination depth'
       
    32 	classVariableNames:''
       
    33 	poolDictionaries:''
       
    34 	category:'SVN-Private-Commands'
       
    35 !
       
    36 
       
    37 !ExportCommand class methodsFor:'documentation'!
       
    38 
       
    39 copyright
       
    40 "
       
    41  Copyright (c) 2007-2010 Jan Vrany
       
    42  Copyright (c) 2009-2010 eXept Software AG
       
    43 
       
    44  Permission is hereby granted, free of charge, to any person
       
    45  obtaining a copy of this software and associated documentation
       
    46  files (the 'Software'), to deal in the Software without
       
    47  restriction, including without limitation the rights to use,
       
    48  copy, modify, merge, publish, distribute, sublicense, and/or sell
       
    49  copies of the Software, and to permit persons to whom the
       
    50  Software is furnished to do so, subject to the following
       
    51  conditions:
       
    52 
       
    53  The above copyright notice and this permission notice shall be
       
    54  included in all copies or substantial portions of the Software.
       
    55 
       
    56  THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
       
    57  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
       
    58  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
       
    59  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
       
    60  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
       
    61  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
       
    62  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
       
    63  OTHER DEALINGS IN THE SOFTWARE.
       
    64 
       
    65 "
       
    66 ! !
       
    67 
       
    68 !ExportCommand methodsFor:'accessing'!
       
    69 
       
    70 depth:aString
       
    71 
       
    72     self assert: 
       
    73         (#('empty' 'files' 'immediates' 'infinity') includes: aString).
       
    74     
       
    75     depth := aString.
       
    76 
       
    77     "Modified: / 23-04-2011 / 18:50:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    78 !
       
    79 
       
    80 destination
       
    81     ^ destination
       
    82 !
       
    83 
       
    84 destination:something
       
    85     destination := something.
       
    86 !
       
    87 
       
    88 path
       
    89     ^ path
       
    90 !
       
    91 
       
    92 path:something
       
    93     path := something.
       
    94 ! !
       
    95 
       
    96 !ExportCommand methodsFor:'executing'!
       
    97 
       
    98 execute
       
    99     ^[super execute] on:SVN::WorkingCopyLockedError do:
       
   100         [:ex | 
       
   101         alreadyCleaned 
       
   102             ifTrue:
       
   103                 [ex pass]
       
   104             ifFalse:
       
   105                 [self svnCleanup.
       
   106                 alreadyCleaned := true.
       
   107                 self execute]]
       
   108 
       
   109     "Created: / 08-11-2008 / 08:39:02 / Jan Vrany <vranyj1@fel.cvut.cz>"
       
   110 ! !
       
   111 
       
   112 !ExportCommand methodsFor:'executing - private'!
       
   113 
       
   114 svnCleanup
       
   115 
       
   116     ^CleanupCommand new
       
   117         workingCopy: destination;
       
   118         execute.
       
   119 
       
   120     "Created: / 08-11-2008 / 08:39:15 / Jan Vrany <vranyj1@fel.cvut.cz>"
       
   121 !
       
   122 
       
   123 svnCmd
       
   124 
       
   125     ^'export'
       
   126 
       
   127     "Created: / 08-11-2008 / 08:39:15 / Jan Vrany <vranyj1@fel.cvut.cz>"
       
   128     "Created: / 12-10-2011 / 10:45:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   129 !
       
   130 
       
   131 svnCmdArgumentsOn:arg 
       
   132     "raise an error: must be redefined in concrete subclass(es)"
       
   133 
       
   134     arg
       
   135         nextPut: '-r'; nextPut: self revision printString.
       
   136     arg
       
   137         nextPut: '--depth'; nextPut: depth ? 'infinity'.
       
   138 
       
   139     path notNil ifTrue:[
       
   140         arg nextPut: (self url , '/' , path)
       
   141     ] ifFalse:[
       
   142         arg nextPut: self url    
       
   143     ].
       
   144 
       
   145     destination notNil ifTrue:[
       
   146         arg nextPut: destination
       
   147     ]
       
   148 
       
   149     "Created: / 16-03-2008 / 10:00:34 / janfrog"
       
   150     "Modified: / 12-10-2011 / 10:32:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   151 !
       
   152 
       
   153 svnCmdWorkdir
       
   154 
       
   155     ^Filename currentDirectory pathName
       
   156 
       
   157     "Created: / 19-03-2008 / 12:43:21 / janfrog"
       
   158     "Modified: / 19-08-2009 / 12:47:54 / Jan Vrany <vranyj1@fel.cvut.cz>"
       
   159     "Modified: / 12-10-2011 / 10:47:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   160 !
       
   161 
       
   162 svnProcessCommandOutput: stdout err: stderr 
       
   163 
       
   164     ^stdout contents
       
   165 
       
   166     "Created: / 03-10-2008 / 16:31:45 / Jan Vrany <vranyj1@fel.cvut.cz>"
       
   167     "Modified: / 18-08-2009 / 14:38:55 / Jan Vrany <vranyj1@fel.cvut.cz>"
       
   168     "Modified: / 12-10-2011 / 10:28:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   169 ! !
       
   170 
       
   171 !ExportCommand class methodsFor:'documentation'!
       
   172 
       
   173 version
       
   174     ^ '$Header$'
       
   175 !
       
   176 
       
   177 version_CVS
       
   178     ^ '$Header$'
       
   179 ! !