The Inbox: Monticello-mt.633.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Monticello-mt.633.mcz

commits-2
Marcel Taeumel uploaded a new version of Monticello to project The Inbox:
http://source.squeak.org/inbox/Monticello-mt.633.mcz

==================== Summary ====================

Name: Monticello-mt.633
Author: mt
Time: 12 May 2016, 6:07:39.136671 pm
UUID: 1b562f44-5a2e-e246-9a4f-edac73fc2c54
Ancestors: Monticello-mt.632

Adds a directory repository with support for a relative path. This allows more copying images and files around while keeping Monticello working. The path is relative to "FileDirectory default".

=============== Diff against Monticello-mt.632 ===============

Item was changed:
  ----- Method: MCDirectoryRepository>>allFileNames (in category 'accessing') -----
  allFileNames
 
+ ^self directory entries
- ^directory entries
  sort: [ :a :b | a modificationTime >= b modificationTime ];
  replace: [ :ea | ea name asMCVersionName ]!

Item was changed:
  ----- Method: MCDirectoryRepository>>description (in category 'accessing') -----
  description
+ ^ self directory pathName!
- ^ directory pathName!

Item was changed:
  ----- Method: MCDirectoryRepository>>hash (in category 'comparing') -----
  hash
+ ^ self directory pathName hash!
- ^ directory pathName hash!

Item was changed:
  ----- Method: MCDirectoryRepository>>isValid (in category 'accessing') -----
  isValid
+ ^ self directory exists!
- ^directory exists!

Item was changed:
  ----- Method: MCDirectoryRepository>>readStreamForFileNamed:do: (in category 'accessing') -----
  readStreamForFileNamed: aString do: aBlock
  | file val |
+ file := FileStream readOnlyFileNamed: (self directory fullNameFor: aString).
- file := FileStream readOnlyFileNamed: (directory fullNameFor: aString).
  val := aBlock value: file.
  file close.
  ^ val!

