largefiles: fix update from a merge with removed files
authorMads Kiilerich <madski@unity3d.com>
Fri, 11 Jan 2013 16:30:29 +0100
changeset 18300 745bc16ccef2
parent 18299 a7a88a458a4c
child 18301 49ad7030ecc4
largefiles: fix update from a merge with removed files A situation with this case could happen after interrupting an update. Update would fail with: abort: No such file or directory: $TESTTMP/f/.hglf/sub2/large6 Update from a merge without using clean is not possible anyway, so this patch takes a step in the right direction so it gets as far as reporting the right error.
hgext/largefiles/lfutil.py
tests/test-largefiles.t
--- a/hgext/largefiles/lfutil.py	Fri Jan 11 16:30:29 2013 +0100
+++ b/hgext/largefiles/lfutil.py	Fri Jan 11 16:30:29 2013 +0100
@@ -421,7 +421,11 @@
     matcher = getstandinmatcher(repo)
     for standin in repo.dirstate.walk(matcher, [], False, False):
         lfile = splitstandin(standin)
-        standins.append((lfile, readstandin(repo, lfile)))
+        try:
+            hash = readstandin(repo, lfile)
+        except IOError:
+            hash = None
+        standins.append((lfile, hash))
     return standins
 
 def getlfilestoupdate(oldstandins, newstandins):
--- a/tests/test-largefiles.t	Fri Jan 11 16:30:29 2013 +0100
+++ b/tests/test-largefiles.t	Fri Jan 11 16:30:29 2013 +0100
@@ -1220,9 +1220,16 @@
   $ hg status
   M large
 
+- make sure update of merge with removed largefiles fails as expected
+  $ hg rm sub2/large6
+  $ hg up -r.
+  abort: outstanding uncommitted merges
+  [255]
+
 - revert should be able to revert files introduced in a pending merge
   $ hg revert --all -r .
   removing .hglf/large
+  undeleting .hglf/sub2/large6
 
 Test that a normal file and a largefile with the same name and path cannot
 coexist.