Show More
@@ -651,6 +651,9 b' class localrepository(repo.repository):' | |||||
651 | return l |
|
651 | return l | |
652 |
|
652 | |||
653 | def lock(self, wait=True): |
|
653 | def lock(self, wait=True): | |
|
654 | '''Lock the repository store (.hg/store) and return a weak reference | |||
|
655 | to the lock. Use this before modifying the store (e.g. committing or | |||
|
656 | stripping). If you are opening a transaction, get a lock as well.)''' | |||
654 | l = self._lockref and self._lockref() |
|
657 | l = self._lockref and self._lockref() | |
655 | if l is not None and l.held: |
|
658 | if l is not None and l.held: | |
656 | l.lock() |
|
659 | l.lock() | |
@@ -662,6 +665,9 b' class localrepository(repo.repository):' | |||||
662 | return l |
|
665 | return l | |
663 |
|
666 | |||
664 | def wlock(self, wait=True): |
|
667 | def wlock(self, wait=True): | |
|
668 | '''Lock the non-store parts of the repository (everything under | |||
|
669 | .hg except .hg/store) and return a weak reference to the lock. | |||
|
670 | Use this before modifying files in .hg.''' | |||
665 | l = self._wlockref and self._wlockref() |
|
671 | l = self._wlockref and self._wlockref() | |
666 | if l is not None and l.held: |
|
672 | if l is not None and l.held: | |
667 | l.lock() |
|
673 | l.lock() |
@@ -1,4 +1,4 b'' | |||||
1 | # lock.py - simple locking scheme for mercurial |
|
1 | # lock.py - simple advisory locking scheme for mercurial | |
2 | # |
|
2 | # | |
3 | # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com> |
|
3 | # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com> | |
4 | # |
|
4 | # | |
@@ -10,6 +10,15 b' import errno, os, socket, time' | |||||
10 | import warnings |
|
10 | import warnings | |
11 |
|
11 | |||
12 | class lock(object): |
|
12 | class lock(object): | |
|
13 | '''An advisory lock held by one process to control access to a set | |||
|
14 | of files. Non-cooperating processes or incorrectly written scripts | |||
|
15 | can ignore Mercurial's locking scheme and stomp all over the | |||
|
16 | repository, so don't do that. | |||
|
17 | ||||
|
18 | Typically used via localrepository.lock() to lock the repository | |||
|
19 | store (.hg/store/) or localrepository.wlock() to lock everything | |||
|
20 | else under .hg/.''' | |||
|
21 | ||||
13 | # lock is symlink on platforms that support it, file on others. |
|
22 | # lock is symlink on platforms that support it, file on others. | |
14 |
|
23 | |||
15 | # symlink is used because create of directory entry and contents |
|
24 | # symlink is used because create of directory entry and contents |
General Comments 0
You need to be logged in to leave comments.
Login now