Patchwork [3,of,3,V3,[NOW_WITH_DOCS!] ] extensions: obsolete and remove interhg extension

login
register
mail settings
Submitter Angel Ezquerra
Date Feb. 9, 2013, 3:55 p.m.
Message ID <6b18726f164093ab77ac.1360425302@Angel-PC.localdomain>
Download mbox | patch
Permalink /patch/892/
State Superseded
Commit 013fcd112f13f31a35ea6a40d8cd1c6923cdaf20
Headers show

Comments

Angel Ezquerra - Feb. 9, 2013, 3:55 p.m.
# HG changeset patch
# User Angel Ezquerra <angel.ezquerra@gmail.com>
# Date 1360404042 -3600
# Node ID 6b18726f164093ab77ac754b088be2e90482b65c
# Parent  3d1290c7131e8e1df991f1753ab5e76d3e3cd21e
extensions: obsolete and remove interhg extension

With the addition of the websub filter extension this extension is no longer
needed. We maintain a sort of backwards compatibility by reading the [interhg]
section and using it as we would use the [websub] section.
Martin Geisler - Feb. 9, 2013, 11:03 p.m.
Angel Ezquerra <angel.ezquerra@gmail.com> writes:

> # HG changeset patch
> # User Angel Ezquerra <angel.ezquerra@gmail.com>
> # Date 1360404042 -3600
> # Node ID 6b18726f164093ab77ac754b088be2e90482b65c
> # Parent  3d1290c7131e8e1df991f1753ab5e76d3e3cd21e
> extensions: obsolete and remove interhg extension
>
> With the addition of the websub filter extension this extension is no longer
> needed. We maintain a sort of backwards compatibility by reading the [interhg]
> section and using it as we would use the [websub] section.
>
> diff --git a/mercurial/extensions.py b/mercurial/extensions.py
> --- a/mercurial/extensions.py
> +++ b/mercurial/extensions.py
> @@ -11,7 +11,7 @@
>  
>  _extensions = {}
>  _order = []
> -_ignore = ['hbisect', 'bookmarks', 'parentrevspec']
> +_ignore = ['hbisect', 'bookmarks', 'parentrevspec', 'interhg']
>  
>  def extensions():
>      for name in _order:
> diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
> --- a/mercurial/hgweb/hgweb_mod.py
> +++ b/mercurial/hgweb/hgweb_mod.py
> @@ -8,6 +8,7 @@
>  
>  import os
>  from mercurial import ui, hg, hook, error, encoding, templater, util, repoview
> +from mercurial import extensions
>  from mercurial.templatefilters import websub
>  from mercurial.i18n import _
>  from common import get_stat, ErrorResponse, permhooks, caching
> @@ -264,6 +265,8 @@
>      def loadwebsub(self):
>          websubtable = []
>          websubdefs = self.repo.ui.configitems('websub')
> +        # we must maintain interhg backwards compatibility
> +        websubdefs += self.repo.ui.configitems('interhg')

Would it not be better if the interhg extension became a tiny extension
that just did this?

