Patchwork [4,of,4,V2] localrepo: reinstate localrepo.parents with a deprecation warning

login
register
mail settings
Submitter Pierre-Yves David
Date Dec. 7, 2015, 7:33 p.m.
Message ID <4ad5faeb04fee3e86de9.1449516832@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/11908/
State Accepted
Headers show

Comments

Pierre-Yves David - Dec. 7, 2015, 7:33 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1449386089 28800
#      Sat Dec 05 23:14:49 2015 -0800
# Node ID 4ad5faeb04fee3e86de9e9d9ae530c9dc48cbc5d
# Parent  4469287024fbad9588cb3a75daa1aa76d80d4a76
# EXP-Topic deprecationwarning
# Available At http://hg.netv6.net/marmoute-wip/mercurial/
#              hg pull http://hg.netv6.net/marmoute-wip/mercurial/ -r 4ad5faeb04fe
localrepo: reinstate localrepo.parents with a deprecation warning

The function was dropped in 3fe8cb40c9c5. This API drop brokes three of my
extensions including some critical to my workflow like tortoisehg. Lets mark
this API for death and give people time to fix their code.
Augie Fackler - Dec. 7, 2015, 10:38 p.m.
On Mon, Dec 07, 2015 at 11:33:52AM -0800, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1449386089 28800
> #      Sat Dec 05 23:14:49 2015 -0800
> # Node ID 4ad5faeb04fee3e86de9e9d9ae530c9dc48cbc5d
> # Parent  4469287024fbad9588cb3a75daa1aa76d80d4a76
> # EXP-Topic deprecationwarning
> # Available At http://hg.netv6.net/marmoute-wip/mercurial/
> #              hg pull http://hg.netv6.net/marmoute-wip/mercurial/ -r 4ad5faeb04fe
> localrepo: reinstate localrepo.parents with a deprecation warning

Queued these, thanks!

>
> The function was dropped in 3fe8cb40c9c5. This API drop brokes three of my
> extensions including some critical to my workflow like tortoisehg. Lets mark
> this API for death and give people time to fix their code.
>
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -849,10 +849,16 @@ class localrepository(object):
>      def file(self, f):
>          if f[0] == '/':
>              f = f[1:]
>          return filelog.filelog(self.svfs, f)
>
> +    def parents(self, changeid=None):
> +        '''get list of changectxs for parents of changeid'''
> +        msg = 'repo.parents() is deprecated, use repo[%r].parents()' % changeid
> +        self.ui.deprecwarn(msg, '3.7')
> +        return self[changeid].parents()
> +
>      def changectx(self, changeid):
>          return self[changeid]
>
>      def setparents(self, p1, p2=nullid):
>          self.dirstate.beginparentchange()
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -849,10 +849,16 @@  class localrepository(object):
     def file(self, f):
         if f[0] == '/':
             f = f[1:]
         return filelog.filelog(self.svfs, f)
 
+    def parents(self, changeid=None):
+        '''get list of changectxs for parents of changeid'''
+        msg = 'repo.parents() is deprecated, use repo[%r].parents()' % changeid
+        self.ui.deprecwarn(msg, '3.7')
+        return self[changeid].parents()
+
     def changectx(self, changeid):
         return self[changeid]
 
     def setparents(self, p1, p2=nullid):
         self.dirstate.beginparentchange()