How to revert to old commit using mercurial

As the title says, how can I revert / switch to an older commit? I can find the history page and manually see every change, but what if I want to use an older version and continue from there again? I must be stupid, but I can’t find it anywhere. Also went through the documentation, I can find how I make new commits, but not how I revert back to old ones.

Hello Erik,

  • Select your project in the Program Workscpace.
  • In the Program Details (on right side of the screen) select the Summary tab.
  • Click on the Revisions button (in the middle of that tab).
  • Select the revision you want to revert to and click on the Switch button.

But hurry up because the online compiler is going to retire on December 31, 2022 ! :slightly_frowning_face:

Ah sorry I wasn’t clear. I meant in Keil Studio. In the old mbed online compiler it is straight forward enough :slight_smile:

So I did move everything to Keil, and while it clearly has more advanced features than the old one, some stuff I am still missing. Eg also what about pushing code to the mbed website? Not that I am directly plannign to do it again, but I also cannot find out how to do it. Or is that going to be deprecated too? Which would imo truly be a shame, not having to program everything from scratch was the main point of mbed.


from my understanding the KSC library manager works only with Branches, so if you have just several commits to master, then is not possible in the KSC right now and hard to say if it will ever happen.

There are also more issues like Using KSC to migrate mercurial project and libraries to git - Keil Studio / Migrating from Online Compiler - Arm Mbed OS support forum

Few days ago there were similar question and official answer was something like “That is not in the plan right now”. But I also remember somewhere were recommended to use github for the future.

So if some old revisions are essential for you, you have to do it manually.
It is also possible to clone the old repositories to your local disk via TorstoiseHG app. With this, you will also keep the revisions.

BR, Jan

Ouch. Well thanks for the answer, even though it was not the one I was hoping for. Whole point of making commits seems to me to be able to revert to them.

And I suppose I have missed a lot, so I also cannot complain too much, maybe it is just my limitted understanding now, but the old mbed had as selling point being able to rapidly prototype. And that is of course more than having a blinky LED program. With the right community libraries you could have eg a program write accelerometer data to an LCD screen in minutes. If you have to write everything from scratch yourself…
And of course Github is nice, but it would be nice as secondary option. Having to search Github in the hope someone might have posted some mbed compatible code there is not the same as directly importing from the site here, and also sharing your code for other to use.

1 Like

Yeah, you are right with your opinion.

About the github and community libraries I had an idea and I wanted to talk about it, but I was only one probably - Components and Libraries - Meta - Arm Mbed OS support forum

I do not know how it worked in the past, I joined Mbed community in 2017, but yes Mbed is changed. The community is weak (only few people), development has been standing for one year, and newcomers are usually too lazy to read anything, let alone do anything. This and much more led to a downfall - no new libraries, very weak maintaining already existing libraries and so on.
Also why when there is every time much simple solution. Patformio or Arduino (also a variant with Mbed under hood) do everything without knowledge of anything.

BR, Jan

Your idea seems to be the one to make the best of a questionable situation. And of course there is only so much the mbed team can do about the lack of community engagement, on the other hand imo around the time I left there were also some decissions that imo didn’t help.

The mbed core is imo setup waaayyyyyy better than Arduino, they have too many legacy issues. But yeah the community is not comparable. But removing the option to easily share and re-use code between users for sure is not going to improve that.

We are looking at how to “switch the source control context” in Keil Studio Cloud so that you can carry out source control actions against repos within a repo (e.g. a library within a project). This would allow publishing, history etc. for libraries.

finding the right libraries is in fact more difficult than in the Arduino Ecosystem. In mbed-os2 with the online compiler and the mbed website it was more sane. Now with the matured mbed 5/6 it is not so easy to find libs that work out of the box, even in mbed5 were a lot of changes and not always compatible.
Anyway, I prefer also Mbed because there are more things for program structure built-in, e.g. threads, EventQueue, Storage and much more. And in may cases it is not difficult to modify Arduino libs to use them with Mbed. You will also find some flaws, e.g. AVR had no double fp but many fp vars are declared as double, or constants like 3.14 evaluate to double. That is expensive unless you need double or have a FPU that can process doubles.
At least, the support for the online compiler still exists. But I’m not sure how important this is nowadays. Also due to Corona, many schools have upgraded Computer equipment. For private projects, I do not see a use case for online compiling. Github, a private gitlab server or now gitea as lightweight git-server help me to centralize my source code or make it available for teams.

That sounds good. However NOFI, but isn’t that somewhat late considering the online compiler gets phased out in 2 weeks time? If it takes months or even years before the compiler can work again with the code on the website (both pushing and pulling), then by that time no one will bother with it anymore.

After my time mainly, but sounds like it should be possible to list compatibility of libraries, and also (maybe with some precompiler directives) have people make them compatible with both. And if the community does this of course you have no guarantees whatsoever, but at least people can work with it.

It just works.

But even regardless of online compiling, you would still want one place where you can share and look up code. And Github is imo not nearly as suitable for it. Eg if you got a bunch of students working with an STM32 and they want to use an LCD display. Nothing special, but complicated enough you really don’t want to write your own code from scratch for it, if it is just a part of the main project. Then these students should just be able to get the code from here. If the answer of their teacher is they can download Arduino code and modify it to run on mbed, they will very quickly ask why not just run Arduino directly on their STM32.

Of course now the LCD code is still available. But that is because of how it was setup in the past. If that is changed, eventually you won’t have working code anymore.

If you use PlatformIO IDE (Arduino OS), you would probably not bother with Keil Studio. I have only used the ESP32 device here. I needed a quick event driven WiFi solution with built in OTA firmware updating and Mbed unfortunately did not have it.
But low resource targets used to be good on Mbed, I can’t get STM32F103 to work on Keil Studio where it does still work on the original Mbed compiler until its switched off.
There is also the issue where the Mbed project has been mothballed with no recent updates, unless that’s changed.

Hey Paul, you I remember :smiley:

Hi Erik, nice to see you back here!
As usual I got it wrong again, the STM32f103 does indeed work on Keil Studio, I was supposed to be compiling for STM32f030 :roll_eyes:
I don’t work so much with the smaller targets and have been using Mbed Studio, almost identical to Keil Studio but annoyingly no Mbed os2 support.
So far all the small targets do work fine on os2 and a much better IDE apart from IntelliSense warnings and your WakeUp library still works :slightly_smiling_face:
Both Keil Studio and Mbed Studio are in my mind by far the best overall IDE.

Not a perfect solution, but we’ve just released an update so that you can set any folder as the “active project”, which means you can:

  • Clone a library into Keil Studio Cloud, including any library from (file > clone…)
  • Optionally convert the library to git and retain the history (forked on GitHub)
  • Manage the SCM for that library, e.g. reverting a commit
  • Add the library to your project using “add Mbed library”

This should give people who publish libraries a workaround.

It will take longer to implement support for source control within projects, as you effectively have multiple mixed git or mercurial repositories within a parent git or mercurial repository.

That sounds like a good first step, but will that also include direct links to the repositories on the website? Or just via eg Github?

If you clone a repo (e.g. a library) from that you have admin access to then yes, you can interact with it directly from Keil Studio Cloud.