[PATCH 2 of 8] tests: introduce addremove coverage for largefiles with subrepos

Matt Harbison mharbison72 at gmail.com
Tue Dec 23 14:56:14 CST 2014


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1417224878 18000
#      Fri Nov 28 20:34:38 2014 -0500
# Node ID 04de3b9ae56e98740c83ee342b68d735b7e9ec73
# Parent  14255160990a6081b4eb91e901950bbdbc130d80
tests: introduce addremove coverage for largefiles with subrepos

These tests exist already for normal files without the extension, but largefiles
does its own file name printing.  The cases tested are with a path or with '-S',
from the root of the repository, and from outside the repository.  The 'adding'
lines are mostly correct (except when adding outside the repo and not specifying
a path), but the 'removing' lines are missing the path prefix.

The add component properly respects restricting the operation to a specific
part of the repository by passing a path, but the remove component currently
ignores that.  These issues will be fixed in subsequent patches.

There is also an issue where dryruns appear to add a file as both a large and a
normal file.  This is cosmetic though- it doesn't happen without --dry-run.  The
reason is that the largefiles are added first, and then the normal files are
added.  In a regular run, the largefile isn't returned by
scmutil._interestingfiles(), because it has been stripped out of the matcher by
overrides.composenormalfilematcher().  But that doesn't happen in a dryrun
because the stripping only happens if there is a standin, so scmutil.addremove()
thinks the largefile candidate is an untracked file.

diff --git a/tests/test-largefiles-misc.t b/tests/test-largefiles-misc.t
--- a/tests/test-largefiles-misc.t
+++ b/tests/test-largefiles-misc.t
@@ -255,17 +255,62 @@
 Add a normal file to the subrepo, then test archiving
 
   $ echo 'normal file' > subrepo/normal.txt
+  $ touch large.dat
   $ mv subrepo/large.txt subrepo/renamed-large.txt
-  $ hg -R subrepo addremove --dry-run
+  $ hg addremove -S --dry-run
+  adding large.dat as a largefile
   removing large.txt
-  adding normal.txt
-  adding renamed-large.txt
+  adding subrepo/normal.txt (glob)
+  adding subrepo/renamed-large.txt (glob)
+  adding large.dat
   $ hg status -S
   ! subrepo/large.txt
+  ? large.dat
   ? subrepo/normal.txt
   ? subrepo/renamed-large.txt
+
+  $ hg addremove --dry-run subrepo
+  removing large.txt
+  adding subrepo/normal.txt (glob)
+  adding subrepo/renamed-large.txt (glob)
+  $ hg status -S
+  ! subrepo/large.txt
+  ? large.dat
+  ? subrepo/normal.txt
+  ? subrepo/renamed-large.txt
+  $ cd ..
+
+  $ hg -R statusmatch addremove --dry-run statusmatch/subrepo
+  removing large.txt
+  adding statusmatch/subrepo/normal.txt (glob)
+  adding statusmatch/subrepo/renamed-large.txt (glob)
+  $ hg -R statusmatch status -S
+  ! subrepo/large.txt
+  ? large.dat
+  ? subrepo/normal.txt
+  ? subrepo/renamed-large.txt
+
+  $ hg -R statusmatch addremove --dry-run -S
+  adding statusmatch/large.dat as a largefile (glob)
+  removing large.txt
+  adding subrepo/normal.txt (glob)
+  adding subrepo/renamed-large.txt (glob)
+  adding large.dat
+  $ cd statusmatch
+
   $ mv subrepo/renamed-large.txt subrepo/large.txt
-  $ hg -R subrepo add subrepo/normal.txt
+  $ hg addremove subrepo
+  adding subrepo/normal.txt (glob)
+  $ hg forget subrepo/normal.txt
+
+  $ hg addremove -S
+  adding large.dat as a largefile
+  adding subrepo/normal.txt (glob)
+  $ rm large.dat
+
+  $ hg addremove subrepo
+  removing large.dat
+  $ hg addremove -S
 
 Lock in subrepo, otherwise the change isn't archived
 
@@ -276,6 +321,7 @@
   A normal.txt
   Invoking status precommit hook
   M .hgsubstate
+  R large.dat
   $ hg archive -S ../lf_subrepo_archive
   $ find ../lf_subrepo_archive | sort
   ../lf_subrepo_archive
@@ -319,6 +365,14 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg status -S
 
+  $ rm subrepo/large.txt
+
+NB: The path in the message is wrong
+  $ hg addremove -S
+  removing large.txt
+  $ hg st -S
+  R subrepo/large.txt
+
 Test archiving a revision that references a subrepo that is not yet
 cloned (see test-subrepo-recursion.t):
 


More information about the Mercurial-devel mailing list