Beispiel #1
0
    def next(self):
        if self._cached:
            try:
                self._idx += 1
                return self._topo_list[self._idx]
            except IndexError:
                self._idx = -1
                raise StopIteration

        if self._proc is None:
            ref_args = utils.shell_split(self.ctx.ref)
            cmd = self._cmd + ['-%d' % self.ctx.count] + ref_args
            self._proc = core.start_command(cmd)
            self._topo_list = []

        log_entry = core.readline(self._proc.stdout).rstrip()
        if not log_entry:
            self._cached = True
            self._proc.wait()
            self.returncode = self._proc.returncode
            self._proc = None
            raise StopIteration

        sha1 = log_entry[:40]
        try:
            return self._objects[sha1]
        except KeyError:
            c = CommitFactory.new(log_entry=log_entry)
            self._objects[c.sha1] = c
            self._topo_list.append(c)
            return c
Beispiel #2
0
    def next(self):
        if self._cached:
            try:
                self._idx += 1
                return self._topo_list[self._idx]
            except IndexError:
                self._idx = -1
                raise StopIteration

        if self._proc is None:
            ref_args = utils.shell_split(self.dag.ref)
            cmd = self._cmd + ['-%d' % self.dag.count] + ref_args
            self._proc = core.start_command(cmd)
            self._topo_list = []

        log_entry = core.readline(self._proc.stdout).rstrip()
        if not log_entry:
            self._cached = True
            self._proc.wait()
            self._proc = None
            raise StopIteration

        sha1 = log_entry[:40]
        try:
            return self._objects[sha1]
        except KeyError:
            c = CommitFactory.new(log_entry=log_entry)
            self._objects[c.sha1] = c
            self._topo_list.append(c)
            return c
Beispiel #3
0
 def do(self):
     fp = core.xopen(self.filename, 'wb')
     cmd = ['git', 'archive', '--format='+self.fmt]
     if self.fmt in ('tgz', 'tar.gz'):
         cmd.append('-9')
     if self.prefix:
         cmd.append('--prefix=' + self.prefix)
     cmd.append(self.ref)
     proc = core.start_command(cmd, stdout=fp)
     out, err = proc.communicate()
     fp.close()
     status = proc.returncode
     Interaction.log_status(status, out or '', err or '')
Beispiel #4
0
 def do(self):
     fp = core.xopen(self.filename, 'wb')
     cmd = ['git', 'archive', '--format='+self.fmt]
     if self.fmt in ('tgz', 'tar.gz'):
         cmd.append('-9')
     if self.prefix:
         cmd.append('--prefix=' + self.prefix)
     cmd.append(self.ref)
     proc = core.start_command(cmd, stdout=fp)
     out, err = proc.communicate()
     fp.close()
     status = proc.returncode
     Interaction.log_status(status, out or '', err or '')
Beispiel #5
0
 def do(self):
     fp = core.xopen(self.filename, "wb")
     cmd = ["git", "archive", "--format=" + self.fmt]
     if self.fmt in ("tgz", "tar.gz"):
         cmd.append("-9")
     if self.prefix:
         cmd.append("--prefix=" + self.prefix)
     cmd.append(self.ref)
     proc = core.start_command(cmd, stdout=fp)
     out, err = proc.communicate()
     fp.close()
     status = proc.returncode
     Interaction.log_status(status, out or "", err or "")
Beispiel #6
0
    def do(self):
        model = self.model
        cmd = ["git", "show", "%s:%s" % (model.ref, model.relpath)]
        with core.xopen(model.filename, "wb") as fp:
            proc = core.start_command(cmd, stdout=fp)
            out, err = proc.communicate()

        status = proc.returncode
        msg = N_('Saved "%(filename)s" from "%(ref)s" to "%(destination)s"') % dict(
            filename=model.relpath, ref=model.ref, destination=model.filename
        )
        Interaction.log_status(status, msg, "")

        Interaction.information(N_("File Saved"), N_('File saved to "%s"') % model.filename)
Beispiel #7
0
    def do(self):
        model = self.model
        cmd = ['git', 'show', '%s:%s' % (model.ref, model.relpath)]
        with core.xopen(model.filename, 'wb') as fp:
            proc = core.start_command(cmd, stdout=fp)
            out, err = proc.communicate()

        status = proc.returncode
        msg = (N_('Saved "%(filename)s" from "%(ref)s" to "%(destination)s"') %
               dict(filename=model.relpath,
                    ref=model.ref,
                    destination=model.filename))
        Interaction.log_status(status, msg, '')

        Interaction.information(N_('File Saved'),
                                N_('File saved to "%s"') % model.filename)