[PATCH 4 of 8] localrepo: factor out parentworking logic for comparing files

Durham Goode durham at fb.com
Fri May 9 21:00:03 CDT 2014


On 5/6/14, 4:33 PM, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean.michael.farley at gmail.com>
> # Date 1394579400 18000
> #      Tue Mar 11 18:10:00 2014 -0500
> # Node ID dae520d39627d8fd50668c590516baaae236d26b
> # Parent  eecae40cba0ea00b3cd5d1284f820d65fb32d6b4
> localrepo: factor out parentworking logic for comparing files

>   class committablefilectx(basefilectx):
>       """A committablefilectx provides common functionality for a file context
>       that wants the ability to commit, e.g. workingfilectx or memfilectx."""
>       def __init__(self, repo, path, filelog=None, ctx=None):
>           self._repo = repo
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -1552,36 +1552,16 @@ class localrepository(object):
>                                        listclean, listunknown)
>               cmp, modified, added, removed, deleted, unknown, ignored, clean = s
>   
>               # check for any possibly clean files
>               if parentworking and cmp:
> -                fixup = []
> -                # do a full compare of any files that might have changed
> -                for f in sorted(cmp):
> -                    if (f not in ctx1 or ctx2.flags(f) != ctx1.flags(f)
> -                        or ctx1[f].cmp(ctx2[f])):
> -                        modified.append(f)
> -                    else:
> -                        fixup.append(f)
> +                modified2, fixup = ctx2._checklookup(cmp)
> +                modified += modified2
>   
Is it ok to call a underscore method from another class?  I thought 
underscore methods were considered private to that class.


More information about the Mercurial-devel mailing list