changeset 23592:96d335e4eacb stable

largefiles: don't actually remove largefiles in an addremove dry run The addlargefiles() method already properly handled dry runs.
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 13 Dec 2014 13:33:48 -0500
parents 424d669118d3
children b1179dabc6de
files hgext/largefiles/overrides.py tests/test-largefiles-misc.t
diffstat 2 files changed, 19 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Mon Dec 08 15:41:54 2014 -0800
+++ b/hgext/largefiles/overrides.py	Sat Dec 13 13:33:48 2014 -0500
@@ -189,8 +189,15 @@
                 # are removing the file.
                 if isaddremove:
                     ui.status(_('removing %s\n') % f)
-                util.unlinkpath(repo.wjoin(f), ignoremissing=True)
-            lfdirstate.remove(f)
+
+            if not opts.get('dry_run'):
+                if not after:
+                    util.unlinkpath(repo.wjoin(f), ignoremissing=True)
+                lfdirstate.remove(f)
+
+        if opts.get('dry_run'):
+            return result
+
         lfdirstate.write()
         remove = [lfutil.standin(f) for f in remove]
         # If this is being called by addremove, let the original addremove
--- a/tests/test-largefiles-misc.t	Mon Dec 08 15:41:54 2014 -0800
+++ b/tests/test-largefiles-misc.t	Sat Dec 13 13:33:48 2014 -0500
@@ -250,6 +250,16 @@
 Add a normal file to the subrepo, then test archiving
 
   $ echo 'normal file' > subrepo/normal.txt
+  $ mv subrepo/large.txt subrepo/renamed-large.txt
+  $ hg -R subrepo addremove --dry-run
+  removing large.txt
+  adding normal.txt
+  adding renamed-large.txt
+  $ hg status -S
+  ! subrepo/large.txt
+  ? subrepo/normal.txt
+  ? subrepo/renamed-large.txt
+  $ mv subrepo/renamed-large.txt subrepo/large.txt
   $ hg -R subrepo add subrepo/normal.txt
 
 Lock in subrepo, otherwise the change isn't archived