Exemplo n.º 1
0
 def _check_component_tarballs(self, repo, files):
     for file in files:
         ok_(
             to_bin(file) in repo.ls_tree('HEAD'),
             "Could not find component tarball file %s in %s" %
             (file, repo.ls_tree('HEAD')))
         ok_(
             to_bin(file) in repo.ls_tree('upstream'),
             "Could not find component tarball file %s in %s" %
             (file, repo.ls_tree('upstream')))
Exemplo n.º 2
0
    def add_symlink(self, linkname, linktarget):
        """
        Add a symlink

        @param linkname: the symbolic link's name
        @param linkname: C{str}
        @param linktarget: the target the symlink points to
        @type linktarget: C{str}
        """
        linktarget = to_bin(linktarget)
        linkname = to_bin(linkname)
        self._out.write(format_b(b"M %d inline %s\n", self.m_symlink, linkname))
        self._out.write(format_b(b"data %d\n", len(linktarget)))
        self._out.write(format_b(b"%s\n", linktarget))
Exemplo n.º 3
0
    def add_symlink(self, linkname, linktarget):
        """
        Add a symlink

        @param linkname: the symbolic link's name
        @param linkname: C{str}
        @param linktarget: the target the symlink points to
        @type linktarget: C{str}
        """
        linktarget = to_bin(linktarget)
        linkname = to_bin(linkname)
        self._out.write(b"M %d inline %s\n" % (self.m_symlink, linkname))
        self._out.write(b"data %d\n" % len(linktarget))
        self._out.write(b"%s\n" % linktarget)
Exemplo n.º 4
0
 def tree_get_dir(self, tree, dir):
     """
     Get the SHA1 of directory in a given tree
     """
     dir = to_bin(dir)
     toplevel = self.list_tree(tree)
     for m, t, s, n in toplevel:
         if n == dir and t == 'tree':
             return s
     return None
Exemplo n.º 5
0
 def tree_get_dir(self, tree, dir):
     """
     Get the SHA1 of directory in a given tree
     """
     dir = to_bin(dir)
     toplevel = self.list_tree(tree)
     for m, t, s, n in toplevel:
         if n == dir and t == 'tree':
             return s
     return None
Exemplo n.º 6
0
    def tree_drop_dirs(self, tree, dirs):
        """
        Drop the given top level dirs from the given git tree
        returning a new tree object.
        """
        objs = self.list_tree(tree)
        new_tree_objs = []
        dirs = [to_bin(d) for d in dirs]

        for m, t, s, n in objs:
            if not (n in dirs and t == 'tree'):
                new_tree_objs.append((m, t, s, n))
        new_tree = self.make_tree(new_tree_objs)
        return new_tree
Exemplo n.º 7
0
    def tree_drop_dirs(self, tree, dirs):
        """
        Drop the given top level dirs from the given git tree
        returning a new tree object.
        """
        objs = self.list_tree(tree)
        new_tree_objs = []
        dirs = [to_bin(d) for d in dirs]

        for m, t, s, n in objs:
            if not (n in dirs and t == 'tree'):
                new_tree_objs.append((m, t, s, n))
        new_tree = self.make_tree(new_tree_objs)
        return new_tree
 def _check_component_tarballs(self, repo, files):
     for file in files:
         ok_(to_bin(file) in repo.ls_tree('HEAD'),
             "Could not find component tarball file %s in %s" % (file, repo.ls_tree('HEAD')))
         ok_(to_bin(file) in repo.ls_tree('upstream'),
             "Could not find component tarball file %s in %s" % (file, repo.ls_tree('upstream')))
Exemplo n.º 9
0
 def _do_file(self, filename, mode, fd, size):
     name = b"/".join(to_bin(filename).split(b'/')[1:])
     self._out.write(format_b(b"M %d inline %s\n", mode, name))
     self._do_data(fd, size)
Exemplo n.º 10
0
 def _do_file(self, filename, mode, fd, size):
     name = b"/".join(to_bin(filename).split(b'/')[1:])
     self._out.write(format_b(b"M %d inline %s\n", mode, name))
     self._do_data(fd, size)