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

Remove some experimental cruft.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
import os
20
20
import subprocess
21
 
import tarfile
22
21
 
23
22
from bzrlib.plugins.git import errors
24
23
 
125
124
                name = name[1:-1].decode('string_escape')
126
125
            name = name.decode('utf-8')
127
126
            yield permissions, type, hash, name
128
 
 
129
 
    def get_tarpipe(self, tree_id):
130
 
        cmd = self.git_command('archive', [tree_id])
131
 
        env = os.environ.copy()
132
 
        env['GIT_DIR'] = self.git_dir
133
 
        p = subprocess.Popen(cmd,
134
 
                             stdin=subprocess.PIPE,
135
 
                             stdout=subprocess.PIPE,
136
 
                             stderr=subprocess.PIPE,
137
 
                             env=env)
138
 
        p.stdin.close()
139
 
        tarpipe = TarPipe.open(mode='r|', fileobj=p.stdout)
140
 
        def close_callback():
141
 
            if p.wait() != 0:
142
 
                raise errors.GitCommandError(cmd, p.returncode,
143
 
                                             p.stderr.read().strip())
144
 
        tarpipe.set_close_callback(close_callback)
145
 
        return tarpipe
146
 
 
147
 
 
148
 
class TarPipe(tarfile.TarFile):
149
 
 
150
 
    def set_close_callback(self, close_callback):
151
 
        self.__close_callback = close_callback
152
 
 
153
 
    def close(self):
154
 
        super(TarPipe, self).close()
155
 
        self.__close_callback()