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

Greg Ward greg-hg at gerg.ca
Wed Oct 12 08:06:54 CDT 2011


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.

Greg


More information about the Mercurial-devel mailing list