[PATCH] localrepo: use lock.release for single lock
Simon Heimberg
simohe at besonet.ch
Wed May 27 07:19:09 CDT 2009
# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1243426573 -7200
# Node ID 70fe60e393bcec83fd1ddf6353754cb309e2ef72
# Parent 17932e23219a18f437a50638d1acf6240e7359e5
localrepo: use lock.release for single lock
diff -r 17932e23219a -r 70fe60e393bc mercurial/localrepo.py
--- a/mercurial/localrepo.py Mit Mai 27 14:16:10 2009 +0200
+++ b/mercurial/localrepo.py Mit Mai 27 14:16:13 2009 +0200
@@ -966,18 +966,17 @@
# update dirstate for files that are actually clean
if fixup:
- wlock = None
try:
+ wlock = self.wlock(False)
try:
# updating the dirstate is optional
# so we don't wait on the lock
- wlock = self.wlock(False)
for f in fixup:
self.dirstate.normal(f)
- except error.LockError:
- pass
- finally:
- release(wlock)
+ finally:
+ wlock.release()
+ except error.LockError:
+ pass
if not parentworking:
mf1 = mfmatches(ctx1)
@@ -1057,16 +1056,15 @@
wlock.release()
def remove(self, list, unlink=False):
- wlock = None
+ if unlink:
+ for f in list:
+ try:
+ util.unlink(self.wjoin(f))
+ except OSError, inst:
+ if inst.errno != errno.ENOENT:
+ raise
+ wlock = self.wlock()
try:
- if unlink:
- for f in list:
- try:
- util.unlink(self.wjoin(f))
- except OSError, inst:
- if inst.errno != errno.ENOENT:
- raise
- wlock = self.wlock()
for f in list:
if unlink and os.path.exists(self.wjoin(f)):
self.ui.warn(_("%s still exists!\n") % f)
@@ -1077,7 +1075,7 @@
else:
self.dirstate.remove(f)
finally:
- release(wlock)
+ wlock.release()
def undelete(self, list):
manifests = [self.manifest.read(self.changelog.read(p)[0])
More information about the Mercurial-devel
mailing list