Patchwork [4,of,4,V2] largefiles: don't print files as both large and normal in addremove dryruns

login
register
mail settings
Submitter Matt Harbison
Date Jan. 8, 2015, 2:45 a.m.
Message ID <5fc9ab7708887577bed4.1420685109@Envy>
Download mbox | patch
Permalink /patch/7376/
State Accepted
Commit bb3ee61cfaa1d3f085c7577f48f566a0f31a6985
Headers show

Comments

Matt Harbison - Jan. 8, 2015, 2:45 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1420069181 18000
#      Wed Dec 31 18:39:41 2014 -0500
# Node ID 5fc9ab7708887577bed414f16b8869b5d59fdaf0
# Parent  f843ab9f31087ea4b51f34e13c717abdd21ee5be
largefiles: don't print files as both large and normal in addremove dryruns
Matt Mackall - Jan. 8, 2015, 6:27 p.m.
On Wed, 2015-01-07 at 21:45 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1420069181 18000
> #      Wed Dec 31 18:39:41 2014 -0500
> # Node ID 5fc9ab7708887577bed414f16b8869b5d59fdaf0
> # Parent  f843ab9f31087ea4b51f34e13c717abdd21ee5be
> largefiles: don't print files as both large and normal in addremove dryruns

These are queued for default, thanks.

Patch

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -34,10 +34,14 @@ 
     m.matchfn = lambda f: lfile(f) and origmatchfn(f)
     return m
 
-def composenormalfilematcher(match, manifest):
+def composenormalfilematcher(match, manifest, exclude=None):
+    excluded = set()
+    if exclude is not None:
+        excluded.update(exclude)
+
     m = copy.copy(match)
     notlfile = lambda f: not (lfutil.isstandin(f) or lfutil.standin(f) in
-            manifest)
+            manifest or f in excluded)
     m._files = filter(notlfile, m._files)
     m._fmap = set(m._files)
     m._always = False
@@ -1132,11 +1136,11 @@ 
         removelargefiles(repo.ui, repo, True, m, **opts)
     # Call into the normal add code, and any files that *should* be added as
     # largefiles will be
-    addlargefiles(repo.ui, repo, True, matcher, **opts)
+    added, bad = addlargefiles(repo.ui, repo, True, matcher, **opts)
     # Now that we've handled largefiles, hand off to the original addremove
     # function to take care of the rest.  Make sure it doesn't do anything with
     # largefiles by passing a matcher that will ignore them.
-    matcher = composenormalfilematcher(matcher, repo[None].manifest())
+    matcher = composenormalfilematcher(matcher, repo[None].manifest(), added)
     return orig(repo, matcher, prefix, opts, dry_run, similarity)
 
 # Calling purge with --all will cause the largefiles to be deleted.
diff --git a/tests/test-largefiles-misc.t b/tests/test-largefiles-misc.t
--- a/tests/test-largefiles-misc.t
+++ b/tests/test-largefiles-misc.t
@@ -262,7 +262,6 @@ 
   removing subrepo/large.txt
   adding subrepo/normal.txt
   adding subrepo/renamed-large.txt
-  adding large.dat
   $ hg status -S
   ! subrepo/large.txt
   ? large.dat
@@ -295,7 +294,6 @@ 
   removing subrepo/large.txt
   adding subrepo/normal.txt
   adding subrepo/renamed-large.txt
-  adding large.dat
   $ cd statusmatch
 
   $ mv subrepo/renamed-large.txt subrepo/large.txt