GithubHelp home page GithubHelp logo

hpi-swa / squot Goto Github PK

View Code? Open in Web Editor NEW
58.0 9.0 29.0 7.92 MB

Squeak Object Tracker - Version control for arbitrary objects, currently with Git storage

License: Other

Smalltalk 99.99% StringTemplate 0.01%
smalltalk squeak git version-control version-control-system object-tracking versioning

squot's Introduction

Squot CI Windows Build Status

Squeak Object Tracker - Version control for arbitrary objects in Squeak, currently with Git storage

This repository also contains a variant of the FileSystem library, which is an alternative to the FileDirectory API and has replaced the latter in Pharo. However, our version of the FileSystem library descends from the last version of it for Squeak and is not compatible with Pharo's FileSystem classes.

The package that provides Git connectivity for Squot is named Squit. It uses the package FileSystem-Git (also included here) to browse and manipulate Git repositories.

Installation instructions

For Squeak 5.2 (and newer) just evaluate the following snippet:

Installer installGitInfrastructure.

For older images, make sure that you have system updates newer than 2017-03-12. The image's version number should be at about 17037 or higher.

There, install the latest Metacello first. Then, use the following snippet to load Squot and all its dependencies:

Metacello new
  baseline: 'Squot';
  repository: 'github://hpi-swa/Squot:latest-release/src';
  load.

Usage instructions

After installing Squot, you will find a "Git Browser" in the Apps menu. With this tool you can create projects (in-image working copies) that can contain multiple objects, including packages. Each object is stored at or under a path. When you checkout the Git repository in the file system, an object's path is its relative path in the working copy. From the Git Browser, you can create new commits, synchronize with remote repositories (fetch, pull, push), manage and merge branches, switch between them, and compare different versions.

Getting Started with an Existing Remote Project

  1. Open the Git Browser. Depending on your Squeak version, you can find it under Apps or under Tools. If this is the first time you open it, it might ask you whether you want to add your first project now. You can decline for now, as we do not want to add a new (empty) project.

  2. The pane at the top left pane is the list of projects which are currently managed through Squot. We will now clone an existing project by opening the context menu of the list and selecting either "Clone Project" directly or "New project..." > "Clone Project".

  3. A wizard opens which will guide us through the steps to clone the project.

  4. First, it asks for an URL to clone from. We use the https URL of our repository for that. For Github projects you can find the https URL on the project main page after clicking on the button labeled "Clone or download" (You might have to select "Use HTTPS").

  5. Second, we can enter a project name which helps us remember our project. It will be displayed in the projects list.

  6. Third, we have to select a folder in which Squot can store the Git repository. You should create a dedicated folder for that even if you will not work with the working copy in the filesystem.

  7. We have now provided all necessary details and Squot will go ahead and clone the project for us.

  8. As soon as Squot finished cloning, we have the repository on the disk and registered in the system, but we do not yet have the objects loaded from the repository into Squeak. For that to happen, we have to click on "Checkout objects" in the context menu on the topmost commit in the list of commits, which is the pane on the top right of the git browser.

  9. We are now presented with a list of changes to be loaded through the checkout. If you have no special requirements for loading the packages, you can simply click the "accept" button.

  10. After a short loading time, the objects are now loaded in the system. If the repository stored packages, you can now start browsing your code.

Committing to a Project

  1. Before committing, first check whether you are on the branch you do want to commit to in the list of branches.

  2. Then simply click the button labeled "commit".

  3. You will be presented with a list of changes that would be included in the commit. By unfolding the changes and opening a context menu on each individual change you can choose to exclude the change from the commit.

  4. After reviewing the changes you can enter the commit message in the text box at the bottom.

  5. You can use a button on the right of the message text box to select pre-defined co-authors to mention in the commit message. To define the available authors, simply edit CoAuthorList class#default

  6. When you are happy with the commit, you simply finish it by pressing the "commit" button.

Notes on Pushing to Github

Please note that when you push to Github and you have two-factor-authentication activated, you can not use your ordinary password. You will have to generate a personal access token in the corresponding settings page. When Squot asks you for the password of the remote, enter the personal access token instead.