That way the core wont need to care about the old functionality and new
users wont have to care about patterns in an [interhg] extension.
Matt Mackall - Feb. 9, 2013, 11:06 p.m.
On Sun, 2013-02-10 at 00:03 +0100, Martin Geisler wrote:
> Angel Ezquerra <angel.ezquerra@gmail.com> writes:
> 
> > # HG changeset patch
> > # User Angel Ezquerra <angel.ezquerra@gmail.com>
> > # Date 1360404042 -3600
> > # Node ID 6b18726f164093ab77ac754b088be2e90482b65c
> > # Parent  3d1290c7131e8e1df991f1753ab5e76d3e3cd21e
> > extensions: obsolete and remove interhg extension
> >
> > With the addition of the websub filter extension this extension is no longer
> > needed. We maintain a sort of backwards compatibility by reading the [interhg]
> > section and using it as we would use the [websub] section.
> >
> > diff --git a/mercurial/extensions.py b/mercurial/extensions.py
> > --- a/mercurial/extensions.py
> > +++ b/mercurial/extensions.py
> > @@ -11,7 +11,7 @@
> >  
> >  _extensions = {}
> >  _order = []
> > -_ignore = ['hbisect', 'bookmarks', 'parentrevspec']
> > +_ignore = ['hbisect', 'bookmarks', 'parentrevspec', 'interhg']
> >  
> >  def extensions():
> >      for name in _order:
> > diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
> > --- a/mercurial/hgweb/hgweb_mod.py
> > +++ b/mercurial/hgweb/hgweb_mod.py
> > @@ -8,6 +8,7 @@
> >  
> >  import os
> >  from mercurial import ui, hg, hook, error, encoding, templater, util, repoview
> > +from mercurial import extensions
> >  from mercurial.templatefilters import websub
> >  from mercurial.i18n import _
> >  from common import get_stat, ErrorResponse, permhooks, caching
> > @@ -264,6 +265,8 @@
> >      def loadwebsub(self):
> >          websubtable = []
> >          websubdefs = self.repo.ui.configitems('websub')
> > +        # we must maintain interhg backwards compatibility
> > +        websubdefs += self.repo.ui.configitems('interhg')
> 
> Would it not be better if the interhg extension became a tiny extension
> that just did this?
> 
> That way the core wont need to care about the old functionality and new
> users wont have to care about patterns in an [interhg] extension.

We considered this. I'd prefer to have the extension go away.

Patch

diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -11,7 +11,7 @@ 
 
 _extensions = {}
 _order = []
-_ignore = ['hbisect', 'bookmarks', 'parentrevspec']
+_ignore = ['hbisect', 'bookmarks', 'parentrevspec', 'interhg']
 
 def extensions():
     for name in _order:
diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -8,6 +8,7 @@ 
 
 import os
 from mercurial import ui, hg, hook, error, encoding, templater, util, repoview
+from mercurial import extensions
 from mercurial.templatefilters import websub
 from mercurial.i18n import _
 from common import get_stat, ErrorResponse, permhooks, caching
@@ -264,6 +265,8 @@ 
     def loadwebsub(self):
         websubtable = []
         websubdefs = self.repo.ui.configitems('websub')
+        # we must maintain interhg backwards compatibility
+        websubdefs += self.repo.ui.configitems('interhg')
         for key, pattern in websubdefs:
             # grab the delimiter from the character after the "s"
             unesc = pattern[1]
diff --git a/tests/test-interhg.t b/tests/test-websub.t
rename from tests/test-interhg.t
rename to tests/test-websub.t
--- a/tests/test-interhg.t
+++ b/tests/test-websub.t
@@ -5,11 +5,15 @@ 
 
   $ cat > .hg/hgrc <<EOF
   > [extensions]
+  > # this is only necessary to check that the mapping from
+  > # interhg to websub works
   > interhg =
   > 
-  > [interhg]
+  > [websub]
   > issues = s|Issue(\d+)|<a href="http://bts.example.org/issue\1">Issue\1</a>|
   > 
+  > [interhg]
+  > # check that we maintain some interhg backwards compatibility...
   > # yes, 'x' is a weird delimiter...
   > markbugs = sxbugx<i class="\x">bug</i>x
   > EOF
@@ -23,9 +27,8 @@ 
 
 log
 
-  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '' | grep bts
-    <td class="description"><a href="/rev/1b0e7ece6bd6"><a href="http://bts.example.org/issue123">Issue123</a>: fixed the <i class="x">bug</i>!</a><span class="branchhead">default</span> <span class="tag">tip</span> </td>
-
+  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT "rev/tip" | grep bts
+  <div class="description"><a href="http://bts.example.org/issue123">Issue123</a>: fixed the <i class="x">bug</i>!</div>
 errors
 
   $ cat errors.log