/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to foreign/__init__.py

merge new bzr-foreign.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
from bzrlib import (
20
20
    errors,
21
21
    )
22
 
from bzrlib.branch import (
23
 
    Branch,
24
 
    )
25
22
from bzrlib.commands import (
26
23
    Command,
27
24
    Option,
28
25
    )
29
26
 
30
27
 
31
 
class ForeignBranch(Branch):
32
 
    """Branch that exists in a foreign version control system."""
33
 
 
34
 
    def __init__(self, mapping):
35
 
        self.mapping = mapping
36
 
        super(ForeignBranch, self).__init__()
37
 
 
38
 
    def dpull(self, source, stop_revision=None):
39
 
        """Pull deltas from another branch.
40
 
 
41
 
        :note: This does not, like pull, retain the revision ids from 
42
 
            the source branch and will, rather than adding bzr-specific 
43
 
            metadata, push only those semantics of the revision that can be 
44
 
            natively represented in this branch.
45
 
 
46
 
        :param source: Source branch
47
 
        :param stop_revision: Revision to pull, defaults to last revision.
48
 
        :return: Revision id map and file id map
49
 
        """
50
 
        raise NotImplementedError(self.dpull)
51
 
 
52
 
 
53
28
class FakeControlFiles(object):
54
29
    """Dummy implementation of ControlFiles.
55
30
    
145
120
    testmod_names = ['test_versionedfiles', ]
146
121
    suite.addTest(loader.loadTestsFromModuleNames(testmod_names))
147
122
    return suite
148
 
 
149
 
 
150
 
def escape_commit_message(message):
151
 
    """Replace xml-incompatible control characters."""
152
 
    if message is None:
153
 
        return None
154
 
    import re
155
 
    # FIXME: RBC 20060419 this should be done by the revision
156
 
    # serialiser not by commit. Then we can also add an unescaper
157
 
    # in the deserializer and start roundtripping revision messages
158
 
    # precisely. See repository_implementations/test_repository.py
159
 
    
160
 
    # Python strings can include characters that can't be
161
 
    # represented in well-formed XML; escape characters that
162
 
    # aren't listed in the XML specification
163
 
    # (http://www.w3.org/TR/REC-xml/#NT-Char).
164
 
    message, _ = re.subn(
165
 
        u'[^\x09\x0A\x0D\u0020-\uD7FF\uE000-\uFFFD]+',
166
 
        lambda match: match.group(0).encode('unicode_escape'),
167
 
        message)
168
 
    return message
169
 
 
170