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

Get viz working, with new -r support

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
"""A GIT branch and repository format implementation for bzr."""
20
20
 
21
21
 
 
22
from StringIO import StringIO
 
23
 
22
24
import stgit
23
25
import stgit.git as git
24
26
 
30
32
from bzrlib.revision import Revision
31
33
 
32
34
 
 
35
class GitTransport(object):
 
36
 
 
37
    def __init__(self):
 
38
        self.base = object()
 
39
 
 
40
    def get(self, relpath):
 
41
        assert relpath == 'branch.conf'
 
42
        return StringIO()
 
43
 
 
44
 
33
45
def gitrevid_from_bzr(revision_id):
34
46
    return revision_id[4:]
35
47
 
59
71
        self._transaction = None
60
72
        self._lock_mode = None
61
73
        self._lock_count = 0
 
74
        self._transport = GitTransport() 
62
75
 
63
76
 
64
77
class GitDir(bzrlib.bzrdir.BzrDir):
154
167
        # perhaps should escape this ?
155
168
        return bzrrevid_from_git(git.get_head())
156
169
 
 
170
    def revision_history(self):
 
171
        history = [self.last_revision()]
 
172
        while True:
 
173
            revision = self.repository.get_revision(history[-1])
 
174
            if len(revision.parent_ids) == 0:
 
175
                break
 
176
            history.append(revision.parent_ids[0])
 
177
        return list(reversed(history))
 
178
 
157
179
    def lock_read(self):
158
180
        self.control_files.lock_read()
159
181