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

login
register
mail settings
Submitter Augie Fackler
Date May 19, 2017, 9:38 p.m.
Message ID <96a232ad4958bad1de73.1495229923@augie-macbookpro2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/20741/
State Accepted
Headers show

Comments

Augie Fackler - May 19, 2017, 9:38 p.m.
# HG changeset patch
# User Augie Fackler <augie@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

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: