~bzr/ubuntu/intrepid/bzr-svn/bzr-ppa

« back to all changes in this revision

Viewing changes to mapping2.py

  • Committer: Gary van der Merwe
  • Date: 2010-02-11 01:38:09 UTC
  • mfrom: (309.2.49 unstable)
  • Revision ID: garyvdm@gmail.com-20100211013809-19kwah9hz03o3ujl
  * Merge debian unstable (1.0.2-2)
      [ Jelmer Vernooij ]
      * New upstream release.
      * Mark as compatible with Bazaar 2.1.
      * Bump standards version to 3.8.4.
      * Remove Reinhard from uploaders. Closes: #565128
      * Allow python-sqlite to not be installed if python-tdb is installed.: 1.0.2-2~bazaar2~intrepid1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Copyright (C) 2005-2009 Jelmer Vernooij <jelmer@samba.org>
2
 
 
 
2
 
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
5
5
# the Free Software Foundation; either version 2 of the License, or
45
45
class BzrSvnMappingv1(BzrSvnMapping):
46
46
    """This was the initial version of the mappings as used by bzr-svn
47
47
    0.2.
48
 
    
49
 
    It does not support pushing revisions to Subversion as-is, but only 
 
48
 
 
49
    It does not support pushing revisions to Subversion as-is, but only
50
50
    as part of a merge.
51
51
    """
52
52
    name = "v1"
119
119
    def from_repository(cls, repository, _hinted_branch_path=None):
120
120
        if _hinted_branch_path is None:
121
121
            return cls(TrunkLegacyLayout())
122
 
    
 
122
 
123
123
        return cls(LegacyLayout.from_branch_path(_hinted_branch_path))
124
124
 
125
125
    @classmethod
144
144
class BzrSvnMappingv2(BzrSvnMappingv1):
145
145
    """The second version of the mappings as used in the 0.3.x series.
146
146
 
147
 
    It does not support pushing revisions to Subversion as-is, but only 
 
147
    It does not support pushing revisions to Subversion as-is, but only
148
148
    as part of a merge.
149
149
    """
150
150
    name = "v2"
204
204
    def __init__(self, level=0):
205
205
        super(TrunkLegacyLayout, self).__init__()
206
206
        self.level = level
207
 
    
 
207
 
208
208
    def parse(self, path):
209
209
        parts = path.strip("/").split("/")
210
210
        if len(parts) == 0 or self.level >= len(parts):
211
211
            raise NotSvnBranchPath(path, self)
212
212
 
213
213
        if parts[self.level] == "trunk" or parts[self.level] == "hooks":
214
 
            return ("branch", "/".join(parts[0:self.level]), "/".join(parts[0:self.level+1]).strip("/"), 
 
214
            return ("branch", "/".join(parts[0:self.level]), "/".join(parts[0:self.level+1]).strip("/"),
215
215
                    "/".join(parts[self.level+1:]).strip("/"))
216
 
        elif ((parts[self.level] == "tags" or parts[self.level] == "branches") and 
 
216
        elif ((parts[self.level] == "tags" or parts[self.level] == "branches") and
217
217
              len(parts) >= self.level+2):
218
 
            return ("branch", "/".join(parts[0:self.level]), "/".join(parts[0:self.level+2]).strip("/"), 
 
218
            return ("branch", "/".join(parts[0:self.level]), "/".join(parts[0:self.level+2]).strip("/"),
219
219
                    "/".join(parts[self.level+2:]).strip("/"))
220
220
        else:
221
221
            raise NotSvnBranchPath(path, self)
232
232
        return False
233
233
 
234
234
    def get_branches(self, repository, revnum, project="", pb=None):
235
 
        return get_root_paths(repository, 
236
 
             [("*/" * self.level) + x for x in "branches/*", "tags/*", "trunk"], 
 
235
        return get_root_paths(repository,
 
236
             [("*/" * self.level) + x for x in "branches/*", "tags/*", "trunk"],
237
237
             revnum, self.is_branch, project)
238
238
 
239
239
    def get_tags(self, repository, revnum, project="", pb=None):