Skip to content

sole/cinnabarify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 

Repository files navigation

cinnabarify

This is a scripted version of the steps you'd follow to get a Mozilla Firefox repository with git-cinnabar on it.

Basically, it's like the steps at the workflow for Gecko development page, but automated.

Usage

git clone https://github.com/sole/cinnabarify.git
cd cinnabarify
./main.sh /path/to/your/desired/target/directory

For example:

./main.sh ~/Firefox-code

will do all sorts of magic to get you a git-enabled copy of Firefox's code that works with mercurial underneath and all sorts of other trickery using git-cinnabar

Using the resulting repository

The result of a successful execution is a git repository that somehow uses hg (Mercurial) underneath via git-cinnabar. But to all effects and purposes, it's a git repository, which means you do not need to learn hg, and can keep using the same workflow you already know about.

Since not everyone is a born-git-expert, I'm going to describe how to perform the most common tasks that you might need as a Firefox developer:

Updating from upstream (getting latest changes from mozilla-central):

The script checks out mozilla/central as the master branch locally. There are hundreds of commits being merged into that branch every day, so you'll want to pull regularly to ensure your code is written on top of the latest code.

This will bring your local master in sync with the last commit in mozilla-central:

git remote update
git checkout master
git pull --rebase mozilla

Work on a bug

I suggest you do the step above before you start working on a bug.

Then, create and switch to a new branch for the bug:

git checkout -b bug123456789

Do your work and everything. If you need to work on another thing, you can add and commit the changes, check out master and create another branch from there.

Pushing to the try server

You might want to push your current branch to the testing server to get the test suite run in a number of environments.

The way the environments in which tests are run is decided is by looking at the git commit message. There is a try syntax builder that can help you with this.

Add files to the commit, use the syntax you built as the commit message, and then push:

git push try

This will output various messages, amongst which you'll find a URL linking to the test job you created by pushing to the server. You can visit that to see the status of your tests.

Advanced: command line utils

If you want a bit more help, you can add the cinnabarify/bin directory to your path, and it will add some useful commands to your command line repertoire (although at the moment there's only one 😅).

To do this, find the full path to your cinnabarify clone:

cd cinnabarify # if you were not there yet
pwd # will return the full path, for example: /Users/sole/data/projects/cinnabarify

We can transform this to a shorter version, replacing the base with $HOME. In my case, /Users/sole/data/projects/cinnabarify becomes $HOME/data/projects/cinnabarify. And we add /bin at the end: $HOME/data/projects/cinnabarify/bin.

Then edit the file where your $PATH variable is defined, to add this path. The files are usually called .bash_profile or .bashrc. Find the definition, and add the path to the bin directory. For example, if the file had this before:

PATH=/usr/local/opt/ccache/libexec:$PATH:$HOME/bin/git-cinnabar

then we add a semicolon (which is the separator) and add our new extra directory:

PATH=/usr/local/opt/ccache/libexec:$PATH:$HOME/bin/git-cinnabar:$HOME/data/projects/cinnabarify/bin

To make this effective you'll need to save the file and restart your terminal window or open a new session, OR you can also request the file to be read again with source, without abandoning your current terminal:

source ~/.bashrc # or .bash_profile if it's where yours is

Now you should be able to start typing cinnabarif, then press TAB and it should be autocompleted to show available commands.

Cheatsheet table

Action Command
Pull from mozilla-central
(updating from upstream)
cinnabarify-pull-mozilla

Limitations

Only tested successfully on a Mac OS environment.

Places where it's been tested unsuccesfully (AKA it does not work):

See the issues.

Please be warned that

  • I do not intend to turn this into a general purpose tool
  • I just wrote this to help me and new hires get started, and
  • if you want new features or different behaviours, you're more than welcome to fork this and work in your own version of this script

Please also note that I will gladly accept pull requests that fix the filed issues.

About

Cinnabarify left, right and centre

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages