~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/foreign.py

  • Committer: John Arbash Meinel
  • Date: 2009-10-20 19:46:46 UTC
  • mfrom: (4759 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4771.
  • Revision ID: john@arbash-meinel.com-20091020194646-wnqpd15qs19y28z7
Merge bzr.dev 4759, bringing in static_tuple and streaming improvements.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
""")
37
37
 
38
38
class VcsMapping(object):
39
 
    """Describes the mapping between the semantics of Bazaar and a foreign vcs.
 
39
    """Describes the mapping between the semantics of Bazaar and a foreign VCS.
40
40
 
41
41
    """
42
42
    # Whether this is an experimental mapping that is still open to changes.
122
122
class ForeignVcs(object):
123
123
    """A foreign version control system."""
124
124
 
125
 
    def __init__(self, mapping_registry):
 
125
    branch_format = None
 
126
 
 
127
    def __init__(self, mapping_registry, abbreviation=None):
 
128
        """Create a new foreign vcs instance.
 
129
 
 
130
        :param mapping_registry: Registry with mappings for this VCS.
 
131
        :param abbreviation: Optional abbreviation ('bzr', 'svn', 'git', etc)
 
132
        """
 
133
        self.abbreviation = abbreviation
126
134
        self.mapping_registry = mapping_registry
127
135
 
128
136
    def show_foreign_revid(self, foreign_revid):
133
141
        """
134
142
        return { }
135
143
 
 
144
    def serialize_foreign_revid(self, foreign_revid):
 
145
        """Serialize a foreign revision id for this VCS.
 
146
 
 
147
        :param foreign_revid: Foreign revision id
 
148
        :return: Bytestring with serialized revid, will not contain any 
 
149
            newlines.
 
150
        """
 
151
        raise NotImplementedError(self.serialize_foreign_revid)
 
152
 
136
153
 
137
154
class ForeignVcsRegistry(registry.Registry):
138
155
    """Registry for Foreign VCSes.
305
322
                ).get_user_option_as_bool('dpush_strict')
306
323
        if strict is None: strict = True # default value
307
324
        if strict and source_wt is not None:
308
 
            if (source_wt.has_changes(source_wt.basis_tree())
309
 
                or len(source_wt.get_parent_ids()) > 1):
 
325
            if (source_wt.has_changes()):
310
326
                raise errors.UncommittedChanges(
311
327
                    source_wt, more='Use --no-strict to force the push.')
312
328
            if source_wt.last_revision() != source_wt.branch.last_revision():