# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1447290435 18000
#      Wed Nov 11 20:07:15 2015 -0500
# Node ID 3fe8cb40c9c5973f72cad2b6190b4880abed7cff
# Parent  263db31329a62ba00cc9533785a9102efde27aca
commands: inline definition of localrepo.parents() and drop the method (API)

localrepo.parents() has relatively few users, and most of those were
actually implicitly looking at the wctx, which is now made explicit
via repo[None].

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -441,7 +441,7 @@
                                              targetancestors)
                 storestatus(repo, originalwd, target, state, collapsef, keepf,
                             keepbranchesf, external, activebookmark)
-                if len(repo.parents()) == 2:
+                if len(repo[None].parents()) == 2:
                     repo.ui.debug('resuming interrupted rebase\n')
                 else:
                     try:
@@ -930,7 +930,7 @@
 def needupdate(repo, state):
     '''check whether we should `update --clean` away from a merge, or if
     somehow the working dir got forcibly updated, e.g. by older hg'''
-    parents = [p.rev() for p in repo.parents()]
+    parents = [p.rev() for p in repo[None].parents()]
 
     # Are we in a merge state at all?
     if len(parents) < 2:
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1190,7 +1190,7 @@
             ui.status(_('reset working directory to branch %s\n') % label)
         elif label:
             if not opts.get('force') and label in repo.branchmap():
-                if label not in [p.branch() for p in repo.parents()]:
+                if label not in [p.branch() for p in repo[None].parents()]:
                     raise error.Abort(_('a branch of the same name already'
                                        ' exists'),
                                      # i18n: "it" refers to an existing branch
@@ -1600,8 +1600,8 @@
         if not bheads:
             raise error.Abort(_('can only close branch heads'))
         elif opts.get('amend'):
-            if repo.parents()[0].p1().branch() != branch and \
-                    repo.parents()[0].p2().branch() != branch:
+            if repo[None].parents()[0].p1().branch() != branch and \
+                    repo[None].parents()[0].p2().branch() != branch:
                 raise error.Abort(_('can only close branch heads'))
 
     if opts.get('amend'):
@@ -4545,7 +4545,7 @@
                 tr = repo.transaction('import')
             else:
                 dsguard = cmdutil.dirstateguard(repo, 'import')
-            parents = repo.parents()
+            parents = repo[None].parents()
             for patchurl in patches:
                 if patchurl == '-':
                     ui.status(_('applying patch from stdin\n'))
@@ -4565,7 +4565,7 @@
                         haspatch = True
                         ui.note(msg + '\n')
                     if update or opts.get('exact'):
-                        parents = repo.parents()
+                        parents = repo[None].parents()
                     else:
                         parents = [repo[node]]
                     if rej:
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -852,10 +852,6 @@
     def changectx(self, changeid):
         return self[changeid]
 
-    def parents(self, changeid=None):
-        '''get list of changectxs for parents of changeid'''
-        return self[changeid].parents()
-
     def setparents(self, p1, p2=nullid):
         self.dirstate.beginparentchange()
         copies = self.dirstate.setparents(p1, p2)
@@ -1170,7 +1166,7 @@
                         % self.dirstate.branch())
 
             self.dirstate.invalidate()
-            parents = tuple([p.rev() for p in self.parents()])
+            parents = tuple([p.rev() for p in self[None].parents()])
             if len(parents) > 1:
                 ui.status(_('working directory now based on '
                             'revisions %d and %d\n') % parents)