Permalink
Browse files

fix uses of old api (Repo.{set,remove}_ref ObjectStore.add_pack)

  • Loading branch information...
1 parent 65aab9c commit 0500df11200901b7158fe5f98e54fb2f8dd91fe8 @abderrahim abderrahim committed Jul 17, 2009
Showing with 9 additions and 11 deletions.
  1. +2 −5 bin/dulwich
  2. +7 −6 dulwich/server.py
View
7 bin/dulwich
@@ -43,12 +43,9 @@ def cmd_fetch_pack(args):
graphwalker = r.get_graph_walker()
f, commit = r.object_store.add_pack()
try:
- client.fetch_pack(path, determine_wants, graphwalker, f.write, sys.stdout.write)
- f.close()
+ client.fetch_pack(path, determine_wants, graphwalker, f.write, sys.stdout.write)
+ finally:
commit()
- except:
- f.close()
- raise
def cmd_log(args):
View
13 dulwich/server.py
@@ -77,16 +77,17 @@ def __init__(self, gitdir=None):
self.get_refs = self.repo.get_refs
def apply_pack(self, refs, read):
- fd, commit = self.repo.object_store.add_thin_pack()
- fd.write(read())
- fd.close()
- commit()
+ f, commit = self.repo.object_store.add_thin_pack()
+ try:
+ f.write(read())
+ finally:
+ commit()
for oldsha, sha, ref in refs:
if ref == "0" * 40:
- self.repo.remove_ref(ref)
+ del self.repo.refs[ref]
else:
- self.repo.set_ref(ref, sha)
+ self.repo.refs[ref] = sha
print "pack applied"

0 comments on commit 0500df1

Please sign in to comment.