Skip to content

Commit

Permalink
Issue OpenReplyDE#10 - fix for uncommon repository names
Browse files Browse the repository at this point in the history
  • Loading branch information
luismsousa authored and Luis Sousa committed May 20, 2020
1 parent 350d108 commit 3a79ebd
Showing 1 changed file with 17 additions and 0 deletions.
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

0 comments on commit 3a79ebd

Please sign in to comment.