Patchwork [1,of,2,STABLE] largefiles: ignore removal status of files not managed in the target context

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Oct. 27, 2014, 4:18 p.m.
Message ID <6b65dc22d61aeab57b62.1414426708@feefifofum>
Download mbox | patch
Permalink /patch/6474/
State Accepted
Headers show

Comments

Katsunori FUJIWARA - Oct. 27, 2014, 4:18 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1414426451 -32400
#      Tue Oct 28 01:14:11 2014 +0900
# Branch stable
# Node ID 6b65dc22d61aeab57b6287f4a431c7d76856788c
# Parent  0fc4686de1d762844c21f134bc6fdb010b7e6ec5
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.

Patch

diff --git a/hgext/largefiles/reposetup.py b/hgext/largefiles/reposetup.py
--- a/hgext/largefiles/reposetup.py
+++ b/hgext/largefiles/reposetup.py
@@ -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)):
diff --git a/tests/test-largefiles-update.t b/tests/test-largefiles-update.t
--- a/tests/test-largefiles-update.t
+++ b/tests/test-largefiles-update.t
@@ -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 ..