comparison hgext/largefiles/overrides.py @ 27825:4692571df9ee

with: use context manager for wlock in overridepurge
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:46 -0800
parents 0e55e93b50b5
children f087b7095381
comparison
equal deleted inserted replaced
27824:0e55e93b50b5 27825:4692571df9ee
1221 unknown, ignored, r.clean) 1221 unknown, ignored, r.clean)
1222 repo.status = overridestatus 1222 repo.status = overridestatus
1223 orig(ui, repo, *dirs, **opts) 1223 orig(ui, repo, *dirs, **opts)
1224 repo.status = oldstatus 1224 repo.status = oldstatus
1225 def overriderollback(orig, ui, repo, **opts): 1225 def overriderollback(orig, ui, repo, **opts):
1226 wlock = repo.wlock() 1226 with repo.wlock():
1227 try:
1228 before = repo.dirstate.parents() 1227 before = repo.dirstate.parents()
1229 orphans = set(f for f in repo.dirstate 1228 orphans = set(f for f in repo.dirstate
1230 if lfutil.isstandin(f) and repo.dirstate[f] != 'r') 1229 if lfutil.isstandin(f) and repo.dirstate[f] != 'r')
1231 result = orig(ui, repo, **opts) 1230 result = orig(ui, repo, **opts)
1232 after = repo.dirstate.parents() 1231 after = repo.dirstate.parents()
1256 lfutil.synclfdirstate(repo, lfdirstate, file, True) 1255 lfutil.synclfdirstate(repo, lfdirstate, file, True)
1257 orphans.discard(file) 1256 orphans.discard(file)
1258 for lfile in orphans: 1257 for lfile in orphans:
1259 lfdirstate.drop(lfile) 1258 lfdirstate.drop(lfile)
1260 lfdirstate.write() 1259 lfdirstate.write()
1261 finally:
1262 wlock.release()
1263 return result 1260 return result
1264 1261
1265 def overridetransplant(orig, ui, repo, *revs, **opts): 1262 def overridetransplant(orig, ui, repo, *revs, **opts):
1266 resuming = opts.get('continue') 1263 resuming = opts.get('continue')
1267 repo._lfcommithooks.append(lfutil.automatedcommithook(resuming)) 1264 repo._lfcommithooks.append(lfutil.automatedcommithook(resuming))