def __call__(self, inv, parent_ie, path, kind): # The first part just logs if appropriate # Now generate a custom id file_id = osutils.safe_file_id(kind + '-' + path.replace('/', '%'), warn=False) if self.should_print: self._to_file.write('added %s with id %s\n' % (path, file_id)) return file_id
def __call__(self, inv, parent_ie, path, kind): # The first part just logs if appropriate # Now generate a custom id file_id = osutils.safe_file_id(kind + '-' + path.raw_path.replace('/', '%'), warn=False) if self.should_print: self._to_file.write('added %s with id %s\n' % (path.raw_path, file_id)) return file_id
def added(kind, extra, lines): info = extra.split(' // ') if len(info) <= 1: raise BzrError('add action lines require the path and file id' ': %r' % extra) elif len(info) > 5: raise BzrError('add action lines have fewer than 5 entries.' ': %r' % extra) path = info[0] if not info[1].startswith('file-id:'): raise BzrError('The file-id should follow the path for an add' ': %r' % extra) # This will be Unicode because of how the stream is read. Turn it # back into a utf8 file_id file_id = osutils.safe_file_id(info[1][8:], warn=False) bundle_tree.note_id(file_id, path, kind) # this will be overridden in extra_info if executable is specified. bundle_tree.note_executable(path, False) last_changed, encoding = extra_info(info[2:], path) revision = get_rev_id(last_changed, path, kind) if kind == 'directory': return do_patch(path, lines, encoding)