[PATCH 1 of 3 STABLE] largefiles: respect the rev when reading standins in copytostore() (issue3630)

Matt Harbison matt_harbison at yahoo.com
Mon Oct 22 23:04:10 CDT 2012


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1350798873 14400
# Branch stable
# Node ID 6269e84db360cec75cb70982079f84fba4e9bf21
# Parent  71c1513fd5601f37dc8cdfb08c3943ae963e3607
largefiles: respect the rev when reading standins in copytostore() (issue3630)

When the rev isn't specified, the standin for the working copy gets read.  But
convert doesn't update the working copy for each cset it processes, so there is
no standin and the 'hg convert' would abort complaining about the standin being
missing.

Curiously, if the largefile is not in the user cache, 'hg convert' complains
about the largefile itself missing from the destination repo.

diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py
+++ b/hgext/largefiles/lfutil.py
@@ -215,7 +215,7 @@
     return True
 
 def copytostore(repo, rev, file, uploaded=False):
-    hash = readstandin(repo, file)
+    hash = readstandin(repo, file, rev)
     if instore(repo, hash):
         return
     copytostoreabsolute(repo, repo.wjoin(file), hash)
diff --git a/tests/test-lfconvert.t b/tests/test-lfconvert.t
--- a/tests/test-lfconvert.t
+++ b/tests/test-lfconvert.t
@@ -6,6 +6,7 @@
   > share =
   > graphlog =
   > mq =
+  > convert =
   > [largefiles]
   > minsize = 0.5
   > patterns = **.other
@@ -274,6 +275,46 @@
 
   $ cd ..
 
+  $ hg convert largefiles-repo
+  assuming destination largefiles-repo-hg
+  initializing destination largefiles-repo-hg repository
+  scanning source...
+  sorting...
+  converting...
+  6 add large, normal1
+  5 add sub/*
+  4 rename sub/ to stuff/
+  3 add normal3, modify sub/*
+  2 remove large, normal3
+  1 merge
+  0 add anotherlarge (should be a largefile)
+
+  $ hg -R largefiles-repo-hg glog --template "{rev}:{node|short}  {desc|firstline}\n"
+  o  6:17126745edfd  add anotherlarge (should be a largefile)
+  |
+  o    5:9cc5aa7204f0  merge
+  |\
+  | o  4:a5a02de7a8e4  remove large, normal3
+  | |
+  | o  3:55759520c76f  add normal3, modify sub/*
+  | |
+  o |  2:261ad3f3f037  rename sub/ to stuff/
+  |/
+  o  1:334e5237836d  add sub/*
+  |
+  o  0:d4892ec57ce2  add large, normal1
+  
+  $ hg -R largefiles-repo verify --large --lfa
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  8 files, 7 changesets, 12 total revisions
+  searching 7 changesets for largefiles
+  verified existence of 6 revisions of 4 largefiles
+  $ hg -R largefiles-repo showconfig paths
+
+
 Avoid a traceback if a largefile isn't available (issue3519)
 
 Ensure the largefile can be cached in the source if necessary


More information about the Mercurial-devel mailing list