comparison hgext/shelve.py @ 41397: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 e5d37558098a
children 630af04d4ae4
comparison
equal deleted inserted replaced
41396:3461814417f3 41397:0bd56c291359
672 dirstate.""" 672 dirstate."""
673 with ui.configoverride({('ui', 'quiet'): True}): 673 with ui.configoverride({('ui', 'quiet'): True}):
674 hg.update(repo, wctx.node()) 674 hg.update(repo, wctx.node())
675 files = [] 675 files = []
676 files.extend(shelvectx.files()) 676 files.extend(shelvectx.files())
677 files.extend(shelvectx.parents()[0].files()) 677 files.extend(shelvectx.p1().files())
678 678
679 # revert will overwrite unknown files, so move them out of the way 679 # revert will overwrite unknown files, so move them out of the way
680 for file in repo.status(unknown=True).unknown: 680 for file in repo.status(unknown=True).unknown:
681 if file in files: 681 if file in files:
682 util.rename(file, scmutil.origpath(ui, repo, file)) 682 util.rename(file, scmutil.origpath(ui, repo, file))
807 tmpwctx, shelvectx, branchtorestore, 807 tmpwctx, shelvectx, branchtorestore,
808 activebookmark): 808 activebookmark):
809 """Rebase restored commit from its original location to a destination""" 809 """Rebase restored commit from its original location to a destination"""
810 # If the shelve is not immediately on top of the commit 810 # If the shelve is not immediately on top of the commit
811 # we'll be merging with, rebase it to be on top. 811 # we'll be merging with, rebase it to be on top.
812 if tmpwctx.node() == shelvectx.parents()[0].node(): 812 if tmpwctx.node() == shelvectx.p1().node():
813 return shelvectx 813 return shelvectx
814 814
815 overrides = { 815 overrides = {
816 ('ui', 'forcemerge'): opts.get('tool', ''), 816 ('ui', 'forcemerge'): opts.get('tool', ''),
817 ('phases', 'new-commit'): phases.secret, 817 ('phases', 'new-commit'): phases.secret,