Skip to main content

Mercurial Bitbucketize Extension

Project description

Publish your next repo to bitbucket without clicking through the web interface. Also switch it easily from private to public (or back), set description, enable or disable wiki and issue tracker…

1 Synopsis

In simplest configuration extension works just as generic BitBucket client:

hg bitbucket_create acme-toolkit --wiki --private --forks=private

hg bitbucket_modify acme-toolkit --public -m "THE toolkit above all toolkits"

hg bitbucket_status acme-toolkit

hg bitbucket_delete acme-toolkit

Those commands operate on https://bitbucket.org/«USER»/acme-toolkit where «USER» is your BitBucket username (configured in extension configuration).

Paired with Path Pattern it can also deduce appropriate name for the current repository:

# Create private bitbucket clone of current repo
hg bitbucket_create
# ... or maybe public one
hg bitbucket_create --issues --public -l python -m "Webapp for nowhere.com"

hg bitbucket_status

hg bitbucket_modify --language=perl

hg bitbucket_delete

To save typing, all commands have shorter aliases (hg bb_create, hg bb_status, etc).

2 Enabling and configuring the extension

Install the extension as described below (see Installation section). Then enable it and configure a few crucial parameters by writing in ~/.hgrc:

[extensions]
mercurial_bitbucketize =

[bitbucketize]
user = John
path_alias = bitbucket

The latter is optional and means, that in case bitbucket path alias is defined, it can be used to establish the name of BitBucket repository to operate on. That works great if you install and enable Path Pattern and define appropriate pattern, for example:

[extensions]
mercurial_bitbucketize =
mercurial_path_pattern =

[bitbucketize]
user = John
path_alias = bitbucket

[path_pattern]
bitbucket.local = ~/devel/{below}
bitbucket.remote = https://bitbucket.org/John/{below:/=-}

(with such settings bitbucketize will know that ~/devel/libs/acme is to be created on BitBucket as https://bitbucket.org/John/libs-acme).

It is also strongly recommended that you install Keyring to avoid being repeatably prompted for BitBucket password (bitbucketize happily uses Keyring to save password in secure storage).

3 Commands

Standard help is available for all commands (hg help bb_create, etc), check it out for detailed list of all options.

3.1 Creating BitBucket repository (hg bitbucket_create)

Creates new repository on BitBucket. You can give the name:

hg bitbucket_create tinyapps-acme

(then the command is context-less) or rely on deduction:

hg bitbucket_create

(the latter depends on proper path_alias configuration).

By default repository is private, has no wiki, no issue tracker, and no description. Some of those can be specified, for example:

hg bb_create --wiki --issues --descr="My repo" --public

The bitbucket_create command does not push the code (created repository is empty). This is done on purpose, to let you verify the name and settings before you push.

3.2 Toggling repository features (hg bitbucket_modify)

Use bitbucket_modify command to modify repository features.

It can be used to switch it to public:

hg bitbucket_modify --public

or back to private:

hg bitbucket_modify --private

and correct metadata:

hg bitbucket_modify --lang=Perl --descr="TIMTOWTDI"

Examples above operated on deduced repository. Of course specifying the name is also possible:

hg bitbucket_modify tinylibs-acme --public --wiki

Similarly toggle wiki and issues:

hg bitbucket_modify --wiki
hg bitbucket_modify --no-wiki
hg bitbucket_modify --issues
hg bitbucket_modify --no-issues

3.3 Checking repository status (hg bitbucket_status)

Use bitbucket_status command to check whether repository exists, and print it’s metadata:

hg bitbucket_status

or:

hg bitbucket_status tinylibs-acme

3.4 Deleting the BitBucket clone (hg bitbucket_delete)

Use bitbucket_delete to remove BitBucket clone:

hg bitbucket_delete

or, to delete repository with specific name:

hg bitbucket_delete acme

4 Installation

4.1 Linux/Unix

4.1.1 Installing from PyPi

To install for the first time, just:

pip install --user mercurial_bitbucketize

This should install both the extension itself, and all it’s dependencies. Of course other methods of installing Python packages work too (like sudo easy_install mercurial_bitbucketize).

Activate by writing in ~/.hgrc:

[extensions]
mercurial_bitbucketize =

To upgrade:

pip install --upgrade --user mercurial_bitbucketize

As I already said, it is strongly recommended that you install also Keyring and Path Pattern.

4.1.2 Installing for development

Clone the extension itself, and it’s dependencies (PyBitBucket and mercurial_extension_utils):

hg clone git+https://bitbucket.org/atlassian/python-bitbucket.git
# Or git clone https://bitbucket.org/atlassian/python-bitbucket.git

hg clone https://bitbucket.org/Mekk/mercurial-extension_utils

hg clone https://bitbucket.org/Mekk/mercurial-bitbucketize

Update to newest tags if you prefer to work on stable versions.

Install them for development (dependencies first):

pip install --user --edit python-bitbucket
pip install --user --edit mercurial-extension_utils
pip install --user --edit mercurial-bitbucketize

Activate as usual:

[extensions]
mercurial_bitbucketize =

To upgrade just pull changes and update in appropriate repositories.

4.2 Windows

If you have Python installed, install necessary modules with pip, just like on Linux:

pip install --user mercurial_bitbucketize

As Mercurial (whether taken from TortoiseHg, or own package) uses it’s own bundled Python, you must activate by specifying the path:

[extensions]
mercurial_bitbucketize = C:/Python27/Lib/site-packages/mercurial_bitbucketize.py
;; Or wherever pip installed it

Extension will take care of finding necessary modules.

If you don’t have Python, you may try the method described above in Installing for development, but I suspect you will face missing dependencies. So preferably install Python.

6 History

See HISTORY.txt

7 Development, bug reports, enhancement suggestions

Development is tracked on BitBucket, see http://bitbucket.org/Mekk/mercurial-bitbucketize/

Use BitBucket issue tracker for bug reports and enhancement suggestions.

8 Additional notes

Information about this extension is also available on Mercurial Wiki: http://mercurial.selenic.com/wiki/BitBucketizeExtension

Check also other Mercurial extensions I wrote.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mercurial_bitbucketize-0.5.1.tar.gz (12.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page