Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/lock.py @ 2584:1f4703115e28
merge with crew
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Sun, 09 Jul 2006 14:42:18 +0200 |
parents | 0875cda033fd |
children | 345bac2bc4ec |
comparison
equal
deleted
inserted
replaced
2583:6e5427447f4c | 2584:1f4703115e28 |
---|---|
83 # if old-style lock, we cannot tell what machine locker is on. | 83 # if old-style lock, we cannot tell what machine locker is on. |
84 # with new-style lock, if locker is on this machine, we can | 84 # with new-style lock, if locker is on this machine, we can |
85 # see if locker is alive. if locker is on this machine but | 85 # see if locker is alive. if locker is on this machine but |
86 # not alive, we can safely break lock. | 86 # not alive, we can safely break lock. |
87 locker = util.readlock(self.f) | 87 locker = util.readlock(self.f) |
88 c = locker.find(':') | 88 try: |
89 if c == -1: | 89 host, pid = locker.split(":", 1) |
90 except ValueError: | |
90 return locker | 91 return locker |
91 host = locker[:c] | |
92 if host != self.host: | 92 if host != self.host: |
93 return locker | 93 return locker |
94 try: | 94 try: |
95 pid = int(locker[c+1:]) | 95 pid = int(pid) |
96 except: | 96 except: |
97 return locker | 97 return locker |
98 if util.testpid(pid): | 98 if util.testpid(pid): |
99 return locker | 99 return locker |
100 # if locker dead, break lock. must do this with another lock | 100 # if locker dead, break lock. must do this with another lock |