Example #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.dag.ref)
         cmd = self._cmd + ['-%d' % self.dag.count] + ref_args
         self._proc = utils.start_command(cmd)
         self._topo_list = []
     log_entry = self._proc.stdout.readline().rstrip()
     if not log_entry:
         del self._proc
         self._cached = True
         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
Example #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 = utils.start_command(cmd)
            self._topo_list = []

        log_entry = core.readline(self._proc.stdout).rstrip()
        if not log_entry:
            del self._proc
            self._cached = True
            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
Example #3
0
 def do(self):
     fp = open(core.encode(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 = utils.start_command(cmd, stdout=fp)
     out, err = proc.communicate()
     fp.close()
     status = proc.returncode
     Interaction.log_status(status, out or '', err or '')
Example #4
0
 def do(self):
     fp = open(core.encode(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 = utils.start_command(cmd, stdout=fp)
     out, err = proc.communicate()
     fp.close()
     status = proc.returncode
     Interaction.log_status(status, out or "", err or "")
Example #5
0
 def do(self):
     fp = open(core.encode(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 = utils.start_command(cmd, stdout=fp)
     out, err = proc.communicate()
     fp.close()
     status = proc.returncode
     Interaction.log_status(status, out or '', err or '')
Example #6
0
 def do(self):
     fp = open(core.encode(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 = utils.start_command(cmd, stdout=fp)
     out, err = proc.communicate()
     fp.close()
     if not out:
         out = ''
     if err:
         out += err
     status = proc.returncode
     cola.notifier().broadcast(signals.log_cmd, status, out)
Example #7
0
 def do(self):
     fp = open(core.encode(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 = utils.start_command(cmd, stdout=fp)
     out, err = proc.communicate()
     fp.close()
     if not out:
         out = ''
     if err:
         out += err
     status = proc.returncode
     cola.notifier().broadcast(signals.log_cmd, status, out)
Example #8
0
    def do(self):
        context = self.context
        ref = core.encode(context.ref)
        relpath = core.encode(context.relpath)

        cmd = ['git', 'show', '%s:%s' % (ref, relpath)]
        fp = open(core.encode(context.filename), 'wb')
        proc = utils.start_command(cmd, stdout=fp)

        out, err = proc.communicate()
        fp.close()

        status = proc.returncode
        msg = ('Saved "%s" from %s to "%s"' %
               (context.relpath, context.ref, context.filename))
        cola.notifier().broadcast(signals.log_cmd, status, msg)

        self.factory.prompt_user(signals.information, 'File Saved',
                                 'File saved to "%s"' % context.filename)
Example #9
0
    def do(self):
        context = self.context
        ref = core.encode(context.ref)
        relpath = core.encode(context.relpath)

        cmd = ['git', 'show', '%s:%s' % (ref, relpath)]
        fp = open(core.encode(context.filename), 'wb')
        proc = utils.start_command(cmd, stdout=fp)

        out, err = proc.communicate()
        fp.close()

        status = proc.returncode
        msg = ('Saved "%s" from %s to "%s"' %
               (context.relpath, context.ref, context.filename))
        cola.notifier().broadcast(signals.log_cmd, status, msg)

        self.factory.prompt_user(signals.information,
                                 'File Saved',
                                 'File saved to "%s"' % context.filename)
Example #10
0
    def do(self):
        model = self.model
        ref = core.encode(model.ref)
        relpath = core.encode(model.relpath)

        cmd = ['git', 'show', '%s:%s' % (ref, relpath)]
        fp = open(core.encode(model.filename), 'wb')
        proc = utils.start_command(cmd, stdout=fp)

        out, err = proc.communicate()
        fp.close()

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

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