This repository has been archived by the owner on Dec 23, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
19 May 2011: tfel from Squeak: Ask before multiple commit messages ar…
…e merged into 1 Conflicts: Core/GCCallout.st Core/GCGitWrapper.st Core/GCMapper.st Core/GCPackage.st Core/GCRegistry.st Extensions/MCWorkingCopyBrowser.st GST/GCGstConvertCommand.st GST/GCGstPackageWriter.st Morphic/GCRepositoryBrowser.st
- Loading branch information
Showing
9 changed files
with
1,071 additions
and
1,177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,71 @@ | ||
Object subclass: GCCallout [ | ||
| localPath | | ||
<category: 'Gitocello-Core'> | ||
<comment: nil> | ||
Object subclass: #GCCallout | ||
instanceVariableNames: 'localPath' | ||
classVariableNames: 'CalloutDict GitBinaryPath' | ||
poolDictionaries: '' | ||
category: 'Gitocello-Core'! | ||
|
||
CalloutDict := nil. | ||
GitBinaryPath := nil. | ||
"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! | ||
|
||
GCCallout class >> apiLinuxLibc5Callout: aCommand [ | ||
<category: 'callout'> | ||
GCCallout class | ||
instanceVariableNames: ''! | ||
|
||
!GCCallout class methodsFor: 'callout' stamp: 'tfel 6/14/2010 15:36'! | ||
apiLinuxLibc5Callout: aCommand | ||
<cdecl: long 'system' ( char* ) module: 'libc.so.5'> | ||
^self externalCallFailed | ||
] | ||
^ self externalCallFailed ! ! | ||
|
||
GCCallout class >> apiLinuxLibc6Callout: aCommand [ | ||
<category: 'callout'> | ||
!GCCallout class methodsFor: 'callout' stamp: 'tfel 6/14/2010 15:36'! | ||
apiLinuxLibc6Callout: aCommand | ||
<cdecl: long 'system' ( char* ) module: 'libc.so.6'> | ||
^self externalCallFailed | ||
] | ||
^ self externalCallFailed ! ! | ||
|
||
GCCallout class >> apiMacOSXCallout: aCommand [ | ||
<category: 'callout'> | ||
| errCode | | ||
!GCCallout class methodsFor: 'callout' stamp: 'tfel 6/14/2010 15:36'! | ||
apiMacOSXCallout: aCommand | ||
<cdecl: long 'system' (char*) module: 'libSystem.dylib'> | ||
errCode := ExternalFunction getLastError. | ||
^errCode = 13 | ||
ifTrue: | ||
["Unable to find function address. dylibs are not searched" | ||
|
||
self | ||
error: 'Cannot call libSystem.dylib. | ||
| errCode | | ||
errCode := ExternalFunction getLastError. | ||
^ errCode = 13 "Unable to find function address. dylibs are not searched" | ||
ifTrue: [self error: 'Cannot call libSystem.dylib. | ||
Please set "SqueakPluginsBuiltInOrLocalOnly" in your VM''s Info.plist to false'] | ||
ifFalse: [self externalCallFailed] | ||
] | ||
ifFalse: [self externalCallFailed]! ! | ||
|
||
GCCallout class >> apiWindowsCallout: aCommand [ | ||
<category: 'callout'> | ||
!GCCallout class methodsFor: 'callout' stamp: 'tfel 6/14/2010 15:36'! | ||
apiWindowsCallout: aCommand | ||
<apicall: long 'system' ( char* ) module: 'msvcrt.dll'> | ||
^self externalCallFailed | ||
] | ||
^ self externalCallFailed! ! | ||
|
||
GCCallout class >> callout: aCommand [ | ||
<category: 'callout'> | ||
^(Smalltalk classNamed: 'OSProcess') ifNil: | ||
[(self calloutDict at: SmalltalkImage current platformName asLowercase | ||
ifAbsent: [[:cmd | self error: 'Callouts not implemented for your platform!']]) | ||
value: aCommand] | ||
ifNotNil: [:class | class waitForCommand: aCommand] | ||
] | ||
!GCCallout class methodsFor: 'callout' stamp: 'tfel 6/14/2010 16:21'! | ||
callout: aCommand | ||
|
||
GCCallout class >> calloutDict [ | ||
<category: 'callout'> | ||
CalloutDict ifNil: | ||
[CalloutDict := (Dictionary new) | ||
at: 'unix' put: [:cmd | self linuxCallout: cmd]; | ||
at: 'win32' put: [:cmd | self windowsCallout: cmd]; | ||
at: 'mac os' put: [:cmd | self apiMacOSXCallout: cmd]; | ||
yourself]. | ||
^CalloutDict | ||
] | ||
^ (Smalltalk classNamed: 'OSProcess') | ||
ifNil: [(self calloutDict | ||
at: SmalltalkImage current platformName asLowercase | ||
ifAbsent: [[:cmd | self error: 'Callouts not implemented for your platform!!']]) | ||
value: aCommand] | ||
ifNotNilDo: [:class | class waitForCommand: aCommand].! ! | ||
|
||
GCCallout class >> linuxCallout: aCommand [ | ||
"Try with new libc6 and older libc5" | ||
!GCCallout class methodsFor: 'callout' stamp: 'tfel 6/14/2010 15:36'! | ||
calloutDict | ||
|
||
<category: 'callout'> | ||
[self apiLinuxLibc6Callout: aCommand] on: Error | ||
do: [self apiLinuxLibc5Callout: aCommand] | ||
] | ||
CalloutDict ifNil: [CalloutDict := Dictionary new | ||
at: 'unix' put: [:cmd | self linuxCallout: cmd]; | ||
at: 'win32' put: [:cmd | self windowsCallout: cmd]; | ||
at: 'mac os' put: [:cmd | self apiMacOSXCallout: cmd]; | ||
yourself]. | ||
^ CalloutDict! ! | ||
|
||
GCCallout class >> windowsCallout: aCommand [ | ||
"Escape newlines for Windows CmdLine" | ||
!GCCallout class methodsFor: 'callout' stamp: 'tfel 6/14/2010 15:36'! | ||
linuxCallout: aCommand | ||
"Try with new libc6 and older libc5" | ||
[self apiLinuxLibc6Callout: aCommand] | ||
on: Error | ||
do: [self apiLinuxLibc5Callout: aCommand]! ! | ||
|
||
<category: 'callout'> | ||
!GCCallout class methodsFor: 'callout' stamp: 'tfel 6/14/2010 15:36'! | ||
windowsCallout: aCommand | ||
"Escape newlines for Windows CmdLine" | ||
| escapedCommand | | ||
escapedCommand := (aCommand copyReplaceAll: Character cr asString with: ' ') | ||
copyReplaceAll: Character lf asString | ||
with: ' '. | ||
self apiWindowsCallout: escapedCommand | ||
] | ||
] | ||
|
||
escapedCommand := ((aCommand | ||
copyReplaceAll: Character cr asString with: ' ') | ||
copyReplaceAll: Character lf asString with: ' '). | ||
self apiWindowsCallout: escapedCommand.! ! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,100 +1,88 @@ | ||
Object subclass: GCGitWrapper [ | ||
| localPath | | ||
|
||
<category: 'Gitocello-Core'> | ||
<comment: nil> | ||
|
||
CalloutDict := nil. | ||
GitBinaryPath := nil. | ||
|
||
GCGitWrapper class >> gitBinaryPath [ | ||
<category: 'preferences'> | ||
<preference: 'Git binary path' | ||
category: 'Gitocello' | ||
description: 'Set the path of the git binary to be used for Gitocello' | ||
type: #String> | ||
^GitBinaryPath ifNil: ['git'] | ||
] | ||
|
||
GCGitWrapper class >> gitBinaryPath: aString [ | ||
<category: 'preferences'> | ||
GitBinaryPath := aString | ||
] | ||
|
||
add [ | ||
Object subclass: #GCGitWrapper | ||
instanceVariableNames: 'localPath' | ||
classVariableNames: 'CalloutDict GitBinaryPath' | ||
poolDictionaries: '' | ||
category: 'Gitocello-Core'! | ||
|
||
!GCGitWrapper methodsFor: 'commands' stamp: 'tfel 9/8/2009 20:00'! | ||
add | ||
"Just add all" | ||
self gitCommand: 'add .'! ! | ||
|
||
<category: 'commands'> | ||
self gitCommand: 'add .' | ||
] | ||
|
||
add: matchString [ | ||
!GCGitWrapper methodsFor: 'commands' stamp: 'tfel 9/8/2009 20:00'! | ||
add: matchString | ||
"Add using matchString" | ||
self gitCommand: 'add ', matchString! ! | ||
|
||
<category: 'commands'> | ||
self gitCommand: 'add ' , matchString | ||
] | ||
|
||
commit: commitMsg [ | ||
!GCGitWrapper methodsFor: 'commands' stamp: 'tfel 6/14/2010 16:26'! | ||
commit: commitMsg | ||
"Commit changes to the local repository" | ||
self gitCommand: 'commit --allow-empty -m "', commitMsg, '"'! ! | ||
|
||
<category: 'commands'> | ||
self gitCommand: 'commit --allow-empty -m "' , commitMsg , '"' | ||
] | ||
!GCGitWrapper methodsFor: 'commands' stamp: 'mh 5/12/2010 17:03'! | ||
dirChangeCommand | ||
^ SmalltalkImage current platformName asLowercase = 'win32' | ||
ifTrue: ['cd "', self localPath, '" & ', (self localPath copyUpTo: $:) ,': & '] | ||
ifFalse: ['cd "', self localPath, '";']. | ||
! ! | ||
|
||
dirChangeCommand [ | ||
<category: 'commands'> | ||
^SmalltalkImage current platformName asLowercase = 'win32' | ||
ifTrue: | ||
['cd "' , self localPath , '" & ' , (self localPath copyUpTo: $:) , ': & '] | ||
ifFalse: ['cd "' , self localPath , '";'] | ||
] | ||
|
||
gitCommand: aCommandString [ | ||
!GCGitWrapper methodsFor: 'commands' stamp: 'tfel 6/14/2010 15:37'! | ||
gitCommand: aCommandString | ||
"Enter the local repository and run the 'git' command with the parameters" | ||
|
||
<category: 'commands'> | ||
| command | | ||
command := self dirChangeCommand , ' ' , self class gitBinaryPath , ' ' | ||
, aCommandString. | ||
GCCallout callout: command | ||
] | ||
|
||
init [ | ||
<category: 'commands'> | ||
self gitCommand: 'init' | ||
] | ||
|
||
origin: aRemoteUrl [ | ||
<category: 'commands'> | ||
command := self dirChangeCommand, ' ', self class gitBinaryPath, ' ', aCommandString. | ||
GCCallout callout: command.! ! | ||
|
||
!GCGitWrapper methodsFor: 'commands' stamp: 'tfel 9/7/2009 01:03'! | ||
init | ||
|
||
self gitCommand: 'init'! ! | ||
|
||
!GCGitWrapper methodsFor: 'commands' stamp: 'tfel 9/7/2009 03:29'! | ||
origin: aRemoteUrl | ||
|
||
self gitCommand: 'remote rm origin'. | ||
self gitCommand: 'remote add origin ' , aRemoteUrl | ||
] | ||
self gitCommand: 'remote add origin ', aRemoteUrl! ! | ||
|
||
pull [ | ||
!GCGitWrapper methodsFor: 'commands' stamp: 'TF 5/15/2010 17:59:40.669'! | ||
pull | ||
"Avoid merging altogether for now" | ||
self gitCommand: 'pull -s ours origin master'! ! | ||
|
||
!GCGitWrapper methodsFor: 'commands' stamp: 'tfel 9/6/2009 18:30'! | ||
push | ||
|
||
<category: 'commands'> | ||
self gitCommand: 'pull -s ours origin master' | ||
] | ||
self gitCommand: 'push origin master'! ! | ||
|
||
push [ | ||
<category: 'commands'> | ||
self gitCommand: 'push origin master' | ||
] | ||
|
||
localPath [ | ||
!GCGitWrapper methodsFor: 'accessing' stamp: 'tfel 9/6/2009 23:10'! | ||
localPath | ||
"Answer the value of localPath" | ||
|
||
<category: 'accessing'> | ||
^localPath | ||
] | ||
^ localPath! ! | ||
|
||
localPath: anObject [ | ||
!GCGitWrapper methodsFor: 'accessing' stamp: 'tfel 9/6/2009 23:10'! | ||
localPath: anObject | ||
"Set the value of localPath" | ||
|
||
<category: 'accessing'> | ||
localPath := anObject | ||
] | ||
] | ||
localPath := anObject! ! | ||
|
||
"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "! | ||
|
||
GCGitWrapper class | ||
instanceVariableNames: ''! | ||
|
||
!GCGitWrapper class methodsFor: 'preferences' stamp: 'tfel 5/31/2010 15:38:12.485'! | ||
gitBinaryPath | ||
|
||
<preference: 'Git binary path' | ||
category: 'Gitocello' | ||
description: 'Set the path of the git binary to be used for Gitocello' | ||
type: #String> | ||
^ GitBinaryPath ifNil: ['git'] | ||
! ! | ||
|
||
!GCGitWrapper class methodsFor: 'preferences' stamp: 'tfel 5/31/2010 15:46:01.724'! | ||
gitBinaryPath: aString | ||
|
||
GitBinaryPath := aString.! ! |
Oops, something went wrong.