~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/directory_service.py

  • Committer: Aaron Bentley
  • Date: 2008-09-20 18:16:22 UTC
  • mto: This revision was merged to the branch mainline in revision 3717.
  • Revision ID: aaron@aaronbentley.com-20080920181622-h91pl0beqjpg8iyy
Tweak logic to reduce string searching

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
            'push': branch.get_push_location,
75
75
            'this': lambda: branch.base
76
76
        }
77
 
        if '/' in url:
78
 
            name = url[1:url.find('/')]
79
 
            extra = url[url.find('/') + 1:]
 
77
        parts = url.split('/', 1)
 
78
        if len(parts) == 2:
 
79
            name, extra = parts
80
80
        else:
81
 
            name = url[1:]
 
81
            (name,) = parts
82
82
            extra = None
83
83
        try:
84
 
            method = lookups[name]
 
84
            method = lookups[name[1:]]
85
85
        except KeyError:
86
86
            raise errors.InvalidLocationAlias(url)
87
87
        else: