Skip to content

Commit

Permalink
it will now parse the repo name
Browse files Browse the repository at this point in the history
  • Loading branch information
schacon committed Aug 9, 2009
1 parent d8a99df commit 694d36c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
12 changes: 11 additions & 1 deletion dulwich/agitmemnon.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@ def fetch_objects(self, determine_wants, graph_walker, progress):

def get_refs(self):
"""Get dictionary with all refs."""
print self.repo_name
ret = {}
refs = self.get_super('Repositories', 'fuzed') # TODO: dont hardcode the repo
refs = self.get_super('Repositories', self.repo_name)
for x in refs:
for col in x.columns:
if len(col.value) == 40:
Expand All @@ -119,12 +120,21 @@ def get_refs(self):
ret['HEAD'] = col.value
return ret

def set_args(self, args):
rname = args[0]
if rname[0] == '/':
rname = rname[1:len(rname)]
if rname.endswith('.git'):
rname = rname.replace('.git','')
self.repo_name = rname

class AgitmemnonBackend(Backend):

def __init__(self):
self.repo = Agitmemnon()
self.fetch_objects = self.repo.fetch_objects
self.get_refs = self.repo.get_refs
self.set_args = self.repo.set_args


#a = Agitmemnon()
Expand Down
7 changes: 4 additions & 3 deletions dulwich/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,10 @@ def apply_pack(self, refs, read):
class Handler(object):
"""Smart protocol command handler base class."""

def __init__(self, backend, read, write):
def __init__(self, backend, read, write, args):
self.backend = backend
self.proto = Protocol(read, write)
self.backend.set_args(args)

def capabilities(self):
return " ".join(self.default_capabilities())
Expand Down Expand Up @@ -231,8 +232,8 @@ def handle(self):
cls = ReceivePackHandler
else:
return

h = cls(self.server.backend, self.rfile.read, self.wfile.write)
h = cls(self.server.backend, self.rfile.read, self.wfile.write, args)
h.handle()


Expand Down

0 comments on commit 694d36c

Please sign in to comment.