Mercurial > hg
comparison mercurial/localrepo.py @ 45519:9b16bb3b2349
locking: remove support for inheriting locks in subprocess
This seems to have been added for merge driver, and since merge driver
is now gone...
Differential Revision: https://phab.mercurial-scm.org/D9053
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 18 Sep 2020 08:27:43 -0700 |
parents | a8843eda9a35 |
children | 88a47cbf063c |
comparison
equal
deleted
inserted
replaced
45518:32ce4cbaec4b | 45519:9b16bb3b2349 |
---|---|
2676 if k == 'dirstate' or k not in self.__dict__: | 2676 if k == 'dirstate' or k not in self.__dict__: |
2677 continue | 2677 continue |
2678 ce.refresh() | 2678 ce.refresh() |
2679 | 2679 |
2680 def _lock( | 2680 def _lock( |
2681 self, | 2681 self, vfs, lockname, wait, releasefn, acquirefn, desc, |
2682 vfs, | |
2683 lockname, | |
2684 wait, | |
2685 releasefn, | |
2686 acquirefn, | |
2687 desc, | |
2688 inheritchecker=None, | |
2689 parentenvvar=None, | |
2690 ): | 2682 ): |
2691 parentlock = None | |
2692 # the contents of parentenvvar are used by the underlying lock to | |
2693 # determine whether it can be inherited | |
2694 if parentenvvar is not None: | |
2695 parentlock = encoding.environ.get(parentenvvar) | |
2696 | |
2697 timeout = 0 | 2683 timeout = 0 |
2698 warntimeout = 0 | 2684 warntimeout = 0 |
2699 if wait: | 2685 if wait: |
2700 timeout = self.ui.configint(b"ui", b"timeout") | 2686 timeout = self.ui.configint(b"ui", b"timeout") |
2701 warntimeout = self.ui.configint(b"ui", b"timeout.warn") | 2687 warntimeout = self.ui.configint(b"ui", b"timeout.warn") |
2709 timeout, | 2695 timeout, |
2710 warntimeout, | 2696 warntimeout, |
2711 releasefn=releasefn, | 2697 releasefn=releasefn, |
2712 acquirefn=acquirefn, | 2698 acquirefn=acquirefn, |
2713 desc=desc, | 2699 desc=desc, |
2714 inheritchecker=inheritchecker, | |
2715 parentlock=parentlock, | |
2716 signalsafe=signalsafe, | 2700 signalsafe=signalsafe, |
2717 ) | 2701 ) |
2718 return l | 2702 return l |
2719 | 2703 |
2720 def _afterlock(self, callback): | 2704 def _afterlock(self, callback): |
2751 desc=_(b'repository %s') % self.origroot, | 2735 desc=_(b'repository %s') % self.origroot, |
2752 ) | 2736 ) |
2753 self._lockref = weakref.ref(l) | 2737 self._lockref = weakref.ref(l) |
2754 return l | 2738 return l |
2755 | 2739 |
2756 def _wlockchecktransaction(self): | |
2757 if self.currenttransaction() is not None: | |
2758 raise error.LockInheritanceContractViolation( | |
2759 b'wlock cannot be inherited in the middle of a transaction' | |
2760 ) | |
2761 | |
2762 def wlock(self, wait=True): | 2740 def wlock(self, wait=True): |
2763 '''Lock the non-store parts of the repository (everything under | 2741 '''Lock the non-store parts of the repository (everything under |
2764 .hg except .hg/store) and return a weak reference to the lock. | 2742 .hg except .hg/store) and return a weak reference to the lock. |
2765 | 2743 |
2766 Use this before modifying files in .hg. | 2744 Use this before modifying files in .hg. |
2794 b"wlock", | 2772 b"wlock", |
2795 wait, | 2773 wait, |
2796 unlock, | 2774 unlock, |
2797 self.invalidatedirstate, | 2775 self.invalidatedirstate, |
2798 _(b'working directory of %s') % self.origroot, | 2776 _(b'working directory of %s') % self.origroot, |
2799 inheritchecker=self._wlockchecktransaction, | |
2800 parentenvvar=b'HG_WLOCK_LOCKER', | |
2801 ) | 2777 ) |
2802 self._wlockref = weakref.ref(l) | 2778 self._wlockref = weakref.ref(l) |
2803 return l | 2779 return l |
2804 | 2780 |
2805 def _currentlock(self, lockref): | 2781 def _currentlock(self, lockref): |