changeset 488:45b3b6ca046f

Repository locking mechanism is alive
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Mon, 13 Aug 2012 19:07:59 +0200
parents db48a77ec8ff
children 9c0138cda59a
files src/org/tmatesoft/hg/repo/HgRepository.java src/org/tmatesoft/hg/repo/HgRepositoryLock.java
diffstat 2 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgRepository.java	Mon Aug 13 18:11:47 2012 +0200
+++ b/src/org/tmatesoft/hg/repo/HgRepository.java	Mon Aug 13 19:07:59 2012 +0200
@@ -439,9 +439,10 @@
 	public HgRepositoryLock getWorkingDirLock() {
 		if (wdLock == null) {
 			int timeout = getLockTimeout();
+			File lf = new File(getRepositoryRoot(), "wlock");
 			synchronized (this) {
 				if (wdLock == null) {
-					wdLock = new HgRepositoryLock(new File(repoPathHelper.rewrite("wlock").toString()), timeout);
+					wdLock = new HgRepositoryLock(lf, timeout);
 				}
 			}
 		}
@@ -452,9 +453,10 @@
 	public HgRepositoryLock getStoreLock() {
 		if (storeLock == null) {
 			int timeout = getLockTimeout();
+			File fl = new File(getRepositoryRoot(), repoPathHelper.rewrite("lock").toString());
 			synchronized (this) {
 				if (storeLock == null) {
-					storeLock = new HgRepositoryLock(new File(repoPathHelper.rewrite("store/lock").toString()), timeout);
+					storeLock = new HgRepositoryLock(fl, timeout);
 				}
 			}
 		}
--- a/src/org/tmatesoft/hg/repo/HgRepositoryLock.java	Mon Aug 13 18:11:47 2012 +0200
+++ b/src/org/tmatesoft/hg/repo/HgRepositoryLock.java	Mon Aug 13 19:07:59 2012 +0200
@@ -37,8 +37,8 @@
  */
 public class HgRepositoryLock {
 	/*
-	 * Lock .hg/ except .hg/store/      .hg/wlock (HgRepository.repoPathHelper("wlock"))
-	 * Lock .hg/store/                  .hg/store/lock (HgRepository.repoPathHelper("store/lock") ???)
+	 * Lock .hg/ except .hg/store/      .hg/wlock (new File(hgRepo.getRepoRoot(),"wlock"))
+	 * Lock .hg/store/                  .hg/store/lock (HgRepository.repoPathHelper("lock"))
 	 */
 
 	private final File lockFile;