Mercurial > hg-stable
changeset 42213:84bd6ae2d1f6
narrow: also warn when not deleting untracked or ignored files
Differential Revision: https://phab.mercurial-scm.org/D6265
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 17 Apr 2019 10:49:11 -0700 |
parents | 6631f3e89b6f |
children | 3bdb21bbf791 |
files | mercurial/narrowspec.py tests/test-narrow-share.t |
diffstat | 2 files changed, 19 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/narrowspec.py Wed Apr 17 14:37:06 2019 +0200 +++ b/mercurial/narrowspec.py Wed Apr 17 10:49:11 2019 -0700 @@ -293,8 +293,8 @@ removedmatch = matchmod.differencematcher(oldmatch, newmatch) ds = repo.dirstate - lookup, status = ds.status(removedmatch, subrepos=[], ignored=False, - clean=True, unknown=False) + lookup, status = ds.status(removedmatch, subrepos=[], ignored=True, + clean=True, unknown=True) trackeddirty = status.modified + status.added clean = status.clean if assumeclean: @@ -306,6 +306,10 @@ uipathfn = scmutil.getuipathfn(repo) for f in sorted(trackeddirty): repo.ui.status(_('not deleting possibly dirty file %s\n') % uipathfn(f)) + for f in sorted(status.unknown): + repo.ui.status(_('not deleting unknown file %s\n') % uipathfn(f)) + for f in sorted(status.ignored): + repo.ui.status(_('not deleting ignored file %s\n') % uipathfn(f)) for f in clean + trackeddirty: ds.drop(f)
--- a/tests/test-narrow-share.t Wed Apr 17 14:37:06 2019 +0200 +++ b/tests/test-narrow-share.t Wed Apr 17 10:49:11 2019 -0700 @@ -28,6 +28,9 @@ $ hg clone --narrow ssh://user@dummy/remote main -q \ > --include d1 --include d3 --include d5 --include d7 +Ignore file called "ignored" + $ echo ignored > main/.hgignore + $ hg share main share updating working directory 4 files updated, 0 files merged, 0 files removed, 0 files unresolved @@ -55,15 +58,19 @@ # Make d3/f dirty $ echo x >> main/d3/f $ echo y >> main/d3/g + $ touch main/d3/ignored + $ touch main/d3/untracked $ hg add main/d3/g $ hg -R main st M d3/f A d3/g + ? d3/untracked # Make d5/f not match the dirstate timestamp even though it's clean $ sleep 2 $ hg -R main st M d3/f A d3/g + ? d3/untracked $ hg -R main debugdirstate --no-dates n 644 2 set d1/f n 644 2 set d3/f @@ -91,6 +98,8 @@ not deleting possibly dirty file d3/f not deleting possibly dirty file d3/g not deleting possibly dirty file d5/f + not deleting unknown file d3/untracked + not deleting ignored file d3/ignored # d1/f, d3/f, d3/g and d5/f should no longer be reported $ hg -R main files main/d7/f @@ -99,6 +108,8 @@ $ find main/d* -type f | sort main/d3/f main/d3/g + main/d3/ignored + main/d3/untracked main/d5/f main/d7/f @@ -131,6 +142,8 @@ $ hg -R main st --all M d3/f ? d3/g + ? d3/untracked + I d3/ignored C d1/f C d7/f