Package: mercurial_bitbucketize
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…1Synopsis2Enabling and configuring the extension3Commands3.1Creating BitBucket repository (hg bitbucket_create)3.2Toggling repository features (hg bitbucket_modify)3.3Checking repository status (hg bitbucket_status)3.4Deleting the BitBucket clone (hg bitbucket_delete)3.5Visiting BitBucket web pages (hg bitbucket_goto)4Installation4.1Linux/Unix4.2Windows5Related extensions6History7Repository, bug reports, enhancement suggestions8Known problems9Additional notes1SynopsisIn simplest configuration extension works just as genericBitBucketclient: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

hg bitbucket_goto acme-toolkitThose commands operate onhttps://bitbucket.org/«USER»/acme-toolkitwhere«USER»is your BitBucket username (configured in extension
configuration).Paired withPath Patternit can also deduceappropriate namefor 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_goto --issues

hg bitbucket_deleteTo save typing, all commands have shorter aliases (hg bb_create,hg bb_status, etc).2Enabling and configuring the extensionInstall the extension as described below (seeInstallationsection). Then enable it and configure a few crucial
parameters by writing in~/.hgrc:[extensions]
mercurial_bitbucketize =

[bitbucketize]
user = John
login = johny@gmail.com
path_alias = bitbucketHere:useris your short BitBucket username (the name present in
URLs of your repositories) andloginis your Atlassian login (the
username you enter while performing browser login),Thepath_aliasis optional and means, that in case such alias
(here:bitbucket) is defined for current repository, it can be
used to deduce the name of BitBucket repository to operate on. That
works great if you install and enablePath Patternand define
appropriate pattern, for example:[extensions]
mercurial_bitbucketize =
mercurial_path_pattern =

[bitbucketize]
user = John
login = johny@gmail.com
path_alias = bitbucket

