Patchwork [3,of,7] rebase: migrate to context manager for changing dirstate parents

login
register
mail settings
Submitter Augie Fackler
Date May 18, 2017, 10:19 p.m.
Message ID <045240d198722437267f.1495145988@augie-macbookpro2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/20694/
State Superseded
Headers show

Comments

Augie Fackler - May 18, 2017, 10:19 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1495141861 14400
#      Thu May 18 17:11:01 2017 -0400
# Node ID 045240d198722437267f7d2dadb1c1dbfae971ee
# Parent  d6560d3e5c56e4ae529ec58069aa217791f3168f
rebase: migrate to context manager for changing dirstate parents

Patch

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: