[PATCH STABLE] largefiles: fix "hg status dir" missing regular files (issue3421)
Patrick Mezard
patrick at mezard.eu
Sun May 6 06:15:45 CDT 2012
# HG changeset patch
# User Patrick Mezard <patrick at mezard.eu>
# Date 1336302898 -7200
# Branch stable
# Node ID 557664bce5aaef5b68f1a6ce13ec7100869246d2
# Parent 91323a78aac252b630144f66e1039321cd41c9ef
largefiles: fix "hg status dir" missing regular files (issue3421)
largefiles status implementation attemps to rewrite the input match objects to
match the "standins" as well as the regular files. When fixing the directories
listed in match.files(), if there was related standin entry, it was kept and
the original path discarded. But directories can appear both as regular and
standin entries.
diff --git a/hgext/largefiles/reposetup.py b/hgext/largefiles/reposetup.py
--- a/hgext/largefiles/reposetup.py
+++ b/hgext/largefiles/reposetup.py
@@ -136,13 +136,22 @@
# Create a copy of match that matches standins instead
# of largefiles.
- def tostandin(file):
- if working:
- sf = lfutil.standin(file)
- dirstate = repo.dirstate
- if sf in dirstate or sf in dirstate.dirs():
- return sf
- return file
+ def tostandins(files):
+ if not working:
+ return files
+ newfiles = []
+ dirstate = repo.dirstate
+ for f in files:
+ sf = lfutil.standin(f)
+ if sf in dirstate:
+ newfiles.append(sf)
+ elif sf in dirstate.dirs():
+ # Directory entries could be regular or
+ # standin, check both
+ newfiles.extend((f, sf))
+ else:
+ newfiles.append(f)
+ return newfiles
# Create a function that we can use to override what is
# normally the ignore matcher. We've already checked
@@ -153,7 +162,7 @@
return False
m = copy.copy(match)
- m._files = [tostandin(f) for f in m._files]
+ m._files = tostandins(m._files)
# Get ignored files here even if we weren't asked for them; we
# must use the result here for filtering later
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -65,6 +65,21 @@
$ cat sub/large2
large22
+Test status, subdir and unknown files
+
+ $ echo unknown > sub/unknown
+ $ hg st --all
+ ? sub/unknown
+ C large1
+ C normal1
+ C sub/large2
+ C sub/normal2
+ $ hg st --all sub
+ ? sub/unknown
+ C sub/large2
+ C sub/normal2
+ $ rm sub/unknown
+
Remove both largefiles and normal files.
$ hg remove normal1 large1
More information about the Mercurial-devel
mailing list