~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/foreign.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-01-27 20:24:43 UTC
  • mfrom: (3960.2.1 1.12-progress-warnings)
  • Revision ID: pqm@pqm.ubuntu.com-20090127202443-ty2bu1hh91dumasz
(jam) Avoid getting a UserWarning by not creating an unused progress
        bar.

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
 
 
55
48
    def revision_id_bzr_to_foreign(self, bzr_revid):
56
49
        """Parse a bzr revision id and convert it to a foreign revid.
57
50
 
68
61
        """
69
62
        raise NotImplementedError(self.revision_id_foreign_to_bzr)
70
63
 
 
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
 
71
73
 
72
74
class VcsMappingRegistry(registry.Registry):
73
75
    """Registry for Bazaar<->foreign VCS mappings.
122
124
    """
123
125
    # Revision comes directly from a foreign repository
124
126
    if isinstance(rev, ForeignRevision):
125
 
        return rev.mapping.vcs.show_foreign_revid(rev.foreign_revid)
 
127
        return rev.mapping.show_foreign_revid(rev.foreign_revid)
126
128
 
127
129
    # Revision was once imported from a foreign repository
128
130
    try:
131
133
    except errors.InvalidRevisionId:
132
134
        return {}
133
135
 
134
 
    return mapping.vcs.show_foreign_revid(foreign_revid)
 
136
    return mapping.show_foreign_revid(foreign_revid)
135
137
 
136
138
 
137
139
class ForeignVcs(object):
140
142
    def __init__(self, mapping_registry):
141
143
        self.mapping_registry = mapping_registry
142
144
 
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
 
 
151
145
 
152
146
class ForeignVcsRegistry(registry.Registry):
153
147
    """Registry for Foreign VCSes.