~ubuntu-branches/ubuntu/utopic/dulwich/utopic

« back to all changes in this revision

Viewing changes to dulwich/server.py

  • Committer: Package Import Robot
  • Author(s): Jelmer Vernooij
  • Date: 2014-04-23 01:41:04 UTC
  • mfrom: (1.5.5)
  • Revision ID: package-import@ubuntu.com-20140423014104-nulhaisomztpfriy
Tags: 0.9.6-1
* New upstream release.
* Allow output to stderr in autopktest.

Show diffs side-by-side

added added

removed removed

Lines of Context:
322
322
                return tuple(fields)
323
323
            elif command == 'deepen':
324
324
                return command, int(fields[1])
325
 
    except (TypeError, AssertionError), e:
 
325
    except (TypeError, AssertionError) as e:
326
326
        raise GitProtocolError(e)
327
327
    raise GitProtocolError('Received invalid line from client: %s' % line)
328
328
 
411
411
        :param heads: a dict of refname->SHA1 to advertise
412
412
        :return: a list of SHA1s requested by the client
413
413
        """
414
 
        if not heads:
415
 
            # The repo is empty, so short-circuit the whole process.
416
 
            self.proto.write_pkt_line(None)
417
 
            return []
418
414
        values = set(heads.itervalues())
419
415
        if self.advertise_refs or not self.http_req:
420
416
            for i, (ref, sha) in enumerate(sorted(heads.iteritems())):
478
474
        if not self._cached:
479
475
            if not self._impl and self.http_req:
480
476
                return None
481
 
            return self._impl.next()
 
477
            return next(self._impl)
482
478
        self._cache_index += 1
483
479
        if self._cache_index > len(self._cache):
484
480
            return None
714
710
                recv = getattr(self.proto, "recv", None)
715
711
                p = self.repo.object_store.add_thin_pack(self.proto.read, recv)
716
712
                status.append(('unpack', 'ok'))
717
 
            except all_exceptions, e:
 
713
            except all_exceptions as e:
718
714
                status.append(('unpack', str(e).replace('\n', '')))
719
715
                # The pack may still have been moved in, but it may contain broken
720
716
                # objects. We trust a later GC to clean it up.
740
736
                        self.repo.refs[ref] = sha
741
737
                    except all_exceptions:
742
738
                        ref_status = 'failed to write'
743
 
            except KeyError, e:
 
739
            except KeyError as e:
744
740
                ref_status = 'bad ref'
745
741
            status.append((ref, ref_status))
746
742