gautier / bitbucket-sync Goto Github PK
View Code? Open in Web Editor NEWbitbucket-sync synchronize locally all the repositories of a bitbucket account
License: MIT License
bitbucket-sync synchronize locally all the repositories of a bitbucket account
License: MIT License
Consider adding LICENSE file to the project root.
Using MIT, which is shown on pypi seems very nice to me.
With bitbucket-sync==0.2.0
$ bitbucket-sync --directory bb-third --key xxxKEYxxx --secret yyyyySECRETyyy --processes=1
Traceback (most recent call last):
File "/home/javl/Envs/bitbucket-sync/bin/bitbucket-sync", line 9, in <module>
load_entry_point('bitbucket-sync==0.2.0', 'console_scripts', 'bitbucket-sync')()
File "/home/javl/Envs/bitbucket-sync/local/lib/python2.7/site-packages/bitbucket_sync/main.py", line 66, in main
pool = Pool(processes=processes, initializer=init_worker)
File "/usr/lib/python2.7/multiprocessing/__init__.py", line 232, in Pool
return Pool(processes, initializer, initargs, maxtasksperchild)
File "/usr/lib/python2.7/multiprocessing/pool.py", line 159, in __init__
self._repopulate_pool()
File "/usr/lib/python2.7/multiprocessing/pool.py", line 213, in _repopulate_pool
for i in range(self._processes - len(self._pool)):
TypeError: unsupported operand type(s) for -: 'str' and 'int'
Currently, no text indicates, that only git repositories are synced.
Either explicitly say, only git repos are synced (this is currently fine with me), or add ability to sync also Mercurial ones (it seems relatively easy to do and would be nicer).
Trying to call the command I get an error:
$ bitbucket-sync --account vlcinsky --directory . --key xxxKEYxx --secret xxSECRETxx
Traceback (most recent call last):
File "/home/javl/Envs/bitbucket-sync/bin/bitbucket-sync", line 9, in <module>
load_entry_point('bitbucket-sync==0.1.1', 'console_scripts', 'bitbucket-sync')()
File "/home/javl/Envs/bitbucket-sync/local/lib/python2.7/site-packages/bitbucket_sync/main.py", line 55, in main
response = requests.get(deploy_keys_resource, auth=oauth)
File "/home/javl/Envs/bitbucket-sync/local/lib/python2.7/site-packages/requests/api.py", line 65, in get
return request('get', url, **kwargs)
File "/home/javl/Envs/bitbucket-sync/local/lib/python2.7/site-packages/requests/safe_mode.py", line 39, in wrapped
return function(method, url, **kwargs)
File "/home/javl/Envs/bitbucket-sync/local/lib/python2.7/site-packages/requests/api.py", line 51, in request
return session.request(method=method, url=url, **kwargs)
File "/home/javl/Envs/bitbucket-sync/local/lib/python2.7/site-packages/requests/sessions.py", line 241, in request
r.send(prefetch=prefetch)
File "/home/javl/Envs/bitbucket-sync/local/lib/python2.7/site-packages/requests/models.py", line 521, in send
r = self.auth(self)
File "/home/javl/Envs/bitbucket-sync/local/lib/python2.7/site-packages/requests_oauthlib/core.py", line 61, in __call__
unicode(r.full_url), unicode(r.method), r.data, r.headers)
File "/home/javl/Envs/bitbucket-sync/local/lib/python2.7/site-packages/oauthlib/oauth1/rfc5849/__init__.py", line 274, in sign
raise ValueError('GET/HEAD requests should not include body.')
ValueError: GET/HEAD requests should not include body.
Installed packages (using virtualenv):
$ pip freeze
-f /home/javl/.pip/packages
argparse==1.2.1
bitbucket-sync==0.1.1
docopt==0.5.0
oauthlib==0.6.0
requests==0.14.2
requests-oauthlib==0.2.0
wsgiref==0.1.2
Using Ubuntu 13.04
$ python
Python 2.7.4 (default, Sep 26 2013, 03:20:26)
[GCC 4.7.3] on linux2
One may have access to repositories from multiple accounts: it's own, team ones, and those who are shared with him.
When using workflow "form my repo and then issue pull request" one gets often repositories with the same name living under different owners.
Currently, repositories are stored locally in directory, which is derived only from slug. This may result in conflicts, as multiple repositories may attempt to sync into the same local directory.
so for repo named "repo" existing in different versions at account "vlcinsky" and "myteam", sync would result in "vlcinsky/repo.git" and "myteam/repo.git".
This is safe method, but sometime it may archive repos from other owners, what is not always needed.
Note, that one account may provide repos from multiple owners so do not confuse owner with account.
The value of --owner would define filter, selecting only repos, which are owned by given owner.
In this case the owner parameter is required.
So always store under directory of an owner.
And allow filtering by one owner name (this time this does not have to be required parameter).
I'm trying to backup all the repositories of my organization, so I've created and OAuth key with that account. Now when I try to run the backup I get the following error.
Any clues on how to fix this?
bitbucket-sync --key MyOrgranizationKey --secret MyOrganizationSecret --directory .
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib64/python2.6/threading.py", line 532, in __bootstrap_inner
self.run()
File "/usr/lib64/python2.6/threading.py", line 484, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/lib/python2.6/site-packages/bitbucket_sync/main.py", line 109, in worker
if sync_repo(directory, repo, lock):
File "/usr/lib/python2.6/site-packages/bitbucket_sync/main.py", line 83, in sync_repo
scm.validate_local_repository()
File "/usr/lib/python2.6/site-packages/bitbucket_sync/main.py", line 40, in validate_local_repository
subprocess.check_output(
AttributeError: 'module' object has no attribute 'check_output'
NEWS.rst shall be present in project root and list chronologically changes in functionality.
Feel free to leave it to me - I would do that within a week.
There would come NEWS.rst and also slightly modified setup.py to merge it for pypi page (so pypi page would show on the bottom changes in the project).
When using the command, I got many lines on output stating:
X11 forwarding request failed
X11 forwarding request failed
X11 forwarding request failed
X11 forwarding request failed
Initially they were in groups of 4, later on they got scattered in smaller groups.
This was spoiling output of the command and made more difficult to estimate, if all syncing went correctly or there was a problem.
Happened on Ubuntu 13.10 64 bits, python 2.7
hi out there
we're using lots of bitbucket repos in my company so was really happy when i found your script. I've no clue what's the problem. When i execute your script i get the following error:
bitbucket-sync
Traceback (most recent call last):
File "/usr/local/bin/bitbucket-sync", line 5, in
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in
working_set.require(requires)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: requests>=2.0.0
am i using wrong python version or smth. sm? i've never been in touch with python - can you please give me an advice?
maybe it's important: i'm using osx 10.9.5 with python 2.7.5 installed
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.