Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #10 - fix for uncommon repository names #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions bbbackup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,21 @@ def bitbucket_estimated_size_repos( repos ):
}
'''

def repo_fix( repo_name ):
if " " in repo_name:
repo_name = repo_name.replace(' & ', '-')
repo_name = repo_name.replace(' - ','-')
repo_name = repo_name.replace(' ', '-').lower()

repo_name = repo_name.replace(']', '').lower()
repo_name = repo_name.replace('[', '')
repo_name = repo_name.replace('/', '-')
repo_name = repo_name.replace('(', '-')
repo_name = repo_name.replace(')', '')
repo_name = repo_name.replace('#', '')
return repo_name


# ANALYZE EXISTING LOCAL REPOSITORIES COMPARED TO REMOTE REPOSITORIES (SAME DAY)
def bitbucket_analyze( repos ):
counted = 0
Expand Down Expand Up @@ -1157,6 +1172,7 @@ def bitbucket_analyze( repos ):

for repo in repos:
repo_slug = repo['slug']
repo_slug = repo_fix(repo_slug)
BACKUP_LOCAL_REPO_PATH = os.path.abspath( os.path.join( BACKUP_LOCAL_PATH, repo_slug ) )

if os.path.exists( BACKUP_LOCAL_REPO_PATH ) and repo_status_is( BACKUP_LOCAL_REPO_PATH, STATUS_DONE ):
Expand Down Expand Up @@ -1218,6 +1234,7 @@ def bitbucket_clone( repos ):

for repo in repos:
repo_slug = repo['slug']
repo_slug = repo_fix(repo_slug)
BACKUP_LOCAL_REPO_PATH = os.path.abspath( os.path.join( BACKUP_LOCAL_PATH, repo_slug ) )

# STEP 1: check if repo marked as SYNC/FAIL
Expand Down