largefiles: missing largefiles should not be committed as removed stable
authorMads Kiilerich <madski@unity3d.com>
Thu, 28 Feb 2013 13:45:18 +0100
branchstable
changeset 18726 431b246cfb12
parent 18725 0ac00315875f
child 18727 4846f2115927
largefiles: missing largefiles should not be committed as removed Largefiles can easily become missing - for example if it simply isn't available or the download fail. It might even be convenient to be able to work that way in some cases. But commiting missing largefiles as if they had been 'hg remove'd is plain wrong.
hgext/largefiles/reposetup.py
tests/test-largefiles.t
--- a/hgext/largefiles/reposetup.py	Thu Feb 28 13:45:18 2013 +0100
+++ b/hgext/largefiles/reposetup.py	Thu Feb 28 13:45:18 2013 +0100
@@ -299,9 +299,9 @@
                     lfdirstate = lfutil.openlfdirstate(ui, self)
                     dirtymatch = match_.always(self.root, self.getcwd())
                     s = lfdirstate.status(dirtymatch, [], False, False, False)
-                    modifiedfiles = []
-                    for i in s:
-                        modifiedfiles.extend(i)
+                    (unsure, modified, added, removed, _missing, _unknown,
+                            _ignored, _clean) = s
+                    modifiedfiles = unsure + modified + added + removed
                     lfiles = lfutil.listlfiles(self)
                     # this only loops through largefiles that exist (not
                     # removed/renamed)
--- a/tests/test-largefiles.t	Thu Feb 28 13:45:18 2013 +0100
+++ b/tests/test-largefiles.t	Thu Feb 28 13:45:18 2013 +0100
@@ -1261,6 +1261,42 @@
 
 - cleanup
   $ rm $TESTTMP/d/.hg/largefiles/eb7338044dc27f9bc59b8dd5a246b065ead7a9c4
+  $ rm -f .hglf/sub/*.orig
+
+Update to revision with missing largefile - and make sure it really is missing
+
+  $ rm ${USERCACHE}/7838695e10da2bb75ac1156565f40a2595fa2fa0
+  $ hg up -r 6
+  getting changed largefiles
+  error getting id 7838695e10da2bb75ac1156565f40a2595fa2fa0 from url file:$TESTTMP/d for file large3: can't get file locally (glob)
+  1 largefiles updated, 2 removed
+  4 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ rm normal3
+  $ echo >> sub/normal4
+  $ hg ci -m 'commit with missing files'
+  Invoking status precommit hook
+  M sub/normal4
+  ! large3
+  ! normal3
+  created new head
+  $ hg st
+  ! large3
+  ! normal3
+  $ hg up -r.
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg st
+  ! large3
+  ! normal3
+  $ hg up -Cr.
+  getting changed largefiles
+  error getting id 7838695e10da2bb75ac1156565f40a2595fa2fa0 from url file:$TESTTMP/d for file large3: can't get file locally (glob)
+  0 largefiles updated, 0 removed
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg st
+  ! large3
+  $ hg rollback
+  repository tip rolled back to revision 9 (undo commit)
+  working directory now based on revision 6
 
 Pulling 0 revisions with --all-largefiles should not fetch for all revisions