-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #396: UndefinedObject errors when switching away from orphaned br…
…anch Treat the non-existent version of the orphaned branch like an empty project. Object merging without a base is #notYetImplemented, hence I had to resort to a package rather than a ValueHolder in the test case. SquotFileTestHistorian could not accept nil as a version (here for the stash historian for unsaved changes); have it delete the historian when the version is set to nil.
- Loading branch information
Showing
7 changed files
with
37 additions
and
5 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
src/Squot.package/SquotFileTestHistorian.class/instance/version..st
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,5 +1,6 @@ | ||
Pur historian | ||
version: aVersion | ||
aVersion ifNil: [^ self delete]. | ||
self file writeStreamDo: | ||
[:stream | | ||
stream nextPutAll: aVersion internalId]. |
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
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
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
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
28 changes: 28 additions & 0 deletions
28
src/Squot.package/SquotWorkingCopyTest.class/instance/testSwitchAwayFromOrphanedBranch.st
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
tests branch switching | ||
testSwitchAwayFromOrphanedBranch | ||
| class trackedObject existingHistorian orphanedHistorian | | ||
"given" | ||
repository withUnitOfWork: | ||
[self suppressChangeNotificationsDuring: [class := classFactory newClass]. | ||
class compileSilently: 'a ^ #originalReturnValue' classified: 'will not be changed'. | ||
trackedObject := self addPackage. | ||
workingCopy saveVersionWithMessage: 'initial version'. | ||
existingHistorian := workingCopy loadedHistorian. | ||
orphanedHistorian := repository historianNamed: 'newHistorian'. | ||
workingCopy | ||
loadedHistorian: orphanedHistorian; | ||
loadedVersion: nil. | ||
"when" | ||
self suppressChangeNotificationsDuring: [workingCopy switchTo: existingHistorian]. | ||
"then" | ||
self assert: class new a == #originalReturnValue. | ||
|
||
|
||
workingCopy | ||
loadedHistorian: orphanedHistorian; | ||
loadedVersion: nil. | ||
"when" | ||
self suppressChangeNotificationsDuring: | ||
[workingCopy switchAndMoveUnsavedChangesOverTo: existingHistorian]. | ||
"then" | ||
self assert: class new a == #originalReturnValue]. |
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