largefiles: ignore removal status of files not managed in the target context
Before this patch, "hg status --rev REV" listed largefiles removed in
the working directory up with "R" mark, even if they aren't managed in
the REV. Normal files aren't listed up in such case.
When "lfilesrepo.status" is invoked for "hg status --rev REV", it
treats files on conditions below as "removed" (to avoid manifest full
scan in "ctx.status" ?):
- marked as "R" in lfdirstate, or
- files managed in the target revision but unknown in the manifest
of the working context (= not including "R" files)
But the former can include files not managed in the target context.
To ignore removal status of files not managed in the target context,
this patch drops files unknown in the target revision from "removed"
list.
--- a/hgext/largefiles/reposetup.py Sun Oct 26 12:14:12 2014 +0100
+++ b/hgext/largefiles/reposetup.py Tue Oct 28 01:14:11 2014 +0900
@@ -182,6 +182,13 @@
else:
added.append(lfile)
+ # at this point, 'removed' contains largefiles
+ # marked as 'R' in the working context.
+ # then, largefiles not managed also in the target
+ # context should be excluded from 'removed'.
+ removed = [lfile for lfile in removed
+ if lfutil.standin(lfile) in ctx1]
+
# Standins no longer found in lfdirstate has been
# removed
for standin in ctx1.walk(lfutil.getstandinmatcher(self)):
--- a/tests/test-largefiles-update.t Sun Oct 26 12:14:12 2014 +0100
+++ b/tests/test-largefiles-update.t Tue Oct 28 01:14:11 2014 +0900
@@ -543,4 +543,13 @@
$ cat largeX
largeX
+Test that "hg status" doesn't show removal of largefiles not managed
+in the target context.
+
+ $ hg update -q -C 4
+ $ hg remove largeX
+ $ hg status -A largeX
+ R largeX
+ $ hg status -A --rev '.^1' largeX
+
$ cd ..