[PATCH 4 of 7] context: migrate to context manager for changing dirstate parents
Augie Fackler
raf at durin42.com
Thu May 18 18:19:49 EDT 2017
# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1495141867 14400
# Thu May 18 17:11:07 2017 -0400
# Node ID 6b988519e85f29c9c273f30c742ca0877aa824a1
# Parent 045240d198722437267f7d2dadb1c1dbfae971ee
context: migrate to context manager for changing dirstate parents
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1447,13 +1447,12 @@ class committablectx(basectx):
"""
- self._repo.dirstate.beginparentchange()
- for f in self.modified() + self.added():
- self._repo.dirstate.normal(f)
- for f in self.removed():
- self._repo.dirstate.drop(f)
- self._repo.dirstate.setparents(node)
- self._repo.dirstate.endparentchange()
+ with self._repo.dirstate.parentchange():
+ for f in self.modified() + self.added():
+ self._repo.dirstate.normal(f)
+ for f in self.removed():
+ self._repo.dirstate.drop(f)
+ self._repo.dirstate.setparents(node)
# write changes out explicitly, because nesting wlock at
# runtime may prevent 'wlock.release()' in 'repo.commit()'
More information about the Mercurial-devel
mailing list