Patchwork [8,of,8,cleanup] histedit: remove now unused 'constraints' related code

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 26, 2016, 7:35 p.m.
Message ID <7366faf468f2eb037ea1.1472240133@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/16466/
State Accepted
Headers show

Comments

Pierre-Yves David - Aug. 26, 2016, 7:35 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1472238391 -7200
#      Fri Aug 26 21:06:31 2016 +0200
# Node ID 7366faf468f2eb037ea1ce4ef9919786a564bf9d
# Parent  c4809d82bb0ae1b068a0fdac1e1012d8182624df
# EXP-Topic histedit.constraint
histedit: remove now unused 'constraints' related code

Now that the one action that need different logic handle that using inheritance
and overriding, we can remove that code.
Augie Fackler - Aug. 30, 2016, 5:13 p.m.
On Fri, Aug 26, 2016 at 09:35:33PM +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
> # Date 1472238391 -7200
> #      Fri Aug 26 21:06:31 2016 +0200
> # Node ID 7366faf468f2eb037ea1ce4ef9919786a564bf9d
> # Parent  c4809d82bb0ae1b068a0fdac1e1012d8182624df
> # EXP-Topic histedit.constraint
> histedit: remove now unused 'constraints' related code

I've finally gotten the time to look this over and copy-edit the
commit messages. I'm not really a fan of the new shape of the code
(movement towards inheritance and overriding methods), but given that
there was so much inheritance in here already (past Augie was young
and foolish), that's not really a reason to reject this. And it did
help me spot a bug in an abort message (patch forthcoming shortly), so
that's an argument in its favor.

Queued.

>
> Now that the one action that need different logic handle that using inheritance
> and overriding, we can remove that code.
>
> diff --git a/hgext/histedit.py b/hgext/histedit.py
> --- a/hgext/histedit.py
> +++ b/hgext/histedit.py
> @@ -201,18 +201,6 @@ release = lock.release
>  cmdtable = {}
>  command = cmdutil.command(cmdtable)
>
> -class _constraints(object):
> -    # aborts if there are multiple rules for one node
> -    noduplicates = 'noduplicates'
> -    # abort if the node does belong to edited stack
> -    forceother = 'forceother'
> -    # abort if the node doesn't belong to edited stack
> -    noother = 'noother'
> -
> -    @classmethod
> -    def known(cls):
> -        return set([v for k, v in cls.__dict__.items() if k[0] != '_'])
> -
>  # Note for extension authors: ONLY specify testedwith = 'internal' for
>  # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
>  # be specifying the version(s) of Mercurial they are tested with, or
> @@ -392,8 +380,6 @@ class histeditaction(object):
>          self.repo = state.repo
>          self.node = node
>
> -    constraints = set([_constraints.noduplicates, _constraints.noother])
> -
>      @classmethod
>      def fromrule(cls, state, rule):
>          """Parses the given rule, returning an instance of the histeditaction.
> @@ -786,7 +772,6 @@ class fold(histeditaction):
>          return repo[n], replacements
>
>  class base(histeditaction):
> -    constraints = set([_constraints.forceother])
>
>      def run(self):
>          if self.repo['.'].node() != self.node:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -201,18 +201,6 @@  release = lock.release
 cmdtable = {}
 command = cmdutil.command(cmdtable)
 
-class _constraints(object):
-    # aborts if there are multiple rules for one node
-    noduplicates = 'noduplicates'
-    # abort if the node does belong to edited stack
-    forceother = 'forceother'
-    # abort if the node doesn't belong to edited stack
-    noother = 'noother'
-
-    @classmethod
-    def known(cls):
-        return set([v for k, v in cls.__dict__.items() if k[0] != '_'])
-
 # Note for extension authors: ONLY specify testedwith = 'internal' for
 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
 # be specifying the version(s) of Mercurial they are tested with, or
@@ -392,8 +380,6 @@  class histeditaction(object):
         self.repo = state.repo
         self.node = node
 
-    constraints = set([_constraints.noduplicates, _constraints.noother])
-
     @classmethod
     def fromrule(cls, state, rule):
         """Parses the given rule, returning an instance of the histeditaction.
@@ -786,7 +772,6 @@  class fold(histeditaction):
         return repo[n], replacements
 
 class base(histeditaction):
-    constraints = set([_constraints.forceother])
 
     def run(self):
         if self.repo['.'].node() != self.node: