~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-06-02 15:39:06 UTC
  • mfrom: (4393.2.2 bzr.ls-fix)
  • Revision ID: pqm@pqm.ubuntu.com-20090602153906-1q6bresxw669b34i
(Mattias Eriksson) Clear the terminal before outputing 'bzr ls'
        results.

Show diffs side-by-side

added added

removed removed

Lines of Context:
119
119
        self.mapping = mapping
120
120
 
121
121
 
122
 
def show_foreign_properties(rev):
123
 
    """Custom log displayer for foreign revision identifiers.
124
 
 
125
 
    :param rev: Revision object.
126
 
    """
127
 
    # Revision comes directly from a foreign repository
128
 
    if isinstance(rev, ForeignRevision):
129
 
        return rev.mapping.vcs.show_foreign_revid(rev.foreign_revid)
130
 
 
131
 
    # Revision was once imported from a foreign repository
132
 
    try:
133
 
        foreign_revid, mapping = \
134
 
            foreign_vcs_registry.parse_revision_id(rev.revision_id)
135
 
    except errors.InvalidRevisionId:
136
 
        return {}
137
 
 
138
 
    return mapping.vcs.show_foreign_revid(foreign_revid)
139
 
 
140
 
 
141
122
class ForeignVcs(object):
142
123
    """A foreign version control system."""
143
124
 
179
160
        :param revid: The bzr revision id
180
161
        :return: tuple with foreign revid and vcs mapping
181
162
        """
182
 
        if not "-" in revid:
 
163
        if not ":" in revid or not "-" in revid:
183
164
            raise errors.InvalidRevisionId(revid, None)
184
165
        try:
185
166
            foreign_vcs = self.get(revid.split("-")[0])