Mercurial FTP extension

If you use mercurial for your version control and you need to deploy continuously to a FTP site you should have a look at the extension developed by André Klitzing.

It will the first time upload all your files to your host and then only the missing committed changes, it’s really great instead or uploading all or remembering the 35 files that you changed everywhere you can simply do:

cd yourdirectory
hg ftp yourseveralias --upload
(Check the instructions for how to add your server alias,user,pwd)

Now unfortunately in my hosting the username MUST use @ like :, so the URL is parsed wrongly by the python functions and the upload fails

I add this very naïve fix (New code in green and  DON’T forget to add proper padding in your editor)

Around line 31:
// Check if  there's more than one @ if so replace the first one with some arbitrary  characters that are hard to find in a username
path = self.ui.config('paths', url)
 if path:
   if path.find('@') != path.rfind('@'):
      path = path.replace('@','{!!',1)
   self.url = urlparse.urlsplit(path)
   self.url = urlparse.urlsplit(url)Around line 144 on the _ftp function BEFORE the login function
// Replace back the arbitrary characters '{!!' for the first @
 if user:
    user = user.replace('{!!','@',1)
 ftp.login(user, psw)

Hope it helps someone else!

Working with Mercurial .hgignore

We’re currently using Mercurial as the base tequila repository and we frequently have to work with .hgignore files

After some fighting with this regex here are some rules that seems to work

syntax: glob

syntax: regexp
#^gateway.php$ Ignores a top level file called gateway

# ignores a directory

# ignores another directory

#ignores cache.php
# ignores

#ignores logs

Interestingly I cannot manage to ignore the file temp/ no matter what I do! When I have the answer I’ll modify this post!