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. 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
For all commands help is available (hg help bb_create), with info about 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
PyBitBucket is required, as it is currently not PyPi-intallable, you must install it yourself:
hg clone git+https://bitbucket.org/atlassian/python-bitbucket.git # Or git clone https://bitbucket.org/atlassian/python-bitbucket.git cd python-bitbucket pip install --user .
Then install the extension itself:
pip install --user mercurial_bitbucketize
activate it by writing in ~/.hgrc:
[extensions] mercurial_bitbucketize =
and configure as described above.
To upgrade, repeat the same command with --upgrade option, for example:
pip install --user --upgrade mercurial_bitbucketize
As I already said, it is strongly recommended that you install also Keyring and Path Pattern.
4.2 Windows
If you have Python installed, install necessary modules with PIP:
hg clone git+https://Mekk@bitbucket.org/atlassian/python-bitbucket.git # Or git clone https://bitbucket.org/atlassian/python-bitbucket.git cd python-bitbucket pip install .
Then install the extension itself:
pip install 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, install one. Or work out alternative installation method and let me know about it.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for mercurial_bitbucketize-0.5.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e81af8707a00e2609b44ee66d588fd62a476d3ec9022e20ffcfab6800b8c5ca5 |
|
MD5 | 0c882f5db50edac2a72a55ddc859ecb6 |
|
BLAKE2b-256 | 64cc08b5a101a1b4a3a9b28476ccff43ad084662a6544a84a3493a32206a685d |