/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 branch.py

Share more code between local and remote classes, support opening remote branches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
class GitBranch(ForeignBranch):
69
69
    """An adapter to git repositories for bzr Branch objects."""
70
70
 
71
 
    def __init__(self, bzrdir, repository, head, base, lockfiles):
 
71
    def __init__(self, bzrdir, repository, name, head, lockfiles):
72
72
        self.repository = repository
73
73
        super(GitBranch, self).__init__(default_mapping)
74
74
        self.control_files = lockfiles
75
75
        self.bzrdir = bzrdir
 
76
        self.name = name
76
77
        self.head = head
77
 
        self.base = base
78
78
        self._format = GitBranchFormat()
79
79
 
80
80
    def lock_write(self):
81
81
        self.control_files.lock_write()
82
82
 
 
83
    def get_stacked_on_url(self):
 
84
        # Git doesn't do stacking (yet...)
 
85
        return None
 
86
 
 
87
    def get_parent(self):
 
88
        """See Branch.get_parent()."""
 
89
        return None
 
90
 
 
91
    def lock_read(self):
 
92
        self.control_files.lock_read()
 
93
 
 
94
    def unlock(self):
 
95
        self.control_files.unlock()
 
96
 
 
97
    def get_physical_lock_status(self):
 
98
        return False
 
99
 
 
100
 
 
101
class LocalGitBranch(GitBranch):
 
102
 
83
103
    @needs_read_lock
84
104
    def last_revision(self):
85
105
        # perhaps should escape this ?
90
110
    def _make_tags(self):
91
111
        return GitTagDict(self)
92
112
 
93
 
    def get_parent(self):
94
 
        """See Branch.get_parent()."""
95
 
        return None
96
 
 
97
 
    def get_stacked_on_url(self):
98
 
        return None
99
 
 
100
113
    def _gen_revision_history(self):
101
114
        if self.head is None:
102
115
            return []
107
120
    def get_config(self):
108
121
        return GitBranchConfig(self)
109
122
 
110
 
    def lock_read(self):
111
 
        self.control_files.lock_read()
112
 
 
113
 
    def unlock(self):
114
 
        self.control_files.unlock()
115
 
 
116
 
    def get_physical_lock_status(self):
117
 
        return False
118
 
 
119
123
    def get_push_location(self):
120
124
        """See Branch.get_push_location."""
121
125
        push_loc = self.get_config().get_user_option('push_location')