Patchwork D8517: rust-status: don't dispatch unknown file when traversing if not listing unknowns

login
register
mail settings
Submitter phabricator
Date May 12, 2020, 11:50 a.m.
Message ID <differential-rev-PHID-DREV-fwqz2nelpjlovayrv5iw-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/46303/
State Superseded
Headers show

Comments

phabricator - May 12, 2020, 11:50 a.m.
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This usually isn't a (functional) problem since we ignore the unknown files
  anyway, but when specifically using `hg purge`, unknown files were iterated over
  regardless of the option being true.
  This is both more correct and more efficient.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8517

AFFECTED FILES
  rust/hg-core/src/dirstate/status.rs

CHANGE DETAILS




To: Alphare, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/rust/hg-core/src/dirstate/status.rs b/rust/hg-core/src/dirstate/status.rs
--- a/rust/hg-core/src/dirstate/status.rs
+++ b/rust/hg-core/src/dirstate/status.rs
@@ -371,9 +371,11 @@ 
                         .unwrap();
                 }
             } else {
-                files_sender
-                    .send(Ok((filename.to_owned(), Dispatch::Unknown)))
-                    .unwrap();
+                if options.list_unknown {
+                    files_sender
+                        .send(Ok((filename.to_owned(), Dispatch::Unknown)))
+                        .unwrap();
+                }
             }
         } else if ignore_fn(&filename) && options.list_ignored {
             files_sender