Presentations

Using Git on shell.riscos.online (2023): Notes

Using Git on Pyromaniac Shell (2023): Notes

Script and notes

Setup

  • Open an editor window with your GitHub personal token in.
  • Note: At the end, generate a new personal token, or ensure that the token you used expired.

Script

I'm going to demonstrate using git on shell.riscos.online. This is a shared demonstration system which runs RISC OS Pyromaniac. It is accessible with a web browser. RISC OS Pyromaniac includes Git client which works like a RISC OS version of git would work.

Demonstrating git on this system shows how git can be used on RISC OS. This is an Internet accessible system, so if you want to play along, the only thing you will need to do differently is to change the directory you work in.

Open https://shell.riscos.online/ in your browser.

Open the https://shell.riscos.online site

You'll see the system boot up, with information about the modules that have been initialised and some warnings, before we get to the command prompt.

This is RISC OS, so you can do most things that you might expect - but it's a shared system. Anything you leave behind on here will be visible to others. So we'll create a directory with our name so that we're not going to get in anyone else's way - if you're following along, use your own name.

cdir gerph
dir gerph

We need to check out the repository we're going to use.

git clone https://github.com/philpem/LineEditor

Git has downloaded and checked out the sources into the LineEditor directory.

.
dir LineEditor
.

As you can see, we now have some files. We can do a *ex to see that the files have been correctly typed:

ex

There are a few files here with types other than text. You can look at the files if you want - the LESrc file is the BASIC text source for the module. It is best to keep your BASIC files in text form as they are handled better by git, and can be reviewed by others more easily.

In the shell, ctrl-C is escape, and in my browser any control keys which match the editing keys need to be pressed with shift as well. So we can list the source file and press shift-ctrl-c when we're bored.

type lesrc

press shift-ctrl-c to stop

Let's build the module - In this repository we do this by running the !!Release obey file.

!!Release

We can see that there's now a LineEditor module, which was just built:

Info lineeditor
time

We want to make a change to the code, so let's edit the source. RISC OS Pyromaniac has a *Edit command to launch an editor on a file.

*Edit LESrc

This is the nano editor, which let's us edit text files. The key shortcuts are at the bottom of the screen. Ctrl-w is 'where is' to search for strings. I'm going to change the help string for the module.

press ctrl-w to search

enter helpstring

That's not the one I want - so I'll search again.

press ctrl-w to search, and then return to continue the same search

There we go. Now I'll add my change.

add and me to the help string

And we can save with shift-ctrl-x. And then we can built it again, by running the !!Release again.

press shift-ctrl-x to save

!!Release
info lineeditor
time

Yup, that's built the module for us.

Let's load the module and see that it works!

RMLoad LineEditor

Well there are some warnings and they're formatted a little oddly, but not to worry - those warnings are actually wrong, I think. The module system isn't interpreting the help dictionary. But that's a bug I'll fix another day.

help lineeditor

There we go, the module is running and has our change. If we run *Recall we can see that it's remembered the commands... well, the two we typed since the module started.

recall

Ok, so let's see what git makes of this. The git status command shows what files have been changed in the repository.

git status

And we can see that the LESrc file has been changed, but also that it is typed as BASIC text - type FD1. The RISC OS Pyromaniac git client displays all filenames in host format, so that means we get to see these filetypes; this may change in the future. However, when we type the commands at the command line, we use RISC OS filename conventions, just like any other RISC OS command.

We can show what has changed in the file using git diff.

git diff

As you might expect, it shows us the one line that was changed - the red shows the line that was there, and the green shows the line that replaced it. The Pyromaniac git client will translate the original git colours into VDU sequences so that we get colour in RISC OS, just like you would expect from the original git.

We want to create a branch to put this change on. The RISC OS git client will translate branch names from your current alphabet to UTF-8, but whilst it can do that, it's not generally a good idea to give branches non-ASCII names.

git checkout -b add-my-name

Before we can commit anything we need to tell git who we are. The Pyromaniac git client has some defaults set, but we should set these properly so that our changes are correctly attributed.

show Git*
set Git$Committer$Email gerph@gerph.org
set Git$Committer$Name Charles Ferguson

Having set our identity, let's commit our change. We can give just the RISC OS name of the file and it will be translated to native format.

git commit LESrc

You should always explain the changes you made so that it is clear to people in the future what you were doing and why. The first line is a summary of the change, so should be one line that just says what you were trying to do.

Type...

Add my name

My name is now in the Help string.

Press shift-Ctrl-X to exit the editor and save the file, and that change is now committed.

Shft-Ctrl-X to save

We can see the change is present in the history by showing the most recent change.

git show

There's the change we made.

Committing the change here only updates our local repository. To make it available to other people, it is necessary to push the change to the remote repository. However, the remote repository is owned by Phil Pemberton and I don't have permission to push to it. So I need to tell it to push to my fork of this repository. To do that I need to tell git what the remote is. If you're following along you could fork the original repository and then use your new repo's name here:

git remote add fork https://github.com/gerph/LineEditor

And we can show them to see that it has been added:

git remote -v

Now we need to push the new branch to my fork.

git push fork add-my-name

Enter user 'gerph' and 'password'

But... GitHub doesn't allow you to push with a password any more. Fortunately the documentation that's printed there explains how to create a personal access token which you can use to push code. If you have such a token you can use it in place of your password.

I've got a special single purpose token for this repository, because I'm going to paste it here for you to see.

git push fork add-my-name

Enter user 'gerph' Click the Paste UTF-8 button Copy the single purpose token and paste into the new box Click the Paste UTF-8 button

And there we go, the change has been pushed to my remote fork. I can create a pull request by using the URL suggested, if I wanted. The credentials I've just entered won't be stored on the system, so if you need to authenticate you will need to enter these details every time. That's because this is a shared system, and it would be unwise to be giving everyone access to your credentials.

And that's the basics. There's more information about what's supported in *Help Git, and information about Pyromaniac itself can be obtained with *Help PyromaniacFeatures.

Help Git

Thank you for watching and following along.