~ubuntu-branches/ubuntu/vivid/dulwich/vivid-proposed

« back to all changes in this revision

Viewing changes to dulwich/server.py

  • Committer: Package Import Robot
  • Author(s): Jelmer Vernooij
  • Date: 2013-11-30 16:21:10 UTC
  • mfrom: (1.5.3)
  • Revision ID: package-import@ubuntu.com-20131130162110-8sm1dag21auasyc8
Tags: 0.9.4-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# server.py -- Implementation of the server side git protocols
2
2
# Copyright (C) 2008 John Carr <john.carr@unrouted.co.uk>
 
3
# Coprygith (C) 2011-2012 Jelmer Vernooij <jelmer@samba.org>
3
4
#
4
5
# This program is free software; you can redistribute it and/or
5
6
# modify it under the terms of the GNU General Public License
76
77
    extract_capabilities,
77
78
    extract_want_line_capabilities,
78
79
    )
 
80
from dulwich.refs import (
 
81
    write_info_refs,
 
82
    )
79
83
from dulwich.repo import (
80
84
    Repo,
81
85
    )
100
104
class BackendRepo(object):
101
105
    """Repository abstraction used by the Git server.
102
106
 
103
 
    Please note that the methods required here are a
104
 
    subset of those provided by dulwich.repo.Repo.
 
107
    The methods required here are a subset of those provided by
 
108
    dulwich.repo.Repo.
105
109
    """
106
110
 
107
111
    object_store = None
828
832
def generate_info_refs(repo):
829
833
    """Generate an info refs file."""
830
834
    refs = repo.get_refs()
831
 
    for name in sorted(refs.iterkeys()):
832
 
        # get_refs() includes HEAD as a special case, but we don't want to
833
 
        # advertise it
834
 
        if name == 'HEAD':
835
 
            continue
836
 
        sha = refs[name]
837
 
        o = repo.object_store[sha]
838
 
        if not o:
839
 
            continue
840
 
        yield '%s\t%s\n' % (sha, name)
841
 
        peeled_sha = repo.get_peeled(name)
842
 
        if peeled_sha != sha:
843
 
            yield '%s\t%s^{}\n' % (peeled_sha, name)
 
835
    return write_info_refs(repo.get_refs(), repo.object_store)
844
836
 
845
837
 
846
838
def generate_objects_info_packs(repo):