~jcsackett/charmworld/bac-tag-constraints

« back to all changes in this revision

Viewing changes to charmworld/jobs/ingest.py

  • Committer: Aaron Bentley
  • Date: 2013-07-17 21:55:42 UTC
  • mto: This revision was merged to the branch mainline in revision 317.
  • Revision ID: aaron@canonical.com-20130717215542-yi2aqwd3m8limehm
Include owner in pile-id.

Show diffs side-by-side

added added

removed removed

Lines of Context:
276
276
        self.decorate_bundle(payload)
277
277
        self.db.piles.save(payload)
278
278
 
 
279
    @staticmethod
 
280
    def construct_id(pile_data, revno):
 
281
        if pile_data['promulgated']:
 
282
            owner_segment = ''
 
283
        else:
 
284
            owner_segment = '~%s/' % pile_data['owner']
 
285
        return '%s%s-%d' % (owner_segment, pile_data['name'], revno)
 
286
 
279
287
    def decorate_bundle(self, bundle_data):
280
288
        branch_dir = fetch_branch(self.working_dir, bundle_data, self.log)
281
289
        branch = Branch.open(branch_dir)
282
290
        revno = branch.revision_id_to_revno(bundle_data['commit'])
283
291
        tree = branch.repository.revision_tree(bundle_data['commit'])
284
 
        bundle_data['_id'] = bundle_data['name'] + '-' + str(revno)
 
292
        bundle_data['_id'] = self.construct_id(bundle_data, revno)
285
293
        bundle_data['file_hashes'] = self.slurp_files(tree)
286
294
 
287
295
    def slurp_files(self, tree):