Manabu TERADA avatar Manabu TERADA committed b54cd28

Adding property 'ignore_project' [Manabu TERADA]

Comments (0)

Files changed (6)

+1.0b1 (2012-01-17)
+- Adding property 'ignore_project' [Manabu TERADA]
 1.0a2 (2012-01-08)
     recipe = c2.recipe.bitbucketbk
     username = xxxxxxxxxxxxx
     password = xxxxxxxxxxxxxxxxxx
-	location = /backups
+    location = /backups
+    ignore_project =
+        xxxxxx1
+        xxxxxx2
 Run the buildout ::


     backup location
     default : buckups
+	option
+	Listing project name, if do you have no backup project 
 Example usage


         options.setdefault('username', '')
         options.setdefault('password', '')
         options.setdefault('location', 'backups')
+        ignore_project = options.get('ignore_project', '')
+        self.ignore_projcet = tuple([ignore.strip() for ignore in
+                                        ignore_project.split('\n') if ignore.strip()])
         self.egg = zc.recipe.egg.Egg(buildout, options['recipe'], options)
 username = %(username)r
 password = %(password)r
 location = %(location)r
+ignore_project = %(ignore_project)r
         opts = self.options.copy()
+        opts['ignore_project'] = self.ignore_projcet
         initialization = initialization_template % opts
         requirements, ws = self.egg.working_set(['c2.recipe.bitbucketbk',
             ws, self.options['executable'], self.options['bin-directory'],
-            arguments=('username, password, location'),
+            arguments=('username, password, location, ignore_project'),
         return scripts


     repos = json.load(bitbucket_obj).get('repositories', [])
     for repo in repos:
-        yield repo.get('name', None), repo.get('scm', ''), repo.get('main_branch', 'null')
+        yield repo.get('name', None), repo.get('scm', ''), repo.get('main_branch', u'null')
 def has_repo(repo_name, location):
     if repo_name in os.listdir(location):
     commands.pull(ui.ui(), repo, source=repo_url) 
-def backup_main(username, password, location):
+def backup_main(username, password, location, ignore_project):
     """Main method, gets called by generated bin/bitbucketbk.
     repos = get_repositories(username, password)
     for repo_name, scm, main_branch in repos:
-        if main_branch == 'null':
+        if repo_name in ignore_project:
+            continue
+        if main_branch == u'null':
         if scm == u"hg":
             base_url = BITBUCKET_BASE_URL % {'user' : username, 'passwd' : password}
 def read(*rnames):
     return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
-version = '1.0a2'
+version = '1.0b1'
 long_description = (
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.