Mercurial > hg
comparison mercurial/lock.py @ 28027:14033c5dd261
util: enable getpid to be replaced
This will enable tests to write stable process ids.
author | timeless <timeless@mozdev.org> |
---|---|
date | Wed, 03 Feb 2016 09:11:22 +0000 |
parents | 054abf2377e8 |
children | 518c3e392f75 |
comparison
equal
deleted
inserted
replaced
28026:a6db1163befa | 28027:14033c5dd261 |
---|---|
7 | 7 |
8 from __future__ import absolute_import | 8 from __future__ import absolute_import |
9 | 9 |
10 import contextlib | 10 import contextlib |
11 import errno | 11 import errno |
12 import os | |
13 import socket | 12 import socket |
14 import time | 13 import time |
15 import warnings | 14 import warnings |
16 | 15 |
17 from . import ( | 16 from . import ( |
75 self.held = 1 | 74 self.held = 1 |
76 | 75 |
77 self.release() | 76 self.release() |
78 | 77 |
79 def _getpid(self): | 78 def _getpid(self): |
80 # wrapper around os.getpid() to make testing easier | 79 # wrapper around util.getpid() to make testing easier |
81 return os.getpid() | 80 return util.getpid() |
82 | 81 |
83 def lock(self): | 82 def lock(self): |
84 timeout = self.timeout | 83 timeout = self.timeout |
85 while True: | 84 while True: |
86 try: | 85 try: |