Details on the Inner Workings of Squot

Internally, Squot uses an ImageStore to remember objects (including packages) that should be tracked. A WorkingCopy combines such a store with a repository, for example a SquitRepository (a Git repository).

Terminology note: Squot is based on an abstraction for version control systems named Pur. It coins the name "Historian" for label-based branches, such as Git's head references.

workingCopy := SquotWorkingCopy new.
workingCopy store: SquotImageStore new.
workingCopy repository:
  (SquitRepository onDirectory: FileSystem disk / 'path' / 'to' / 'your' / 'repository.git').
workingCopy loadedHistorian: (workingCopy repository historianNamed: 'master').
workingCopy add: (PackageInfo named: 'YourPackage') at: 'src'.
workingCopy add: (PackageInfo named: 'AnotherPackage') at: 'src'.
workingCopy add: anyObject at: 'objects/myObject'.
workingCopy saveNewVersionInteractively.
workingCopy loadCurrentVersionInteractively.

Note that Monticello versions will be created in the package cache repository whenever you save a new version (commit) that modifies the code of a package. These were originally for backup purposes until Squot and Squit became sufficiently stable.

Converting Monticello history

A converter and a verifier for the created versions is included.

repository := SquitRepository onDirectory: FileSystem disk / 'path' / 'to' / 'your' / 'repository.git'.
packageName := 'FileSystem-Git'.
historianName := 'refs/heads/import-fsgit'.
SquotMonticelloConverter
  convertUpToLoadedVersionOfPackageNamed: packageName
  asHistorianNamed: historianName in: repository.
SquotMonticelloConverterVerifier
  verifyVersionsOf: (repository historianNamed: historianName)
  ofLoadedPackageNamed: packageName.

Goodies

Because Squot does not yet include a nice visualization of the commit graph, you may want to create a button that opens gitk or another program on the repository.

Here a do-it for Windows users (requires OSProcess):

OSProcess command: 'cmd /C start /D "', (squitRepository gitRepository repository baseDir pathString), '" gitk --all'.

Squot and Metacello

Due to the way Metacello handles versioning of Smalltalk projects, projects that are managed with Squot by default cannot be upgraded using Metacello.

To fix this, add the following code to your BaselineOf:

projectClass
  ^ Smalltalk
    at: #MetacelloCypressBaselineProject
    ifAbsent: [super projectClass]

Your project can then be upgraded using the same code used to install it.

squot's People

Contributors

codezeilen avatar corinnaj avatar fniephaus avatar j4yk avatar leonbein avatar leonmatthes avatar linqlover avatar marceltaeumel avatar shirleynekodev avatar tom95 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

squot's Issues

Cannot fetch from remote

When I click fetch, I get an "Unknown stream code 32" error in readSideBandResponseIfData:ifMessage:ifError:ifZero:.
Also, I get an ConnectionClosed error when trying to submit feedback.
However, WebClient httpGet: 'https://google.com' works as intended. Not sure what is going on...

Squot-Update Button in the UI

There should be a button in the UI to temporary clone the Squot repo and load the latest master version from it, so the SWE students can easily update Squot&Co.

The other path would be to package Squot&Co. as Monticello versions and provide those via the update stream. This would need at least a simple GitCommit --> MCVersion(s) conversion.

Merge menu items

Author: Fabio Niephaus

Message:
Add menu items for merging to branch and commit list

Sort object list

Author: Fabio Niephaus

Message:
This would help reading the list

Adding a new package does not seem to work

Create a new class and add it to some new category. Then start a new project in the GitBrowser. Currently, you cannot add the category, because it does not appear in the package list. In my current image, I have replaced this list with the same list the Browser displays. However, when I add the newly created category, a new commit is empty. Have tried different things, can't get it working

Cannot push

(NeedGitCredentials for: url) signal does not do anything in my image.
Where do I have to add my credentials?

Keep a reflog for each SquotWorkingCopy that uses Squit

