Skip to content

Commit

Permalink
Merge pull request #194 from npasserini/dev-0.3
Browse files Browse the repository at this point in the history
Preview of version 0.3.1
  • Loading branch information
npasserini authored Oct 25, 2016
2 parents b265f0f + 24a078b commit 6acc5ab
Show file tree
Hide file tree
Showing 133 changed files with 462 additions and 254 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
scenarios
scenarioForSwitchBranches
"Create a new version of a package in another branch, then remove all code from the image."

"1 - Commit a new version in a branch"
repository loadPackage: packageName.
repository createBranch: 'forTestingCheckout'.
self theTestClass compile: 'methodInBranch'.
repository
savePackage: packageName
withMessage: 'New method in branch'.

"2 - Remove all code from the image"
self removeTestPackages.
self deny: (Smalltalk globals includesKey: #Test).

"3 - Reload package from master branch"
repository checkoutBranch: 'master'.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
tests - branchs
testBranchIncludesCommit
(self lastCommits: 3) do: [ :commit |
self assert: (repository branch includesCommit: commit)
]

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tests - branchs
testBranchName
repository branchName: 'nuevoBranch'.
repository createBranch: 'nuevoBranch'.
self assert: repository branch name equals: 'nuevoBranch'.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
tests - create repository
testCloneSpecifyingBranch
repository checkoutBranch: 'forBecomeWriteable'.

self assert: repository branchName equals: 'forBecomeWriteable'.
self assert: repository branch name equals: 'forBecomeWriteable'.
self assert: repository backend branch equals: 'forBecomeWriteable'.
self assert: repository backend currentBranch equals: 'forBecomeWriteable'.

repository loadPackage: packageName.
self assert: ((Smalltalk at: #Test) canUnderstand: #forBecomeWritable)

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ testCommitMultiplePackagesTogether
repository loadPackage: packageName.
repository loadPackage: otherPackageName.

oldCommits := repository commits size.
oldCommits := repository currentBranch commits size.

testClass := Smalltalk at: #Test.
testClass compile: ('newMethod').
Expand All @@ -17,7 +17,7 @@ testCommitMultiplePackagesTogether
newClass compile: ('newMethod').

repository commitWithMessage: 'Committing two packages together'.
self assert: repository commits size equals: oldCommits + 1.
self assert: repository currentBranch commits size equals: oldCommits + 1.
self assert: repository loadedCode referenceCommit equals: repository headCommit.

{ packageName. otherPackageName } do: [ :name | | package version |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ testCreateBranch
self saveNewVersion.
[
repository push.
self assert: repository upstream shortName equals: 'origin/createdBranch'.
self assert: repository currentBranch upstream shortName equals: 'origin/createdBranch'.
self assert: repository outgoingCommits isEmpty.
]
ensure: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ testDiffWithBranch
| diff change |
self scenarioOutgoingCommit.

diff := repository headCommit diffWith: repository upstream.
diff := repository headCommit diffWith: repository currentBranch upstream.

self assert: diff changes notEmpty.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ testMergeWithConflicts
self checkLoadedLatestCommitWithVersion: newVersionNumber.

"2. Exercise: Update the package from remote repository"
toMerge := repository upstream lastCommit.
toMerge := repository currentBranch upstream lastCommit.
self should: [ repository basicMerge: toMerge ] raise: IceMergeAborted.

[ repository mergeConflictsWith: toMerge ]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
tests - create repository
testMetacelloIntegration
self assert: (IceRepository registry noneSatisfy: [ :repo | repo origin projectName = projectName ]).

Metacello new
baseline: 'PharoGitTest';
repository: 'github://npasserini/', projectName;
load.

repository := IceRepository registry
detect: [ :repo | repo origin projectName = projectName ]
ifNone: [ self fail: 'Could not find repository for project: ', projectName ].

self assert: (repository loadedCode loadedVersions noneSatisfy: [ :version | version isKindOf: IceForeignVersion ]).
self assert: ((repository loadedCode versionFor: (repository packageNamed: packageName)) isKindOf: IceSavedPackageVersion ).
self assert: repository incommingCommits isEmpty.
self assert: repository outgoingCommits isEmpty.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
tests - create repository
testMetacelloIntegrationForTags
self assert: (IceRepository registry noneSatisfy: [ :repo | repo origin projectName = projectName ]).

Metacello new
baseline: 'PharoGitTest';
repository: 'github://npasserini/', projectName, ':1.2.3';
load.

repository := IceRepository registry
detect: [ :repo | repo origin projectName = projectName ]
ifNone: [ self fail: 'Could not find repository for project: ', projectName ].

self assert: (repository loadedCode loadedVersions noneSatisfy: [ :version | version isKindOf: IceForeignVersion ]).
self assert: ((repository loadedCode versionFor: (repository packageNamed: packageName)) isKindOf: IceSavedPackageVersion ).
self assert: repository incommingCommits isEmpty.
self assert: repository outgoingCommits isEmpty.

repository loadedPackages do: [ :package |
self assert: package incommingCommits isEmpty.
self assert: package outgoingCommits isEmpty
].
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
auxiliar
theTestClass
^ Smalltalk at: #Test
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
walking
includesCommit: aCommit
self commitsDo: [ :commit |
commit id = aCommit id ifTrue: [ ^ true ]].
^ false
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
walk definition
uptoBranch: anIceBranch
self uptoCommit: anIceBranch lastCommit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
walk definition
uptoBranches: branches
^ branches do: [ :branch | self uptoBranch: branch ]
33 changes: 16 additions & 17 deletions Iceberg.package/IceAbstractModel.class/instance/highlight..st
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
highlighting
highlight: aString
"entity could be a repository or a package"
[
| text modified incomming outgoing |
text := Text fromString: aString.

| text modified incomming outgoing |
text := Text fromString: aString.
self repository isMissing ifTrue: [ ^ text allBold; makeAllColor: self colorError ].
self isLoaded ifFalse: [ ^ text makeAllColor: self colorNotLoaded ].

self repository isMissing ifTrue: [ ^ text allBold; makeAllColor: self colorError ].
self isLoaded ifFalse: [ ^ text makeAllColor: self colorNotLoaded ].
modified := entity isModified.
incomming := self incommingCommits notEmpty.
outgoing := self outgoingCommits notEmpty.

modified := entity isModified.
incomming := self incommingCommits notEmpty.
outgoing := self outgoingCommits notEmpty.
modified ifTrue: [ text prepend: '* ' ].
modified | incomming | outgoing ifTrue: [ text allBold ].

modified ifTrue: [ text prepend: '* ' ].
modified | incomming | outgoing ifTrue: [ text allBold ].

modified ifTrue: [ ^ text makeAllColor: self colorModified ].
incomming ifTrue: [ ^ text makeAllColor: self colorIncomming ].
outgoing ifTrue: [ ^ text makeAllColor: self colorOutgoing ].
^ text

"Color darkGray"
modified ifTrue: [ ^ text makeAllColor: self colorModified ].
incomming ifTrue: [ ^ text makeAllColor: self colorIncomming ].
outgoing ifTrue: [ ^ text makeAllColor: self colorOutgoing ].
^ text
]
on: Error do: [ ^ aString ]
3 changes: 3 additions & 0 deletions Iceberg.package/IceAbstractModel.class/instance/isLoaded.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
testing
isLoaded
self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
accessing
testing
isMissing
^ self repository isMissing
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
accessing
testing
isOperative
^ self repository isMissing not
3 changes: 3 additions & 0 deletions Iceberg.package/IceAbstractModel.class/instance/repository.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
repository
self subclassResponsibility
30 changes: 16 additions & 14 deletions Iceberg.package/IceAbstractModel.class/instance/status.st
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
accessing
status
"entity could be a repository or a package"

| status incomming outgoing |
self repository isMissing ifTrue: [ ^ 'Local repository missing' asText allBold makeAllColor: self colorError ].
self isLoaded ifFalse: [ ^ 'Not loaded.' ].

status := OrderedCollection new.
entity isModified ifTrue: [ status add: 'Uncommited changes' ].

incomming := self incommingCommits size.
incomming > 0 ifTrue: [ status add: ('{1} incomming' format: { incomming })].

outgoing := self outgoingCommits size.
outgoing > 0 ifTrue: [ status add: ('{1} not published' format: { outgoing })].
[
| status incomming outgoing |
self repository isMissing ifTrue: [ ^ 'Local repository missing' asText allBold makeAllColor: self colorError ].
self isLoaded ifFalse: [ ^ 'Not loaded.' ].

^ status ifEmpty: 'Up to date' ifNotEmpty: [ ', ' join: status ]
status := OrderedCollection new.
entity isModified ifTrue: [ status add: 'Uncommited changes' ].

incomming := self incommingCommits size.
incomming > 0 ifTrue: [ status add: ('{1} incomming' format: { incomming })].

outgoing := self outgoingCommits size.
outgoing > 0 ifTrue: [ status add: ('{1} not published' format: { outgoing })].

^ status ifEmpty: 'Up to date' ifNotEmpty: [ ', ' join: status ]
]
on: Error do: [ :error | ^ error description asText makeAllColor: self colorError ]

1 change: 1 addition & 0 deletions Iceberg.package/IceAbstractVersion.class/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Base class for different types of versions, namely: IceVersion (normal versions) and IceForeignVersion (versions not managed by Ice).
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
instance creation
package: package
forPackage: package
^ self new package: package; yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
as yet unclassified
beCurrent
"By default do not to anything, version should have a package manager that makes them current without Iceberg intervention."
3 changes: 3 additions & 0 deletions Iceberg.package/IceAbstractVersion.class/instance/updated.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
patches
updated
^ self
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
patches
updatedVersion
^ self
14 changes: 14 additions & 0 deletions Iceberg.package/IceAbstractVersion.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "Iceberg-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "NicoPasserini 10/20/2016 15:48",
"instvars" : [
"package" ],
"name" : "IceAbstractVersion",
"pools" : [
],
"super" : "Object",
"type" : "normal" }
29 changes: 0 additions & 29 deletions Iceberg.package/IceBranch.class/instance/addCommit..st

This file was deleted.

3 changes: 1 addition & 2 deletions Iceberg.package/IceBranch.class/instance/commits.st
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
commits
commits
self ensureCommitsLoaded.
^ commits
^ self repository newCommitWalk fromBranch: self; commits
5 changes: 4 additions & 1 deletion Iceberg.package/IceBranch.class/instance/commitsNotIn..st
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
commits
commitsNotIn: anotherBranch
^ self commits copyWithoutAll: anotherBranch commits
^ self repository newCommitWalk
fromBranch: self;
uptoBranch: anotherBranch;
commits

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
commits
includesCommit: commit
^ self commits includes: commit
^ self lastCommit isDescendantOf: commit
5 changes: 5 additions & 0 deletions Iceberg.package/IceBranch.class/instance/incommingCommits.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
commits
incommingCommits
^ self upstream
ifNotNil: [ self upstream commitsNotIn: self ]
ifNil: [ #() ]
4 changes: 0 additions & 4 deletions Iceberg.package/IceBranch.class/instance/loadCommits.st

This file was deleted.

3 changes: 3 additions & 0 deletions Iceberg.package/IceBranch.class/instance/outgoingCommits.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
commits
outgoingCommits
^ self outgoingCommitsWalk commits
10 changes: 10 additions & 0 deletions Iceberg.package/IceBranch.class/instance/outgoingCommitsWalk.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
commits
outgoingCommitsWalk
| walk |
walk := self repository newCommitWalk fromBranch: self.
self upstream
ifNotNil: [ walk uptoBranch: self upstream ]
ifNil: [ walk uptoBranches: (
self repository localBranches copyWithout: self) ].

^ walk.
5 changes: 0 additions & 5 deletions Iceberg.package/IceBranch.class/instance/ownCommits.st

This file was deleted.

2 changes: 1 addition & 1 deletion Iceberg.package/IceBranch.class/instance/refresh.st
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
private
refresh
commits := nil.
upstream ifNotNil: #refresh.
versionDictionary := Dictionary new.
Loading

0 comments on commit 6acc5ab

Please sign in to comment.