Here's a quick guide to begin hacking, including how you send your hacks back to the Dragonfly developers when you find them useful.
Getting a local copy of Opera Dragonfly
- First, if you don't already have the Mercurial version control software go to the Mercurial site and download it. It's a really quick and painless installation.
- You need to register with the Bitbucket.org site to easily fork the code and contribute changes back. Signing up is free - go for the 5 users free plan option. (If you just want to hack on a local copy this step is not really required, but isn't half the fun sharing the hacks with other people?)
When those initial setup chores are done, you're ready to create a copy to work on.
- After logging in to Bitbucket, go to the Opera Dragonfly repository home page (or perhaps you prefer the cutting edge experimental one?) and click "Fork". Give your fork a suitable name, for example by including your user name to make it obvious it's your personal playground.
- When the fork is ready, the site tells you what command to use to create a local clone. For example, I clone mine with this command:
hg clone https://firstname.lastname@example.org/hallvors/dragonfly-stp-1-hallvors, but you will naturally have your user name instead of mine. To run this command, use your operating system's command line:
- Open a command line / terminal window
- Go to a suitable folder with the
- Copy the 'hg clone' command from the Bitbucket site, paste it in the command line window and press enter
Mercurial now copies Opera Dragonfly to your computer so that you can play around and make changes.
Using and editing your local copy
Congratulations, now you've got a local copy of Opera Dragonfly. You can explore the folder Mercurial created to see how the files are organised - the source code is inside the src folder, and the main application starting point is the client-en.xml file.
While developing, you probably want to keep testing your changes. To do so, you can simply make Opera use your local copy as developer tool instead of the official version:
- Go to opera:config#DeveloperTools|DeveloperToolsURL
- Change the value to point to the
src/client-en.xmlfile. (Note: it seems this value needs to start with when pointing to a local resource. If you first open client-en.xml in a new Opera tab, you can copy the address from there to the Developer Tools URL field.)
- Tip: if you add ?debug after client-en.xml, Opera Dragonfly will show an extra debug pane that lets you inspect the communication between Opera's core and the debugger. This is really handy when getting familiar with the way it works.
This is where the real fun starts. Anything you always wanted to be able to do with a web debugger? Well, perhaps it will work once you've done a bit of hacking
Updating your local copy
While you're playing around, chances are that Opera's developers - or other contributors - make changes that appear in the official repository. Since you have made a copy of Opera Dragonfly for your own hacking, you are stuck in time and will keep working on an increasingly outdated version, right?
Don't worry - simply open the command line / terminal, go to the correct folder and run the command
hg pull https://bitbucket.org/scope/dragonfly-stp-1 followed by
hg merge. Your version is now up-to-date.
If you are not familiar with Mercurial and want some more information about using it, Joel Spolsky has a pretty good hg tutorial at hginit.com. Atlassian has a lot of useful information on using Bitbucket, see for example their Bitbucket 101 overview. Here you can find information about more advanced topics like how to resolve merge conflicts.
Making your changes public
So, when you've fixed an annoyance or added a feature, it's time to share your work.
- Edit the
.hg/hgrcfile to add your Bitbucket user name - in mine, I've added this section:
[ui] username = hallvors
- Go to the command line / terminal, change to correct folder and type
hg commit -m"quick description of the changes"
- Followed by
and your Bitbucket password when prompted.
Success! The change should now show up as a revision on your Bitbucket repository, where you can share it with others - for example by going to the official repository to use the "Pull request" button. Good luck and thanks in advance for any contributions!