Alessio Caiazza

Articles tagged 'mercurial'

Bundler with Mercurial support

Git seems to be the de-facto tool for ruby development. Lots of gems are hosted on github, and bundler may help you to work with cutting-edge release fetched from git repositories.

WOW! That’s amazing! But what if you didn’t like to use git as scm?

I’ve nothing against git, but I prefer mercurial so I spent some time to add mercurial capabilities to bundler, the best way to manage your application’s dependencies.

How does it work?

With bundler you can start gem development with a simple command (more info at Railscast episode 201)

bundle gem gem_name

This command will create for you a gem skeleton with some premade rake tasks in a shiny git repository. Wouldn’t be wonderful if we can use mercurial instead of git?

Now you can with this patched version of bundler 1.0.10 that add the ‘-H’ switch to bundle gem

 bundle help gem
Usage:
  bundle gem GEM

Options:
  -H, [--hg=Use mercurial instead of git]
  -b, [--bin=Generate a binary for your library.]
      [--no-color=Disable colorization in output]
  -V, [--verbose=Enable verbose output mode]       

Creates a skeleton for creating a rubygem

Not enough for you?

If this is not enough for you, I’ve also a patch set for loading gems directly from mercurial repos. This patched bundler v1.1pre.1 will make you happy.

#Gemfile
gem 'eusplazio', :hg => 'http://bitbucket.org/nolith/eusplazio', :tag => 'v0.0.2'

Happy conding

Install instructions

Download the zipped source and extract it; enter the source folder and type rake install

(l0g.in 4ASLAn)

Mercurial e Redmine: aggiornamento automatico dello stato dei BUG

Da qualche giorno sto usando redmine per la gestione dei miei repository mercurial.

Una cosa che trovo molto utile è cambiare lo stato dei BUG riportati nel tracker direttamente con il messaggio di commit.

C'è un problema, di default il tracker di redmine non si aggiorna finché qualcuno non visita la pagina del repository…vediamo come risolvere il problema.

Mercurial ci mette a disposizione degli hook per eseguire alcuni script in corrispondenza di determinati eventi; possiamo sfruttare l'hook changegroup per aggiornare redmine.

Colleghiamoci in ssh al server su cui si trovano redmine e modifichiamo il file .hg/hgrc del nostro repository.

# output of /path/to/hg/repos/.hg/hgrc
# Mercurial - Redmine issue updater hook
# please update cd redmine with your redmine path
[hooks]
changegroup.redmine = cd redmine && ruby script/runner "Repository.fetch_changesets" -e production

A questo punto non ci resta che eseguire un commit ed un push di prova.

(l0g.in 44NMT1)
Alessio

Hello. My name is Alessio Caiazza. I'm also known as nolith. I love writing code and technology. I'm passionate about production engineering.

This is where I write my thoughts trying to follow IndieWeb principles.

Staff Backend Engineer, Delivery @ GitLab

he/him/his

IU5BON HamRadio callsign

"Il sapere umano appartiene al mondo."

An IndieWeb Webring 🕸💍