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

Implement GitDir.list_branches() and support name argument to open_branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
111
111
    get_repository_transport = get_branch_transport
112
112
    get_workingtree_transport = get_branch_transport
113
113
 
114
 
    def open_branch(self, ignore_fallbacks=None):
 
114
    def open_branch(self, name=None, ignore_fallbacks=None):
115
115
        """'create' a branch for this dir."""
116
116
        repo = self.open_repository()
117
117
        from bzrlib.plugins.git.branch import LocalGitBranch
118
 
        return LocalGitBranch(self, repo, "HEAD", self._lockfiles)
 
118
        if name is None:
 
119
            name = "HEAD"
 
120
        return LocalGitBranch(self, repo, name, self._lockfiles)
 
121
 
 
122
    def list_branches(self):
 
123
        ret = []
 
124
        for name in self._git.get_refs():
 
125
            ret.append(self.open_branch(name=name))
 
126
        return ret
119
127
 
120
128
    def open_repository(self, shared=False):
121
129
        """'open' a repository for this dir."""