cleanup: replace .parents()[0] by .p1()
authorMartin von Zweigbergk <martinvonz@google.com>
Thu, 19 Dec 2019 22:31:13 -0800
changeset 5019 967e9a87e82d
parent 5018 f1e90ce1d372
child 5020 8f6095e88d1c
cleanup: replace .parents()[0] by .p1()
hgext3rd/evolve/__init__.py
hgext3rd/evolve/cmdrewrite.py
hgext3rd/evolve/evolvecmd.py
hgext3rd/evolve/utility.py
hgext3rd/topic/evolvebits.py
--- a/hgext3rd/evolve/__init__.py	Wed Nov 27 20:54:48 2019 +0530
+++ b/hgext3rd/evolve/__init__.py	Thu Dec 19 22:31:13 2019 -0800
@@ -949,7 +949,7 @@
 def _findprevtarget(repo, displayer, movebookmark=False, topic=True):
     target = bookmark = None
     wkctx = repo[None]
-    p1 = wkctx.parents()[0]
+    p1 = wkctx.p1()
     parents = p1.parents()
     currenttopic = _getcurrenttopic(repo)
 
--- a/hgext3rd/evolve/cmdrewrite.py	Wed Nov 27 20:54:48 2019 +0530
+++ b/hgext3rd/evolve/cmdrewrite.py	Thu Dec 19 22:31:13 2019 -0800
@@ -1097,7 +1097,7 @@
                 newnode = wdp
 
                 while newnode in precs or newnode.obsolete():
-                    newnode = newnode.parents()[0]
+                    newnode = newnode.p1()
         else:
             # no need to update anywhere as wdp is not related to revs
             # being pruned
--- a/hgext3rd/evolve/evolvecmd.py	Wed Nov 27 20:54:48 2019 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Thu Dec 19 22:31:13 2019 -0800
@@ -128,7 +128,7 @@
         ui.debug(b"stabilize target %s is plain dead,"
                  b" trying to stabilize on its parent\n" %
                  obs)
-        obs = obs.parents()[0]
+        obs = obs.p1()
         newer = obsutil.successorssets(repo, obs.node())
     if len(newer) > 1:
         msg = _(b"skipping %s: divergent rewriting. can't choose "
@@ -2167,7 +2167,7 @@
 
     ctxparents = orig.parents()
     if len(ctxparents) == 2:
-        currentp1 = repo.dirstate.parents()[0]
+        currentp1 = repo.dirstate.p1()
         p1obs = ctxparents[0].obsolete()
         p2obs = ctxparents[1].obsolete()
         # asumming that the parent of current wdir is successor of one
@@ -2197,7 +2197,7 @@
             pass
     else:
         with repo.dirstate.parentchange():
-            repo.dirstate.setparents(repo.dirstate.parents()[0], nodemod.nullid)
+            repo.dirstate.setparents(repo.dirstate.p1(), nodemod.nullid)
 
     with repo.ui.configoverride(overrides, b'evolve-continue'):
         node = repo.commit(text=message, user=user,
--- a/hgext3rd/evolve/utility.py	Wed Nov 27 20:54:48 2019 +0530
+++ b/hgext3rd/evolve/utility.py	Thu Dec 19 22:31:13 2019 -0800
@@ -116,7 +116,7 @@
         ui.debug(b"stabilize target %s is plain dead,"
                  b" trying to stabilize on its parent\n" %
                  obs)
-        obs = obs.parents()[0]
+        obs = obs.p1()
         newer = obsutil.successorssets(repo, obs.node())
     if len(newer) > 1 or len(newer[0]) > 1:
         raise MultipleSuccessorsError(newer)
--- a/hgext3rd/topic/evolvebits.py	Wed Nov 27 20:54:48 2019 +0530
+++ b/hgext3rd/topic/evolvebits.py	Thu Dec 19 22:31:13 2019 -0800
@@ -81,7 +81,7 @@
         ui.debug(b"stabilize target %s is plain dead,"
                  b" trying to stabilize on its parent\n" %
                  obs)
-        obs = obs.parents()[0]
+        obs = obs.p1()
         newer = obsutil.successorssets(repo, obs.node())
     if 1 < len(newer):
         # divergence case