[path_pattern]
bitbucket.local = ~/devel/{below}
bitbucket.remote = https://bitbucket.org/John/{below:/=-}(with such settingsbitbucketizewill know that~/devel/libs/acmeshould be paired withhttps://bitbucket.org/John/libs-acmeon BitBucket).It is also strongly recommended that you installKeyringto avoid
being repeatably prompted for BitBucket password (bitbucketizehappily usesKeyringto save password in secure storage).NoteIn case you happen to issuehg pull bitbucketorhg push bitbucketover HTTP (instead of ssh), you will likely want to add:[auth]
bitbucket.prefix = https://bitbucket.org
bitbucket.username = John.Smith@some.where.comThose settings are irrelevant from the Bitbucketize point of view,
but one usually wants to keep them in sync withbitbucketizesettings.3CommandsStandard help is available for all commands (hg help bitbucket_create,
etc), check it out for detailed list of all options.All commands have shorter aliases prefixed withbb_(instead ofhg bitbucket_modifyyou can typehg bb_modify).3.1Creating 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 properpath_aliasconfiguration).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" --publicNoteI usually prefer to create repository as private, push the code,
verify README appearance, and later, when I am generally happy and
ready for the release, switch to public.Thebitbucket_createcommand 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.2Toggling repository features (hg bitbucket_modify)Usebitbucket_modifycommand to modify repository features.It can be used to switch it to public:hg bitbucket_modify --publicor back to private:hg bitbucket_modify --privateand correct metadata:hg bitbucket_modify --lang=Perl --descr="TIMTOWTDI"Examples above operated ondeducedrepository. Of course
specifying the name is also possible:hg bitbucket_modify tinylibs-acme --public --wikiSimilarly toggle wiki and issues:hg bitbucket_modify --wiki
hg bitbucket_modify --no-wiki
hg bitbucket_modify --issues
hg bitbucket_modify --no-issuesWarningDisabling wiki or issue tracker is destructive, dangerous
operation. At the moment there is no additional warning or prompt
(I plan to add one in the future).3.3Checking repository status (hg bitbucket_status)Usebitbucket_statuscommand to check whether
repository exists, and print it’s metadata:hg bitbucket_statusor:hg bitbucket_status tinylibs-acme3.4Deleting the BitBucket clone (hg bitbucket_delete)Usebitbucket_deleteto remove BitBucket clone:hg bitbucket_deleteor, to delete repository with specific name:hg bitbucket_delete acmeWarningThis is irrecoverable operation. Even if you still have the code
(and can push it back), there is no way to recover issues, wiki,
downloads, or permissions.Use this command to delete temporary ad hoc repos, for more serious
removals consider web interface.3.5Visiting BitBucket web pages (hg bitbucket_goto)Simple shortcut to open respository related web pages on BitBucket.To visit overview:hg bitbucket_goto tinylibs-acmeor (with name deduction):hg bb_gotoTo visit specific page:hg bitbucket_goto tinylibs-acme --issuesor (with name deduction):hg bb_goto -l(seehg help bb_gotofor list of all pages supported).Default system browser is used (established according to various
system-specific conventions). If that guess is incorrect, it
can be configured in.hgrc. Either by something like:[browser]
type = firefoxwheretypeis one ofwebbrowsersupported values (firefox,chrome,safari,opera,konqueror, …) or:[browser]
command = /usr/bin/firefox(the former is slightly preferable as it can give browser incentive
to raise the window).4Installation4.1Linux/Unix4.1.1Installing from PyPiTo install for the first time, just:pip install --user mercurial_bitbucketizeThis should install both the extension itself, and all it’s
dependencies. Of course other methods of installing Python
packages work too (likesudo easy_install mercurial_bitbucketize).Activate by writing in~/.hgrc:[extensions]
mercurial_bitbucketize =To upgrade:pip install --upgrade --user mercurial_bitbucketizeAs I already said, it is strongly recommended that you install alsoKeyringandPath Pattern.4.1.2Installing for developmentClone the extension itself, and it’s dependencies
(PyBitBucketandmercurial_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://foss.heptapod.net/mercurial/mercurial-extension_utils

hg clone https://foss.heptapod.net/mercurial/mercurial-bitbucketizeUpdate 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-bitbucketizeActivate as usual:[extensions]
mercurial_bitbucketize =To upgrade just pull changes and update in appropriate repositories.4.2WindowsIf you have Python installed, install necessary modules withpip,
just like on Linux:pip install --user mercurial_bitbucketizeAs Mercurial (whether taken fromTortoiseHg, 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 itExtension will take care of finding necessary modules.If you don’t have Python, you may try the method described above inInstalling for development, but I suspect you will face missing
dependencies. So preferably install Python.5Related extensionsMercurial wiki quotesBitbucketExtension. Original repository
seems gone, but some copy lives on ashgbb.That extension seems concentrated on different parts ofBitBucket(making aliases, fork management) than BitBucketize (which is mostly
about creating repositories and maintaining their metadata).Also Bitbucketize is using mostly 2.0 BitBucket API whilehgbbso far
sticks to 1.0 version. This shows up in lack of some
fields/attributes.6HistorySeeHISTORY.rst7Repository, bug reports, enhancement suggestionsDevelopment is tracked on HeptaPod, seehttps://foss.heptapod.net/mercurial/mercurial-bitbucketize/Use issue tracker there for bug reports and enhancement
suggestions.Thanks toOctobusandClever Cloudfor hosting this service.8Known problemsValue erroron repository creationIfhg bitbucket_createends with:ValueError: dictionary update sequence element #0 has length 1; 2 is requiredyou observe effect of recurring bug inpybitbucket.Upgradingpybitbucketto version 0.6.1 or newer should resolve
the problem.If this is not feasible at the moment, you can also ignore the error
(failure happens after repository was created, it’s only consequence
is that you do not see the confirmation message). Usehg bitbucket_detailsto check whether repository state is correct.9Additional notesInformation about this extension is also available
on Mercurial Wiki:http://mercurial.selenic.com/wiki/BitBucketizeExtensionCheck alsoother Mercurial extensions I wrote.