Patchwork [02,of,13] largefiles: remove overly complex handling of ignored and unknown files

login
register
mail settings
Submitter Mads Kiilerich
Date Dec. 21, 2012, 7:06 p.m.
Message ID <f25956852c892c774c8b.1356116811@mk-desktop>
Download mbox | patch
Permalink /patch/250/
State Accepted
Commit 93206823bd61cee8f7e0e2918dc1e5d78112433f
Headers show

Comments

Mads Kiilerich - Dec. 21, 2012, 7:06 p.m.
# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1355422746 -3600
# Node ID f25956852c892c774c8bc822967a4a2233ae1cb2
# Parent  b35a5b6dead73e2503c09ca94a57ad912b9d3451
largefiles: remove overly complex handling of ignored and unknown files
Kevin Bullock - Dec. 21, 2012, 7:22 p.m.
On Dec 21, 2012, at 1:06 PM, Mads Kiilerich wrote:

> # HG changeset patch
> # User Mads Kiilerich <madski at unity3d.com>
> # Date 1355422746 -3600
> # Node ID f25956852c892c774c8bc822967a4a2233ae1cb2
> # Parent  b35a5b6dead73e2503c09ca94a57ad912b9d3451
> largefiles: remove overly complex handling of ignored and unknown files
> 
> diff --git a/hgext/largefiles/reposetup.py b/hgext/largefiles/reposetup.py
> --- a/hgext/largefiles/reposetup.py
> +++ b/hgext/largefiles/reposetup.py
> @@ -188,17 +188,11 @@
>                         match._files = [f for f in match._files
>                                         if sfindirstate(f)]
>                         # Don't waste time getting the ignored and unknown
> -                        # files again; we already have them
> +                        # files from lfdirstate
>                         s = lfdirstate.status(match, [], False,
>                                 listclean, False)
> -                        (unsure, modified, added, removed, missing, unknown,
> -                                ignored, clean) = s
> -                        # Replace the list of ignored and unknown files with
> -                        # the previously calculated lists, and strip out the
> -                        # largefiles
> -                        lfiles = set(lfdirstate._map)
> -                        ignored = set(result[5]).difference(lfiles)
> -                        unknown = set(result[4]).difference(lfiles)
> +                        (unsure, modified, added, removed, missing, _unknown,
> +                                _ignored, clean) = s

Why are we renaming unknown and ignored here? (Looks to me like the values get thrown away? If so, there should be a comment to that effect.)

>                         if parentworking:
>                             for lfile in unsure:
>                                 standin = lfutil.standin(lfile)
> @@ -229,6 +223,7 @@
>                         # Replace the original ignore function
>                         lfdirstate._ignore = origignore
> 
> +                    # Standins no longer found in lfdirstate has been removed
                                                                have been

>                     for standin in ctx1.manifest():
>                         if not lfutil.isstandin(standin):
>                             continue
> @@ -243,20 +238,17 @@
> 
>                     # Largefiles are not really removed when they're
>                     # still in the normal dirstate. Likewise, normal
> -                    # files are not really removed if it's still in
> +                    # files are not really removed if they are still in

Unrelated grammar fix.

Looks good otherwise.

pacem in terris / ??? / ?????? / ????????? / ??
Kevin R. Bullock

Patch

diff --git a/hgext/largefiles/reposetup.py b/hgext/largefiles/reposetup.py
--- a/hgext/largefiles/reposetup.py
+++ b/hgext/largefiles/reposetup.py
@@ -188,17 +188,11 @@ 
                         match._files = [f for f in match._files
                                         if sfindirstate(f)]
                         # Don't waste time getting the ignored and unknown
-                        # files again; we already have them
+                        # files from lfdirstate
                         s = lfdirstate.status(match, [], False,
                                 listclean, False)
-                        (unsure, modified, added, removed, missing, unknown,
-                                ignored, clean) = s
-                        # Replace the list of ignored and unknown files with
-                        # the previously calculated lists, and strip out the
-                        # largefiles
-                        lfiles = set(lfdirstate._map)
-                        ignored = set(result[5]).difference(lfiles)
-                        unknown = set(result[4]).difference(lfiles)
+                        (unsure, modified, added, removed, missing, _unknown,
+                                _ignored, clean) = s
                         if parentworking:
                             for lfile in unsure:
                                 standin = lfutil.standin(lfile)
@@ -229,6 +223,7 @@ 
                         # Replace the original ignore function
                         lfdirstate._ignore = origignore
 
+                    # Standins no longer found in lfdirstate has been removed
                     for standin in ctx1.manifest():
                         if not lfutil.isstandin(standin):
                             continue
@@ -243,20 +238,17 @@ 
 
                     # Largefiles are not really removed when they're
                     # still in the normal dirstate. Likewise, normal
-                    # files are not really removed if it's still in
+                    # files are not really removed if they are still in
                     # lfdirstate. This happens in merges where files
                     # change type.
                     removed = [f for f in removed if f not in self.dirstate]
                     result[2] = [f for f in result[2] if f not in lfdirstate]
 
+                    lfiles = set(lfdirstate._map)
                     # Unknown files
-                    unknown = set(unknown).difference(ignored)
-                    result[4] = [f for f in unknown
-                                 if (self.dirstate[f] == '?' and
-                                     not lfutil.isstandin(f))]
-                    # Ignored files were calculated earlier by the dirstate,
-                    # and we already stripped out the largefiles from the list
-                    result[5] = ignored
+                    result[4] = set(result[4]).difference(lfiles)
+                    # Ignored files
+                    result[5] = set(result[5]).difference(lfiles)
                     # combine normal files and largefiles
                     normals = [[fn for fn in filelist
                                 if not lfutil.isstandin(fn)]