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

  • Committer: Jelmer Vernooij
  • Date: 2009-09-10 13:13:15 UTC
  • mto: (0.200.602 trunk)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@samba.org-20090910131315-6890xg58pl2jseml
Allow serving remote URLs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
from cStringIO import (
22
22
    StringIO,
23
23
    )
24
 
from dulwich.index import (
25
 
    Index,
26
 
    )
 
24
import errno
27
25
from dulwich.objects import (
28
26
    Blob,
29
27
    )
33
31
from bzrlib import (
34
32
    errors,
35
33
    ignores,
36
 
    inventory,
37
34
    lockable_files,
38
35
    lockdir,
39
36
    osutils,
44
41
    )
45
42
from bzrlib.decorators import (
46
43
    needs_read_lock,
47
 
    needs_write_lock,
48
44
    )
49
45
 
50
46
 
108
104
                except (errors.NoSuchFile, IOError):
109
105
                    # TODO: Rather than come up with something here, use the old index
110
106
                    file = StringIO()
111
 
                    stat_val = (0, 0, 0, 0, stat.S_IFREG | 0644, 0, 0, 0, 0, 0)
 
107
                    from posix import stat_result
 
108
                    stat_val = stat_result((stat.S_IFREG | 0644, 0, 0, 0, 0, 0, 0, 0, 0, 0))
112
109
                blob.set_raw_string(file.read())
113
110
            elif entry.kind == "symlink":
114
111
                blob = Blob()
117
114
                except (errors.NoSuchFile, OSError):
118
115
                    # TODO: Rather than come up with something here, use the 
119
116
                    # old index
120
 
                    stat_val = (0, 0, 0, 0, stat.S_IFLNK, 0, 0, 0, 0, 0)
 
117
                    from posix import stat_result
 
118
                    stat_val = stat_result((stat.S_IFLNK, 0, 0, 0, 0, 0, 0, 0, 0, 0))
121
119
                blob.set_raw_string(entry.symlink_target)
122
120
            # Add object to the repository if it didn't exist yet
123
121
            if not blob.id in self.repository._git.object_store:
165
163
    def get_file_sha1(self, file_id, path=None, stat_value=None):
166
164
        if not path:
167
165
            path = self._inventory.id2path(file_id)
168
 
        return osutils.sha_file_by_name(self.abspath(path).encode(osutils._fs_enc))
 
166
        try:
 
167
            return osutils.sha_file_by_name(self.abspath(path).encode(osutils._fs_enc))
 
168
        except OSError, (num, msg):
 
169
            if num in (errno.EISDIR, errno.ENOENT):
 
170
                return None
 
171
            raise
169
172
 
170
173
    def iter_changes(self, from_tree, include_unchanged=False,
171
174
                     specific_files=None, pb=None, extra_trees=None,