/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to branch.py

Import tags when pulling.

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
            super(ForeignBranch, self).__init__()
57
57
 
58
58
 
 
59
def extract_tags(refs, mapping):
 
60
    ret = {}
 
61
    for k,v in refs.iteritems():
 
62
        if k.startswith("refs/tags/") and not k.endswith("^{}"):
 
63
            v = refs.get(k+"^{}", v)
 
64
            ret[k[len("refs/tags/"):]] = mapping.revision_id_foreign_to_bzr(v)
 
65
    return ret
 
66
 
 
67
 
59
68
class GitPullResult(branch.PullResult):
60
69
 
61
70
    def _lookup_revno(self, revid):
94
103
        return ret
95
104
 
96
105
    def set_tag(self, name, revid):
97
 
        self.repository._git.tags[name] = revid
 
106
        self.repository._git.tags[name], _ = \
 
107
            self.branch.mapping.revision_id_bzr_to_foreign(revid)
98
108
 
99
109
 
100
110
class GitBranchFormat(branch.BranchFormat):
404
414
        else:
405
415
            refs = interrepo.fetch_refs(revision_id=stop_revision)
406
416
        self.target.generate_revision_history(stop_revision, result.old_revid)
 
417
        for name, revid in extract_tags(refs, self.target.mapping).iteritems():
 
418
            self.target.tags.set_tag(name, revid)
407
419
        result.new_revid = self.target.last_revision()
408
420
        return result
409
421