Patchwork [2,of,2,stable] largefiles: update from a merge with removed files

login
register
mail settings
Submitter Mads Kiilerich
Date Jan. 10, 2013, 3:06 p.m.
Message ID <6c874140a67082a3d224.1357830384@mk-desktop>
Download mbox | patch
Permalink /patch/519/
State Superseded
Commit 26627c30735a610f59979a36885b327b25d8dbff
Headers show

Comments

Mads Kiilerich - Jan. 10, 2013, 3:06 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1357830137 -3600
# Branch stable
# Node ID 6c874140a67082a3d22400a827e262960ac26ab5
# Parent  0e6dba8c1af060dddded1bbf12bff3b7616d3ed2
largefiles: 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.
Mads Kiilerich - Jan. 11, 2013, 11:35 p.m.
On 01/10/2013 04:06 PM, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski@unity3d.com>
> # Date 1357830137 -3600
> # Branch stable
> # Node ID 6c874140a67082a3d22400a827e262960ac26ab5
> # Parent  0e6dba8c1af060dddded1bbf12bff3b7616d3ed2
> largefiles: update from a merge with removed files
>

crewed

/Mads

Patch

diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py
+++ b/hgext/largefiles/lfutil.py
@@ -460,7 +460,11 @@ 
     matcher = getstandinmatcher(repo)
     for standin in dirstatewalk(repo.dirstate, matcher):
         lfile = splitstandin(standin)
-        standins.append((lfile, readstandin(repo, lfile)))
+        try:
+            hash = readstandin(repo, lfile)
+        except IOError, e:
+            hash = None
+        standins.append((lfile, hash))
     return standins
 
 def getlfilestoupdate(oldstandins, newstandins):
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -1208,9 +1208,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.