[PATCH] largefiles: remove pre-1.9 code from extension first bundled with 1.9

Na'Tosha Bard natosha at unity3d.com
Wed Oct 12 08:12:06 CDT 2011


2011/10/12 Greg Ward <greg-hg at gerg.ca>

> On Tue, Oct 11, 2011 at 8:04 AM, Na'Tosha Bard <natosha at unity3d.com>
> wrote:
> > # HG changeset patch
> > # User Na'Tosha Bard <natosha at unity3d.com>
> > # Date 1318322576 -7200
> > # Node ID 9c45186be93e83b8cd466e65e9d55cda6a23595d
> > # Parent  c81dce8a7bb642248b787c3139409d94dbe998ab
> > largefiles: remove pre-1.9 code from extension first bundled with 1.9
>
> I would phrase that commit message differently:
>
>  largefiles: remove compatibility code for old Mercurial versions (pre-1.9)
>
> After all, largefiles will first be included with 2.0!
>
> > --- a/hgext/largefiles/lfcommands.py    Mon Oct 10 17:57:40 2011 -0500
> > +++ b/hgext/largefiles/lfcommands.py    Tue Oct 11 10:42:56 2011 +0200
> > diff -r c81dce8a7bb6 -r 9c45186be93e hgext/largefiles/lfutil.py
> > --- a/hgext/largefiles/lfutil.py        Mon Oct 10 17:57:40 2011 -0500
> > +++ b/hgext/largefiles/lfutil.py        Tue Oct 11 10:42:56 2011 +0200
> > @@ -30,74 +30,38 @@
> >
> >  # -- Portability wrappers ----------------------------------------------
> >
> > -if 'subrepos' in inspect.getargspec(dirstate.dirstate.status)[0]:
> > -    # for Mercurial >= 1.5
> > -    def dirstate_walk(dirstate, matcher, unknown=False, ignored=False):
> > -        return dirstate.walk(matcher, [], unknown, ignored)
> > -else:
> > -    # for Mercurial <= 1.4
> > -    def dirstate_walk(dirstate, matcher, unknown=False, ignored=False):
> > -        return dirstate.walk(matcher, unknown, ignored)
> > +def dirstate_walk(dirstate, matcher, unknown=False, ignored=False):
> > +    return dirstate.walk(matcher, [], unknown, ignored)
>
> Wouldn't it make sense to just inline that function call now? After
> all, the only reason it exists is to isolate all the compatibility
> wrappers in one place.
>
> If you were planning to send that as a second changeset, ignore me.
> That's probably the way to do it.
>
> >  def repo_add(repo, list):
> > -    try:
> > -        # Mercurial <= 1.5
> > -        add = repo.add
> > -    except AttributeError:
> > -        # Mercurial >= 1.6
> > -        add = repo[None].add
> > +    add = repo[None].add
>
> Same here. And for all the other compat wrappers


I could go either way regarding the commit message; I put 1.9 because we
added them in a 1.9-something version.

Regarding the refactoring: I think you are right; there is a lot of space to
be saved here by in-lining a lot of these functions.  But as refactoring
goes, there's a lot left to be done and we're getting close to code freeze.
I think it's better to get the largefiles test suite up-to-snuff (which I am
working on as I write this) before doing more refactoring which might
accidentally break stuff.

Cheers,
Na'Tosha


-- 
*Na'Tosha Bard*
Build & Infrastructure Developer | Unity Technologies

*E-Mail:* natosha at unity3d.com
*Skype:* natosha.bard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20111012/abb1c18e/attachment.html>


More information about the Mercurial-devel mailing list