equal
deleted
inserted
replaced
113 def trylock(ui, vfs, lockname, timeout, warntimeout, *args, **kwargs): |
113 def trylock(ui, vfs, lockname, timeout, warntimeout, *args, **kwargs): |
114 """return an acquired lock or raise an a LockHeld exception |
114 """return an acquired lock or raise an a LockHeld exception |
115 |
115 |
116 This function is responsible to issue warnings and or debug messages about |
116 This function is responsible to issue warnings and or debug messages about |
117 the held lock while trying to acquires it.""" |
117 the held lock while trying to acquires it.""" |
|
118 devel_wait_file = kwargs.pop("devel_wait_sync_file", None) |
118 |
119 |
119 def printwarning(printer, locker): |
120 def printwarning(printer, locker): |
120 """issue the usual "waiting on lock" message through any channel""" |
121 """issue the usual "waiting on lock" message through any channel""" |
121 # show more details for new-style locks |
122 # show more details for new-style locks |
122 if b':' in locker: |
123 if b':' in locker: |
148 while True: |
149 while True: |
149 try: |
150 try: |
150 l._trylock() |
151 l._trylock() |
151 break |
152 break |
152 except error.LockHeld as inst: |
153 except error.LockHeld as inst: |
|
154 if devel_wait_file is not None: |
|
155 # create the file to signal we are waiting |
|
156 with open(devel_wait_file, 'w'): |
|
157 pass |
|
158 |
153 if delay == debugidx: |
159 if delay == debugidx: |
154 printwarning(ui.debug, inst.locker) |
160 printwarning(ui.debug, inst.locker) |
155 if delay == warningidx: |
161 if delay == warningidx: |
156 printwarning(ui.warn, inst.locker) |
162 printwarning(ui.warn, inst.locker) |
157 if timeout <= delay: |
163 if timeout <= delay: |