Item was changed:
  ----- Method: MCDirectoryRepository>>writeStreamForFileNamed:replace:do: (in category 'accessing') -----
  writeStreamForFileNamed: aString replace: aBoolean do: aBlock
  | file sel |
  sel := aBoolean ifTrue: [#forceNewFileNamed:] ifFalse: [#newFileNamed:].
+ file := FileStream perform: sel with: (self directory fullNameFor: aString).
- file := FileStream perform: sel with: (directory fullNameFor: aString).
  aBlock value: file.
  file close.!

Item was added:
+ MCDirectoryRepository subclass: #MCRelativeDirectoryRepository
+ instanceVariableNames: 'relativePath'
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'Monticello-Repositories'!
+
+ !MCRelativeDirectoryRepository commentStamp: 'mt 5/12/2016 17:39' prior: 0!
+ Path is relative to "FileDirectory default".!

Item was added:
+ ----- Method: MCRelativeDirectoryRepository class>>description (in category 'configuring') -----
+ description
+ ^ 'directory (relative)'!

Item was added:
+ ----- Method: MCRelativeDirectoryRepository>>description (in category 'accessing') -----
+ description
+
+ ^ self relativePath!

Item was added:
+ ----- Method: MCRelativeDirectoryRepository>>directory (in category 'accessing') -----
+ directory
+
+ ^ self isConsistent
+ ifTrue: [directory]
+ ifFalse: [directory := FileDirectory default directoryNamed: self relativePath]!

Item was added:
+ ----- Method: MCRelativeDirectoryRepository>>directory: (in category 'accessing') -----
+ directory: aDirectory
+
+ directory := aDirectory.
+
+ self relativePath: (FileDirectory default relativeNameIfAbsoluteFor: aDirectory fullName).!

Item was added:
+ ----- Method: MCRelativeDirectoryRepository>>isConsistent (in category 'testing') -----
+ isConsistent
+
+ ^ (directory notNil
+ and: [(FileDirectory default relativeNameIfAbsoluteFor: directory fullName) = self relativePath])
+ and: [directory exists]!

Item was added:
+ ----- Method: MCRelativeDirectoryRepository>>relativePath (in category 'accessing') -----
+ relativePath
+
+ ^ relativePath copyReplaceAll: '/' with: FileDirectory slash!

Item was added:
+ ----- Method: MCRelativeDirectoryRepository>>relativePath: (in category 'accessing') -----
+ relativePath: aString
+
+ relativePath := aString copyReplaceAll: '\' with: '/'.!

Item was changed:
  ----- Method: MCSubDirectoryRepository>>allDirectories (in category 'enumeration') -----
  allDirectories
  | remaining dir dirs |
  remaining := OrderedCollection new.
  dirs := OrderedCollection new.
+ remaining addLast: self directory.
- remaining addLast: directory.
  [remaining isEmpty]
  whileFalse: [dir := remaining removeFirst.
  dirs add: dir.
  dir entries
  do: [:ent | ent isDirectory
  ifTrue: [remaining
  addLast: (dir directoryNamed: ent name)]]].
  ^ dirs!

Item was changed:
  ----- Method: MCSubDirectoryRepository>>description (in category 'user interface') -----
  description
+ ^ self directory pathName, FileDirectory slash, '*'!
- ^ directory pathName, FileDirectory slash, '*'!

Item was changed:
  ----- Method: MCSubDirectoryRepository>>findFullNameForWriting: (in category 'as yet unclassified') -----
  findFullNameForWriting: aBaseName
  | possible split prefix fpattern now |
+ split := self directory splitNameVersionExtensionFor: aBaseName.
- split := directory splitNameVersionExtensionFor: aBaseName.
  fpattern := split first, '*'.
  possible := SortedCollection sortBlock: [ :a :b |
  a first = b first
  ifTrue: [ a second = b second
  ifFalse: [ a second < b second ]
  ifTrue: [ a third fullName size < b third fullName size ]]
  ifFalse: [ a first > b first ] ].
  now := Time totalSeconds.
+ prefix := self directory pathParts size.
- prefix := directory pathParts size.
  self allDirectories do: [:dir | | parts dirScore fileScore |
  parts := dir pathParts allButFirst: prefix.
  dirScore := (parts select: [ :part | fpattern match: part ]) size.
  fileScore := (dir entries collect: [ :ent |
  (ent isDirectory not and: [ fpattern match: ent name ])
  ifFalse: [ SmallInteger maxVal ]
  ifTrue: [ now - ent modificationTime ]]). "minimum age"
  fileScore := fileScore isEmpty ifTrue: [ SmallInteger maxVal  ]
  ifFalse: [ fileScore min ].
  possible add: { dirScore. fileScore. dir } ].
  ^ (possible first third) fullNameFor: aBaseName!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Monticello-mt.633.mcz

marcel.taeumel
Hi, there.

Any thoughts on this?

Such relative-path repositories can, for example, be used in all-in-one (or similar) bundles. Right now, we cannot move the VM to another place and expect directory repositories to keep on working if those are kept close to the VM path.

Note that this rather affects an offline scenario.

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Monticello-mt.633.mcz

David T. Lewis
On Fri, May 13, 2016 at 11:43:22PM -0700, marcel.taeumel wrote:

> Hi, there.
>
> Any thoughts on this?
>
> Such relative-path repositories can, for example, be used in all-in-one (or
> similar) bundles. Right now, we cannot move the VM to another place and
> expect directory repositories to keep on working if those are kept close to
> the VM path.
>
> Note that this rather affects an offline scenario.
>

This seems like a reasonable thing to do, and if it helps with packaging
an all-in-one, then it would be good to have it in trunk.

I note that MCRelativeDirectoryRepository has a class comment (thank you)
but most of the other repository types do not. If anyone feels motivated
to add comments to the other classes, that would be a good thing :-)

Dave
 

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Monticello-mt.633.mcz

Chris Muller-3
Relative paths are already supported by underlying FileDirectory, so I
don't see why we should need a new MC repository type for that.

I'm not clear exactly what you want to do..


On Sat, May 14, 2016 at 9:42 AM, David T. Lewis <[hidden email]> wrote:

> On Fri, May 13, 2016 at 11:43:22PM -0700, marcel.taeumel wrote:
>> Hi, there.
>>
>> Any thoughts on this?
>>
>> Such relative-path repositories can, for example, be used in all-in-one (or
>> similar) bundles. Right now, we cannot move the VM to another place and
>> expect directory repositories to keep on working if those are kept close to
>> the VM path.
>>
>> Note that this rather affects an offline scenario.
>>
>
> This seems like a reasonable thing to do, and if it helps with packaging
> an all-in-one, then it would be good to have it in trunk.
>
> I note that MCRelativeDirectoryRepository has a class comment (thank you)
> but most of the other repository types do not. If anyone feels motivated
> to add comments to the other classes, that would be a good thing :-)
>
> Dave
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Monticello-mt.633.mcz

marcel.taeumel
Hi Chris,

how can I create a Directory Repository with Monticello and make it relative to the VM path (resp. FileDirectory default)?

The requirement is that working copies do not lose their repositories if I copy it together with the VM to another place, keeping the relative path stable. Monticello's cache repository hacks in by recreating itself.

Best,
Marcel