[PATCH 3 of 7 PoC] largefiles: use standintolargefiles decorator for update

Mads Kiilerich mads at kiilerich.com
Mon Sep 22 04:13:36 CDT 2014


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1411377060 -7200
#      Mon Sep 22 11:11:00 2014 +0200
# Node ID 3abe2ed48c72df36e1a6c15be86541569df6852b
# Parent  5d277c50fc0e0b9788634518671b7afbd15611bb
largefiles: use standintolargefiles decorator for update

Not really used as long as we have mergeupdate mocking.

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -343,35 +343,9 @@ def overridedebugstate(orig, ui, repo, *
     else:
         orig(ui, repo, *pats, **opts)
 
-# Override needs to refresh standins so that update's normal merge
-# will go through properly. Then the other update hook (overriding repo.update)
-# will get the new files. Filemerge is also overridden so that the merge
-# will merge standins correctly.
+ at lfutil.standintolargefiles(printmessage=False)
 def overrideupdate(orig, ui, repo, *pats, **opts):
-    # Need to lock between the standins getting updated and their
-    # largefiles getting updated
-    wlock = repo.wlock()
-    try:
-        lfdirstate = lfutil.openlfdirstate(ui, repo)
-        s = lfdirstate.status(match_.always(repo.root, repo.getcwd()),
-            [], False, False, False)
-        (unsure, modified, added, removed, missing, unknown, ignored, clean) = s
-
-        if opts['check']:
-            mod = len(modified) > 0
-            for lfile in unsure:
-                standin = lfutil.standin(lfile)
-                if repo['.'][standin].data().strip() != \
-                        lfutil.hashfile(repo.wjoin(lfile)):
-                    mod = True
-                else:
-                    lfdirstate.normal(lfile)
-            lfdirstate.write()
-            if mod:
-                raise util.Abort(_('uncommitted changes'))
-        return orig(ui, repo, *pats, **opts)
-    finally:
-        wlock.release()
+    return orig(ui, repo, *pats, **opts)
 
 # Before starting the manifest merge, merge.updates will call
 # _checkunknown to check if there are any files in the merged-in
@@ -694,6 +668,7 @@ def overriderevert(orig, ui, repo, *pats
 # When we rebase a repository with remotely changed largefiles, we need to
 # take some extra care so that the largefiles are correctly updated in the
 # working copy
+ at lfutil.standintolargefiles(printmessage=False)
 def overridepull(orig, ui, repo, source=None, **opts):
     revsprepull = len(repo)
     if not source:
diff --git a/tests/test-largefiles-cache.t b/tests/test-largefiles-cache.t
--- a/tests/test-largefiles-cache.t
+++ b/tests/test-largefiles-cache.t
@@ -50,6 +50,7 @@ but there is no cache file for it.  So, 
   large: largefile 7f7097b041ccf68cc5561e9600da4655d21c6d18 not available from file:/*/$TESTTMP/mirror (glob)
   0 largefiles updated, 0 removed
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  large: largefile 7f7097b041ccf68cc5561e9600da4655d21c6d18 not available from file://$TESTTMP/mirror
   $ hg status
   ! large
 
@@ -58,7 +59,7 @@ Update working directory to null: this c
   $ hg update null
   getting changed largefiles
   0 largefiles updated, 0 removed
-  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 Update working directory to tip, again.
 
@@ -67,6 +68,7 @@ Update working directory to tip, again.
   large: largefile 7f7097b041ccf68cc5561e9600da4655d21c6d18 not available from file:/*/$TESTTMP/mirror (glob)
   0 largefiles updated, 0 removed
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  large: largefile 7f7097b041ccf68cc5561e9600da4655d21c6d18 not available from file://$TESTTMP/mirror
   $ hg status
   ! large
   $ cd ..
@@ -112,6 +114,8 @@ Test permission of with files in .hg/lar
   $ rm -r "$USERCACHE" .hg/largefiles # avoid links
   $ chmod 750 .hg/store
   $ hg pull ../src --update -q
+  remote changed .hglf/large which local deleted
+  use (c)hanged version or leave (d)eleted? c
   $ ../ls-l.py .hg/largefiles/e151b474069de4ca6898f67ce2f2a7263adf8fea
   640
 
diff --git a/tests/test-largefiles-update.t b/tests/test-largefiles-update.t
--- a/tests/test-largefiles-update.t
+++ b/tests/test-largefiles-update.t
@@ -316,6 +316,7 @@ Test a linear merge to a revision contai
   $ hg update -q 5
   remote turned local largefile large3 into a normal file
   keep (l)argefile or use (n)ormal file? l
+  large3: largefile efc9f65fa669692243b209ce991e3e7fe9996d66 not available from file://$TESTTMP/repo
   $ hg debugdirstate --nodates | grep large3
   a   0         -1 .hglf/large3
   r   0          0 large3
diff --git a/tests/test-largefiles-wireproto.t b/tests/test-largefiles-wireproto.t
--- a/tests/test-largefiles-wireproto.t
+++ b/tests/test-largefiles-wireproto.t
@@ -236,6 +236,7 @@ largefiles pulled on update - a largefil
   f1: largefile 02a439e5c31c526465ab1a0ca1f431f76b827b90 not available from http://localhost:$HGPORT2/
   0 largefiles updated, 0 removed
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  f1: largefile 02a439e5c31c526465ab1a0ca1f431f76b827b90 not available from http://localhost:$HGPORT2/
   $ hg -R http-clone st
   ! f1
   $ hg -R http-clone up -Cqr null
@@ -247,6 +248,7 @@ largefiles pulled on update - a largefil
   f1: data corruption (expected 02a439e5c31c526465ab1a0ca1f431f76b827b90, got 6a7bb2556144babe3899b25e5428123735bb1e27)
   0 largefiles updated, 0 removed
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  f1: data corruption (expected 02a439e5c31c526465ab1a0ca1f431f76b827b90, got 6a7bb2556144babe3899b25e5428123735bb1e27)
   $ hg -R http-clone st
   ! f1
   $ [ ! -f http-clone/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
@@ -281,6 +283,7 @@ largefiles pulled on update - no server 
   found 02a439e5c31c526465ab1a0ca1f431f76b827b90 in store
   1 largefiles updated, 0 removed
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  found 02a439e5c31c526465ab1a0ca1f431f76b827b90 in store
 
   $ ls http-clone-usercache/*
   http-clone-usercache/02a439e5c31c526465ab1a0ca1f431f76b827b90
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -1566,6 +1566,7 @@ Update to revision with missing largefil
   large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob)
   1 largefiles updated, 2 removed
   4 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file://$TESTTMP/d
   $ rm normal3
   $ echo >> sub/normal4
   $ hg ci -m 'commit with missing files'
@@ -1586,7 +1587,8 @@ Update to revision with missing largefil
   getting changed largefiles
   large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob)
   0 largefiles updated, 0 removed
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file://$TESTTMP/d
   $ hg st
   ! large3
   $ hg rollback


More information about the Mercurial-devel mailing list