Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/util.py @ 33762:86aca74a063b
merge with stable
author | Augie Fackler <augie@google.com> |
---|---|
date | Thu, 10 Aug 2017 14:23:41 -0400 |
parents | 1d5e497c08b3 524b13fc711f |
children | 02a745c20121 |
comparison
equal
deleted
inserted
replaced
33761:e6d8ee3c9ec3 | 33762:86aca74a063b |
---|---|
581 | 581 |
582 def __setitem__(self, key, value): | 582 def __setitem__(self, key, value): |
583 if key in self: | 583 if key in self: |
584 del self[key] | 584 del self[key] |
585 super(sortdict, self).__setitem__(key, value) | 585 super(sortdict, self).__setitem__(key, value) |
586 | |
587 if pycompat.ispypy: | |
588 # __setitem__() isn't called as of PyPy 5.8.0 | |
589 def update(self, src): | |
590 if isinstance(src, dict): | |
591 src = src.iteritems() | |
592 for k, v in src: | |
593 self[k] = v | |
586 | 594 |
587 @contextlib.contextmanager | 595 @contextlib.contextmanager |
588 def acceptintervention(tr=None): | 596 def acceptintervention(tr=None): |
589 """A context manager that closes the transaction on InterventionRequired | 597 """A context manager that closes the transaction on InterventionRequired |
590 | 598 |