~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/foreign.py

  • Committer: Jelmer Vernooij
  • Date: 2009-01-22 14:36:40 UTC
  • mto: This revision was merged to the branch mainline in revision 3966.
  • Revision ID: jelmer@samba.org-20090122143640-ymqoypm29mcmi4ku
Move ForeignVcsMapping.show_foreign_revid to ForeignVcs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
    # using this mapping.
46
46
    revid_prefix = None
47
47
 
 
48
    def __init__(self, vcs):
 
49
        """Create a new VcsMapping.
 
50
 
 
51
        :param vcs: VCS that this mapping maps to Bazaar
 
52
        """
 
53
        self.vcs = vcs
 
54
 
48
55
    def revision_id_bzr_to_foreign(self, bzr_revid):
49
56
        """Parse a bzr revision id and convert it to a foreign revid.
50
57
 
61
68
        """
62
69
        raise NotImplementedError(self.revision_id_foreign_to_bzr)
63
70
 
64
 
    def show_foreign_revid(self, foreign_revid):
65
 
        """Prepare a foreign revision id for formatting using bzr log.
66
 
        
67
 
        :param foreign_revid: Foreign revision id.
68
 
        :return: Dictionary mapping string keys to string values.
69
 
        """
70
 
        # TODO: This could be on ForeignVcs instead
71
 
        return { }
72
 
 
73
71
 
74
72
class VcsMappingRegistry(registry.Registry):
75
73
    """Registry for Bazaar<->foreign VCS mappings.
124
122
    """
125
123
    # Revision comes directly from a foreign repository
126
124
    if isinstance(rev, ForeignRevision):
127
 
        return rev.mapping.show_foreign_revid(rev.foreign_revid)
 
125
        return rev.mapping.vcs.show_foreign_revid(rev.foreign_revid)
128
126
 
129
127
    # Revision was once imported from a foreign repository
130
128
    try:
133
131
    except errors.InvalidRevisionId:
134
132
        return {}
135
133
 
136
 
    return mapping.show_foreign_revid(foreign_revid)
 
134
    return mapping.vcs.show_foreign_revid(foreign_revid)
137
135
 
138
136
 
139
137
class ForeignVcs(object):
142
140
    def __init__(self, mapping_registry):
143
141
        self.mapping_registry = mapping_registry
144
142
 
 
143
    def show_foreign_revid(self, foreign_revid):
 
144
        """Prepare a foreign revision id for formatting using bzr log.
 
145
        
 
146
        :param foreign_revid: Foreign revision id.
 
147
        :return: Dictionary mapping string keys to string values.
 
148
        """
 
149
        return { }
 
150
 
145
151
 
146
152
class ForeignVcsRegistry(registry.Registry):
147
153
    """Registry for Foreign VCSes.