Patchwork [35,of,35,V2] workingctx: inherit from context instead of changectx

login
register
mail settings
Submitter Sean Farley
Date Aug. 7, 2013, 11:51 p.m.
Message ID <3bfef4b7625282b14f57.1375919509@laptop.local>
Download mbox | patch
Permalink /patch/2088/
State Accepted
Headers show

Comments

Sean Farley - Aug. 7, 2013, 11:51 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1375746258 18000
#      Mon Aug 05 18:44:18 2013 -0500
# Node ID 3bfef4b7625282b14f5727aaefbcb906af804262
# Parent  28a28810fa48edc0521df4a68b296560e9017a1b
workingctx: inherit from context instead of changectx
Yuya Nishihara - Aug. 24, 2013, 12:35 p.m.
On Wed, 07 Aug 2013 18:51:49 -0500, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean.michael.farley@gmail.com>
> # Date 1375746258 18000
> #      Mon Aug 05 18:44:18 2013 -0500
> # Node ID 3bfef4b7625282b14f5727aaefbcb906af804262
> # Parent  28a28810fa48edc0521df4a68b296560e9017a1b
> workingctx: inherit from context instead of changectx
> 
> diff --git a/mercurial/context.py b/mercurial/context.py
> --- a/mercurial/context.py
> +++ b/mercurial/context.py
> @@ -808,11 +808,11 @@
>          sc2 = str(c2)
>          if sc2 not in self._copycache:
>              self._copycache[sc2] = copies.pathcopies(c2)
>          return self._copycache[sc2]
>  
> -class workingctx(changectx):
> +class workingctx(context):
>      """A workingctx object makes access to data related to

Hi,

This removed obsolete(), extinct(), etc. from workingctx.  Was it by design?

In TortoiseHg, we have patchctx class [1] which represents unapplied patches.
I want to know if we should

 - remove dummy obsolete(), etc. from our patchctx
 - and test isinstance(ctx, changectx) prior to ctx.obsolete()

 [1]: https://bitbucket.org/tortoisehg/thg/src/33d9b9fee438/tortoisehg/util/patchctx.py

Regards,
Sean Farley - Sept. 18, 2013, 8:12 p.m.
yuya@tcha.org writes:

> On Wed, 07 Aug 2013 18:51:49 -0500, Sean Farley wrote:
>> # HG changeset patch
>> # User Sean Farley <sean.michael.farley@gmail.com>
>> # Date 1375746258 18000
>> #      Mon Aug 05 18:44:18 2013 -0500
>> # Node ID 3bfef4b7625282b14f5727aaefbcb906af804262
>> # Parent  28a28810fa48edc0521df4a68b296560e9017a1b
>> workingctx: inherit from context instead of changectx
>> 
>> diff --git a/mercurial/context.py b/mercurial/context.py
>> --- a/mercurial/context.py
>> +++ b/mercurial/context.py
>> @@ -808,11 +808,11 @@
>>          sc2 = str(c2)
>>          if sc2 not in self._copycache:
>>              self._copycache[sc2] = copies.pathcopies(c2)
>>          return self._copycache[sc2]
>>  
>> -class workingctx(changectx):
>> +class workingctx(context):
>>      """A workingctx object makes access to data related to
>
> Hi,
>
> This removed obsolete(), extinct(), etc. from workingctx.  Was it by design?

It was a wrong assumption on my part. Thanks for pointing it out to me.

> In TortoiseHg, we have patchctx class [1] which represents unapplied patches.
> I want to know if we should
>
>  - remove dummy obsolete(), etc. from our patchctx
>  - and test isinstance(ctx, changectx) prior to ctx.obsolete()
>
>  [1]: https://bitbucket.org/tortoisehg/thg/src/33d9b9fee438/tortoisehg/util/patchctx.py

A fix has been pushed to default already so you shouldn't have to do
anything new. In the near future, you might want to look into inheriting
from workingctx or even memctx.
Yuya Nishihara - Sept. 19, 2013, 3:37 p.m.
On Wed, 18 Sep 2013 15:12:46 -0500, Sean Farley wrote:
> yuya@tcha.org writes:
> > On Wed, 07 Aug 2013 18:51:49 -0500, Sean Farley wrote:
> >> # HG changeset patch
> >> # User Sean Farley <sean.michael.farley@gmail.com>
> >> # Date 1375746258 18000
> >> #      Mon Aug 05 18:44:18 2013 -0500
> >> # Node ID 3bfef4b7625282b14f5727aaefbcb906af804262
> >> # Parent  28a28810fa48edc0521df4a68b296560e9017a1b
> >> workingctx: inherit from context instead of changectx
> >> 
> >> diff --git a/mercurial/context.py b/mercurial/context.py
> >> --- a/mercurial/context.py
> >> +++ b/mercurial/context.py
> >> @@ -808,11 +808,11 @@
> >>          sc2 = str(c2)
> >>          if sc2 not in self._copycache:
> >>              self._copycache[sc2] = copies.pathcopies(c2)
> >>          return self._copycache[sc2]
> >>  
> >> -class workingctx(changectx):
> >> +class workingctx(context):
> >>      """A workingctx object makes access to data related to
> >
> > This removed obsolete(), extinct(), etc. from workingctx.  Was it by design?
> 
> It was a wrong assumption on my part. Thanks for pointing it out to me.
> 
> > In TortoiseHg, we have patchctx class [1] which represents unapplied patches.
> > I want to know if we should
> >
> >  - remove dummy obsolete(), etc. from our patchctx
> >  - and test isinstance(ctx, changectx) prior to ctx.obsolete()
> >
> >  [1]: https://bitbucket.org/tortoisehg/thg/src/33d9b9fee438/tortoisehg/util/patchctx.py
> 
> A fix has been pushed to default already so you shouldn't have to do
> anything new. In the near future, you might want to look into inheriting
> from workingctx or even memctx.

Confirmed the fix, thank you. I'll watch further improvements in context
module.

Regards,

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -808,11 +808,11 @@ 
         sc2 = str(c2)
         if sc2 not in self._copycache:
             self._copycache[sc2] = copies.pathcopies(c2)
         return self._copycache[sc2]
 
-class workingctx(changectx):
+class workingctx(context):
     """A workingctx object makes access to data related to
     the current working directory convenient.
     date - any valid date string or (unixtime, offset), or None.
     user - username string, or None.
     extra - a dictionary of extra values, or None.