Mercurial > public > mercurial-scm > hg-stable
diff hgext/histedit.py @ 41419:0bd56c291359
cleanup: use p1() and p2() instead of parents()[0] and parents()[1]
We have had these methods on both contexts and dirstate for a long
time now.
Differential Revision: https://phab.mercurial-scm.org/D5706
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 25 Jan 2019 23:36:23 -0800 |
parents | 32ef47b3c91c |
children | 5cb8158a61f7 |
line wrap: on
line diff
--- a/hgext/histedit.py Mon Jan 21 15:29:14 2019 +0000 +++ b/hgext/histedit.py Fri Jan 25 23:36:23 2019 -0800 @@ -575,7 +575,7 @@ def applychanges(ui, repo, ctx, opts): """Merge changeset from ctx (only) in the current working directory""" - wcpar = repo.dirstate.parents()[0] + wcpar = repo.dirstate.p1() if ctx.p1().node() == wcpar: # edits are "in place" we do not need to make any merge, # just applies changes on parent for editing @@ -608,7 +608,7 @@ if not c.mutable(): raise error.ParseError( _("cannot fold into public change %s") % node.short(c.node())) - base = firstctx.parents()[0] + base = firstctx.p1() # commit a new version of the old changeset, including the update # collect all files which might be affected @@ -693,7 +693,7 @@ class pick(histeditaction): def run(self): rulectx = self.repo[self.node] - if rulectx.parents()[0].node() == self.state.parentctxnode: + if rulectx.p1().node() == self.state.parentctxnode: self.repo.ui.debug('node %s unchanged\n' % node.short(self.node)) return rulectx, [] @@ -724,7 +724,7 @@ super(fold, self).verify(prev, expected, seen) repo = self.repo if not prev: - c = repo[self.node].parents()[0] + c = repo[self.node].p1() elif not prev.verb in ('pick', 'base'): return else: @@ -795,7 +795,7 @@ return False def finishfold(self, ui, repo, ctx, oldctx, newnode, internalchanges): - parent = ctx.parents()[0].node() + parent = ctx.p1().node() hg.updaterepo(repo, parent, overwrite=False) ### prepare new commit data commitopts = {} @@ -1902,7 +1902,7 @@ actions = parserules(rules, state) warnverifyactions(ui, repo, actions, state, ctxs) - parentctxnode = repo[root].parents()[0].node() + parentctxnode = repo[root].p1().node() state.parentctxnode = parentctxnode state.actions = actions