hgext/largefiles/overrides.py
changeset 17824 221c9c3146eb
parent 17702 57fe5aca86af
child 17835 08d11b82d9fc
--- a/hgext/largefiles/overrides.py	Sun Oct 14 14:44:08 2012 -0400
+++ b/hgext/largefiles/overrides.py	Sun Oct 14 15:10:13 2012 -0400
@@ -733,24 +733,29 @@
 def hgclone(orig, ui, opts, *args, **kwargs):
     result = orig(ui, opts, *args, **kwargs)
 
-    if result is not None and opts.get('all_largefiles'):
+    if result is not None:
         sourcerepo, destrepo = result
         repo = destrepo.local()
 
         # The .hglf directory must exist for the standin matcher to match
         # anything (which listlfiles uses for each rev), and .hg/largefiles is
         # assumed to exist by the code that caches the downloaded file.  These
-        # directories exist if clone updated to any rev.
-        if opts.get('noupdate'):
-            util.makedirs(repo.pathto(lfutil.shortname))
-            util.makedirs(repo.join(lfutil.longname))
+        # directories exist if clone updated to any rev.  (If the repo does not
+        # have largefiles, download never gets to the point of needing
+        # .hg/largefiles, and the standin matcher won't match anything anyway.)
+        if 'largefiles' in repo.requirements:
+            if opts.get('noupdate'):
+                util.makedirs(repo.pathto(lfutil.shortname))
+                util.makedirs(repo.join(lfutil.longname))
 
         # Caching is implicitly limited to 'rev' option, since the dest repo was
-        # truncated at that point.
-        success, missing = lfcommands.downloadlfiles(ui, repo, None)
+        # truncated at that point.  The user may expect a download count with
+        # this option, so attempt whether or not this is a largefile repo.
+        if opts.get('all_largefiles'):
+            success, missing = lfcommands.downloadlfiles(ui, repo, None)
 
-        if missing != 0:
-            return None
+            if missing != 0:
+                return None
 
     return result