##// END OF EJS Templates
largefiles: use try/except/finally
Matt Mackall -
r25079:bee00e0c default
parent child Browse files
Show More
@@ -578,7 +578,6 def overridecopy(orig, ui, repo, pats, o
578 nolfiles = False
578 nolfiles = False
579 installnormalfilesmatchfn(repo[None].manifest())
579 installnormalfilesmatchfn(repo[None].manifest())
580 try:
580 try:
581 try:
582 result = orig(ui, repo, pats, opts, rename)
581 result = orig(ui, repo, pats, opts, rename)
583 except util.Abort, e:
582 except util.Abort, e:
584 if str(e) != _('no files to copy'):
583 if str(e) != _('no files to copy'):
@@ -608,7 +607,6 def overridecopy(orig, ui, repo, pats, o
608 os.makedirs(makestandin(dest))
607 os.makedirs(makestandin(dest))
609
608
610 try:
609 try:
611 try:
612 # When we call orig below it creates the standins but we don't add
610 # When we call orig below it creates the standins but we don't add
613 # them to the dir state until later so lock during that time.
611 # them to the dir state until later so lock during that time.
614 wlock = repo.wlock()
612 wlock = repo.wlock()
@@ -31,7 +31,6 def putlfile(repo, proto, sha):
31 tmpfp = util.atomictempfile(path, createmode=repo.store.createmode)
31 tmpfp = util.atomictempfile(path, createmode=repo.store.createmode)
32
32
33 try:
33 try:
34 try:
35 proto.getfile(tmpfp)
34 proto.getfile(tmpfp)
36 tmpfp._fp.seek(0)
35 tmpfp._fp.seek(0)
37 if sha != lfutil.hexsha1(tmpfp._fp):
36 if sha != lfutil.hexsha1(tmpfp._fp):
@@ -36,13 +36,12 class remotestore(basestore.basestore):
36 self.ui.debug('remotestore: sendfile(%s, %s)\n' % (filename, hash))
36 self.ui.debug('remotestore: sendfile(%s, %s)\n' % (filename, hash))
37 fd = None
37 fd = None
38 try:
38 try:
39 try:
40 fd = lfutil.httpsendfile(self.ui, filename)
39 fd = lfutil.httpsendfile(self.ui, filename)
40 return self._put(hash, fd)
41 except IOError, e:
41 except IOError, e:
42 raise util.Abort(
42 raise util.Abort(
43 _('remotestore: could not open file %s: %s')
43 _('remotestore: could not open file %s: %s')
44 % (filename, str(e)))
44 % (filename, str(e)))
45 return self._put(hash, fd)
46 finally:
45 finally:
47 if fd:
46 if fd:
48 fd.close()
47 fd.close()
General Comments 0
You need to be logged in to leave comments. Login now