Since we do not use a traditional git working copy, there is no reflog for HEAD. To not lose track of what is being checked out or committed in in-image working copies, a reflog should be created for each working copy in the image.

How to name this reflog? Should there also exist a symbolic reference for this working copy? Look up how Gitless stores its heads (one per branch).

Ensure HTTP(S) is used

Author: Fabio Niephaus

Message:
Since Squot does not support git+ssh at the moment, it would be good to somehow ensure a user can only enter HTTP(S) URLs.

Add commit list menu entry that updates the loaded branch to the selected commit

Should be labelled "reset to this commit".

Do not touch the object memory, only do loadedHistorian version: theSelectedSquitVersion, to move the ref. This can be used to manually fast-forward the master to a remote tracking branch (origin/master), until a proper merge operation (with fast-forward capability) is implemented.

Add feedback button

Author: Fabio Niephaus

Message:
It would be great to be able to provide feedback straight from the UI. Maybe you can find someone to add this feature for you, while you are busy implementing more important features... ;)

Choose from which remotes to fetch

Author: Fabio Niephaus

Message:
Instead of fetching from all remotes, the user could be ask from which remote to fetch when clicking the Fetch button. Everything could be selected in the list by default, so one also needs to click ok to fetch from all

Keep untracked files when merging

Untrack files also need to be merged into a branch.
Currently, "untracked" changes on a feature branch get lost when the branch is merged.

Design API for diffs

Working with diffs instead of whole snapshots should speed up regular operations such as saving new versions.

MNU when pushing first commit

Author: Fabio Niephaus

Message:
Start a new project, add first commit, then push. This results in a MNU UndefinedObject>>parents in GitHistoryWalker>>visitCommit:. Apparently, the commit is nil...

Test

Author: Fabio Niephaus

Message:
Test

GitHub may close the connection on pushes

I did push successfully twice to GitHub with FileSystem-Git today, but for some sets of commits, GitHub simply closes the connection after receiving a part of the pack content. For the same set of commits, both a local test server and Bitbucket accepted the push without issues.

Have to keep an eye on this to find out what is the cause.

Under Windows, file handles stay open even though the FSHandle instances are closed

Inspecting the VM process with Process Explorer revealed that the file handles for pack files stay open, even though the corresponding FSHandle instances are already garbage collected or closed, as far as the object memory is concerned.

@fniephaus can you please check if the same is true for Mac OS? Just work a while in your image and check the process after some git operations.

Snippets to find (officially) open files:

FSStream allSubInstances select: [:ea | (ea instVarNamed: 'handle') reference filesystem = FileSystem disk]

FSFileHandle allInstances select: [:ea | ea isOpen]

The tools to inspect the actually open file descriptors or handles vary by OS, of course.

Much garbage collection going on during history walks

During history walking, a lot of time is spent in the garbage collector. The code should be investigated to find places where objects can be reused or where objects are created unnecessarily. Also consider more aggressive caching.

File system errors

Author: @fniephaus

Message:
I am getting a lot of DirectoryDoesNotExist and Unable to open ... errors. Interestingly, it seems to be working for a short period of time. Once one of these errors occur, all future file system access operations fail. Reopening the image seems to "fix" this, but I'm getting an error again, as soon as I try to commit something :(

Cache pack file references during operations

While it is mandatory to allow the set of pack files to change over time, rediscovering them over and over during an operation such as walking the history is unnecessary. There should be a way to delimit an operation and cache the pack file references and the pack index files' content during that operation.

Use TreeView in Commit Dialog

A tree view would work well in the commit dialog.
It could be used to display per method changes per class. Maybe, you can also find a way to display all changes for a class or even one big diff for everything.

Packing the repository is broken

The resulting packfile is corrupt.

Workaround: do not pack the repository with FileSystem-Git. Use the regular git client instead.

Creating the packfile for push takes too much time

GitHub terminates the connection if nothing is supplied quickly enough. Pushing the first 361 commits of this repository did not work with FileSystem-Git. I had to use the non-Smalltalk git client instead.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.