[Pharo-users] Iceberg - finding deleted classes, reverting versions?

Guillermo Polito guillermopolito at gmail.com
Wed Jun 20 04:39:44 EDT 2018


On Thu, Jun 14, 2018 at 10:17 AM Tim Mackinnon <tim at testit.works> wrote:

> Hi Guille - I have tried the repo browser with the new iceberg loaded in
> Pharo 6.1 and I couldn’t see how it helps me? (I will make a firm point of
> using 7 now as I think I’ve now got a reasonable grasp of how things should
> work).
>
>From the threads below - how would I find the commit with my missing class
> - Sean has pointed me to a git query that helps with that (and presumablyq
> is something we can plug into iceberg - maybe I will even take a look).
>

> git log --full-history -- */{{className}}.class/properties.json

Yes, this is definitely *doable* but nobody made the effort to do it yet.
Doing it well should take into account what format the code is stored
(filetree/tonel) and consider that the format would have changed in the
middle of the history.
If somebody wants to give it a try I can give some advice.


>
> Having identified the hash with the class I want - getting to it is
> awkward (there is no search - again pretty easy for us to plug in, but
> something to do)
>

Yes, I've found this issue that also in the past. It's not common to me to
be looking for a commit like that, and when it is the UI is cumbersome.
>From the backend, you can always inspect the repository and do

repository lookupCommit: aCommitishString

For example:

repository lookupCommit: '726254360c987b9b3472a6098b5869970e819cc9'


> Having got to my commit - how can I retrieve one class? Maybe this is
> something only in Pharo 7 with Calypso? All I can see are diffs - so I’d
> have to copy and paste 20 methods and a class def. doable,  but painful.
> I’m hoping there is a way to get a shadow copy of the commit from the tonel
> file and then use it to restore classes and methods? As this sounds like a
> decent chunk of work, I’m guessing it’s not done yet?
>

Well on the items of the diff you have a "Revert change" option. That
should work on most of the cases.
I know that it would be also useful to be able to easily browse a commit.
I've opened an issue.

https://github.com/pharo-vcs/iceberg/issues/872

For the moment what I do from the backend (inspecting):

aCommit fileSystem

and you'll get a file system on the commit. So you'll see the exact files
of the commit but "uniterpreted". That is, packages will be seen as
repositories and not as packages.


>
> As a fallback, Any thoughts on why git won’t let me checkout a file from
> that commit? Something about the pathspec (is it mangled in some way)?
>

I don't quite understand. Can you paste here your command?


> And if I could restore a tonel file - would iceberg then recognise it to
> bring it back in,
>

Nope, Iceberg never reads from the disk working copy. Iceberg reads
directly from te blob.


> or Would I need to use some filestream foo to do that (as this would at
> least be a viable workaround for now)?
>

You can try to read it using Tonel? I don't know exactly how to use tonel
directly, I'll let others answer better.


>
> Tim
>
> Sent from my iPhone
>
>
>
> Sent from my iPhone
> On 14 Jun 2018, at 08:52, Guillermo Polito <guillermopolito at gmail.com>
> wrote:
>
> Hi,
>
> Regarding history, right now we have a history browser implemented as a
> Calypso plugin, that is open using context menu => history or the little
> box button on the top right of the method pane (second button from the left
> in the picture):
>
> <Screen Shot 2018-06-14 at 09.34.24.png>
>
> That button will nowadays only be shown if the method's package is linked
> to an iceberg repository.
> Once you click it, you will have the entire history of the method.
>
> <Screen Shot 2018-06-14 at 09.47.46.png>
>
> With the possibility to install that version of the method (among others).
>
> Now, regarding the recovery of deleted classes/methods, have you tried the
> repository browser?
> Go to Iceberg, right click on a repository and select "Repository".
> You can there select a commit in history and then in the tabs below see
> the diff between
>  - your current version and the selected commit
>  - the selected commit and its main parent
>
> Of course any of these can be improved, but if you have concrete requests,
> it is much easier :)
>
> https://github.com/pharo-vcs/iceberg
>
> Guille
>
> On Wed, Jun 13, 2018 at 11:22 PM Tim Mackinnon <tim at testit.works> wrote:
>
>> Hi Sean - I tried it again, and it worked:
>>
>> git log --full-history -- */PrismicBlock.class*
>>
>> (I got my wildcard slightly wrong for tonel format) - although the beauty
>> of the one I gave was that it shows you all deleted classes (in case you
>> don’t know the name)
>>
>> I’m still confused why I can’t checkout the deleted class though - damn
>> you git, for the cryptic error: : error: pathspec 'PrismicDemo/
>> PrismicBlock.class.st' did not match any file(s) known to git.
>>
>> I was hoping a quick hack to iceberg might be to OSProcess a few choice
>> git commands to help us along while we work out better ways to do things.
>>
>> Tim
>>
>> On 13 Jun 2018, at 21:53, Sean P. DeNigris <sean at clipperadams.com> wrote:
>>
>> Tim Mackinnon wrote
>>
>> I didn’t quite get your fu to work
>>
>>
>> Interesting.
>>
>> When I searched for commits affecting the deleted class SuDebianKey:
>>
>> $ git log --full-history -- */SuDebianKey.class/properties.json
>>
>> I got back a list of commits (obviously with the last chronologically
>> being
>> the deletion):
>>
>> commit a38fbced4abec59ff9879d4c607da80dc89b6637
>> Author: Sean DeNigris <sean at Seans-MBP.home>
>> Date:   Mon Jan 30 17:13:58 2017 -0500
>>
>>    Extract Lots to ComputerWorld, Absorb Rest of Old ScriptingBase Project
>>
>> commit 61175745d57c60a1707d5e2f9a2fc92e6c19a6ea
>> Author: Sean DeNigris <sean at clipperadams.com>
>> Date:   Sat Aug 20 17:14:12 2016 -0400
>>
>>    Basket O' Enhancements
>> ...
>>
>>
>>
>> -----
>> Cheers,
>> Sean
>> --
>> Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
>>
>>
>>
>
> --
>
>
>
> Guille Polito
>
> Research Engineer
>
> Centre de Recherche en Informatique, Signal et Automatique de Lille
>
> CRIStAL - UMR 9189
>
> French National Center for Scientific Research - *http://www.cnrs.fr
> <http://www.cnrs.fr>*
>
>
> *Web:* *http://guillep.github.io* <http://guillep.github.io>
>
> *Phone: *+33 06 52 70 66 13
>
>

-- 



Guille Polito

Research Engineer

Centre de Recherche en Informatique, Signal et Automatique de Lille

CRIStAL - UMR 9189

French National Center for Scientific Research - *http://www.cnrs.fr
<http://www.cnrs.fr>*


*Web:* *http://guillep.github.io* <http://guillep.github.io>

*Phone: *+33 06 52 70 66 13
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20180620/81d73ee6/attachment-0001.html>


More information about the Pharo-users mailing list