Bitbucket support

Hi,

I have added bitbucket support. There are also couple of other fixes:

 * fixed 'basename' handling (system basename command does not handle spaces in path)
 * fixed path containing more than one basename values. For example:
```
path = /path/to/project/src/project/packages/folder
basename = 'project'
produced wrong remote_path 'src' instead of /src/project/packages/folder
```