Patchwork [1,of,5] py3: fix some membership tests on linkrev adjustment

login
register
mail settings
Submitter Yuya Nishihara
Date March 3, 2018, 5:12 p.m.
Message ID <0f60e72e6dfb91bdf3d9.1520097149@mimosa>
Download mbox | patch
Permalink /patch/28791/
State Accepted
Headers show

Comments

Yuya Nishihara - March 3, 2018, 5:12 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1520086774 18000
#      Sat Mar 03 09:19:34 2018 -0500
# Node ID 0f60e72e6dfb91bdf3d9d3e992e8b2e5b04d1d7b
# Parent  159b04de5fb0fff6a154db3f7611b7766078cfc7
py3: fix some membership tests on linkrev adjustment
Pulkit Goyal - March 3, 2018, 5:17 p.m.
Queued the series. Many thanks!

On Sat, Mar 3, 2018 at 10:42 PM, Yuya Nishihara <yuya@tcha.org> wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1520086774 18000
> #      Sat Mar 03 09:19:34 2018 -0500
> # Node ID 0f60e72e6dfb91bdf3d9d3e992e8b2e5b04d1d7b
> # Parent  159b04de5fb0fff6a154db3f7611b7766078cfc7
> py3: fix some membership tests on linkrev adjustment
>
> diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
> --- a/contrib/python3-whitelist
> +++ b/contrib/python3-whitelist
> @@ -5,6 +5,7 @@ test-addremove.t
>  test-amend-subrepo.t
>  test-ancestor.py
>  test-annotate.py
> +test-annotate.t
>  test-automv.t
>  test-backout.t
>  test-backwards-remove.t
> diff --git a/mercurial/context.py b/mercurial/context.py
> --- a/mercurial/context.py
> +++ b/mercurial/context.py
> @@ -912,7 +912,7 @@ class basefilectx(object):
>          """
>          lkr = self.linkrev()
>          attrs = vars(self)
> -        noctx = not ('_changeid' in attrs or '_changectx' in attrs)
> +        noctx = not (r'_changeid' in attrs or r'_changectx' in attrs)
>          if noctx or self.rev() == lkr:
>              return self.linkrev()
>          return self._adjustlinkrev(self.rev(), inclusive=True)
> @@ -928,14 +928,14 @@ class basefilectx(object):
>      def _parentfilectx(self, path, fileid, filelog):
>          """create parent filectx keeping ancestry info for _adjustlinkrev()"""
>          fctx = filectx(self._repo, path, fileid=fileid, filelog=filelog)
> -        if '_changeid' in vars(self) or '_changectx' in vars(self):
> +        if r'_changeid' in vars(self) or r'_changectx' in vars(self):
>              # If self is associated with a changeset (probably explicitly
>              # fed), ensure the created filectx is associated with a
>              # changeset that is an ancestor of self.changectx.
>              # This lets us later use _adjustlinkrev to get a correct link.
>              fctx._descendantrev = self.rev()
>              fctx._ancestrycontext = getattr(self, '_ancestrycontext', None)
> -        elif '_descendantrev' in vars(self):
> +        elif r'_descendantrev' in vars(self):
>              # Otherwise propagate _descendantrev if we have one associated.
>              fctx._descendantrev = self._descendantrev
>              fctx._ancestrycontext = getattr(self, '_ancestrycontext', None)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -5,6 +5,7 @@  test-addremove.t
 test-amend-subrepo.t
 test-ancestor.py
 test-annotate.py
+test-annotate.t
 test-automv.t
 test-backout.t
 test-backwards-remove.t
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -912,7 +912,7 @@  class basefilectx(object):
         """
         lkr = self.linkrev()
         attrs = vars(self)
-        noctx = not ('_changeid' in attrs or '_changectx' in attrs)
+        noctx = not (r'_changeid' in attrs or r'_changectx' in attrs)
         if noctx or self.rev() == lkr:
             return self.linkrev()
         return self._adjustlinkrev(self.rev(), inclusive=True)
@@ -928,14 +928,14 @@  class basefilectx(object):
     def _parentfilectx(self, path, fileid, filelog):
         """create parent filectx keeping ancestry info for _adjustlinkrev()"""
         fctx = filectx(self._repo, path, fileid=fileid, filelog=filelog)
-        if '_changeid' in vars(self) or '_changectx' in vars(self):
+        if r'_changeid' in vars(self) or r'_changectx' in vars(self):
             # If self is associated with a changeset (probably explicitly
             # fed), ensure the created filectx is associated with a
             # changeset that is an ancestor of self.changectx.
             # This lets us later use _adjustlinkrev to get a correct link.
             fctx._descendantrev = self.rev()
             fctx._ancestrycontext = getattr(self, '_ancestrycontext', None)
-        elif '_descendantrev' in vars(self):
+        elif r'_descendantrev' in vars(self):
             # Otherwise propagate _descendantrev if we have one associated.
             fctx._descendantrev = self._descendantrev
             fctx._ancestrycontext = getattr(self, '_ancestrycontext', None)