Rev 4759: (Jelmer) Add abbreviated names and a foreign revid serializer to the in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Oct 20 12:43:02 BST 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4759 [merge]
revision-id: pqm at pqm.ubuntu.com-20091020114259-xxou482wvh20lhl6
parent: pqm at pqm.ubuntu.com-20091020051209-telne1xq2bq6cp7m
parent: jelmer at samba.org-20091020104350-mndvjaqp8y423wqd
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2009-10-20 12:42:59 +0100
message:
  (Jelmer) Add abbreviated names and a foreign revid serializer to the
  	foreign vcs interface.
modified:
  bzrlib/foreign.py              foreign.py-20081112170002-olsxmandkk8qyfuq-1
  bzrlib/tests/test_foreign.py   test_foreign.py-20081125004048-ywb901edgp9lluxo-1
=== modified file 'bzrlib/foreign.py'
--- a/bzrlib/foreign.py	2009-10-11 01:31:23 +0000
+++ b/bzrlib/foreign.py	2009-10-20 10:43:50 +0000
@@ -124,7 +124,13 @@
 
     branch_format = None
 
-    def __init__(self, mapping_registry):
+    def __init__(self, mapping_registry, abbreviation=None):
+        """Create a new foreign vcs instance.
+
+        :param mapping_registry: Registry with mappings for this VCS.
+        :param abbreviation: Optional abbreviation ('bzr', 'svn', 'git', etc)
+        """
+        self.abbreviation = abbreviation
         self.mapping_registry = mapping_registry
 
     def show_foreign_revid(self, foreign_revid):
@@ -135,6 +141,15 @@
         """
         return { }
 
+    def serialize_foreign_revid(self, foreign_revid):
+        """Serialize a foreign revision id for this VCS.
+
+        :param foreign_revid: Foreign revision id
+        :return: Bytestring with serialized revid, will not contain any 
+            newlines.
+        """
+        raise NotImplementedError(self.serialize_foreign_revid)
+
 
 class ForeignVcsRegistry(registry.Registry):
     """Registry for Foreign VCSes.

=== modified file 'bzrlib/tests/test_foreign.py'
--- a/bzrlib/tests/test_foreign.py	2009-10-02 14:50:35 +0000
+++ b/bzrlib/tests/test_foreign.py	2009-10-19 00:54:12 +0000
@@ -74,10 +74,14 @@
         self.mapping_registry = DummyForeignVcsMappingRegistry()
         self.mapping_registry.register("v1", DummyForeignVcsMapping(self),
                                        "Version 1")
+        self.abbreviation = "dummy"
 
     def show_foreign_revid(self, foreign_revid):
         return { "dummy ding": "%s/%s\\%s" % foreign_revid }
 
+    def serialize_foreign_revid(self, foreign_revid):
+        return "%s|%s|%s" % foreign_revid
+
 
 class DummyForeignVcsBranch(branch.BzrBranch6,foreign.ForeignBranch):
     """A Dummy VCS Branch."""




More information about the bazaar-commits mailing list