[PATCH 3 of 7 v2] rebase: migrate to context manager for changing dirstate parents

Augie Fackler raf at durin42.com
Fri May 19 17:38:43 EDT 2017


# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1495141861 14400
#      Thu May 18 17:11:01 2017 -0400
# Node ID 96a232ad4958bad1de7366360fecac987ca51721
# Parent  f495181d4e42e53d4f3b1a9ca5132ff6f7703890
rebase: migrate to context manager for changing dirstate parents

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -427,9 +427,8 @@ class rebaseruntime(object):
                         mergemod.mergestate.clean(repo)
                 else:
                     # Skip commit if we are collapsing
-                    repo.dirstate.beginparentchange()
-                    repo.setparents(repo[p1].node())
-                    repo.dirstate.endparentchange()
+                    with repo.dirstate.parentchange():
+                        repo.setparents(repo[p1].node())
                     newnode = None
                 # Update the state
                 if newnode is not None:


More information about the Mercurial-devel mailing list