hgext/largefiles/overrides.py
changeset 16644 98a9266db803
parent 16642 5cf18921bb7b
child 16691 7d6a660ca151
--- a/hgext/largefiles/overrides.py	Fri May 04 16:00:33 2012 -0500
+++ b/hgext/largefiles/overrides.py	Fri May 11 23:11:43 2012 +0200
@@ -697,6 +697,33 @@
         ui.status(_("%d largefiles cached\n") % numcached)
     return result
 
+def overrideclone(orig, ui, source, dest=None, **opts):
+    result = hg.clone(ui, opts, source, dest,
+                      pull=opts.get('pull'),
+                      stream=opts.get('uncompressed'),
+                      rev=opts.get('rev'),
+                      update=True, # required for successful walkchangerevs
+                      branch=opts.get('branch'))
+    if result is None:
+        return True
+    totalsuccess = 0
+    totalmissing = 0
+    if opts.get('all_largefiles'):
+        sourcerepo, destrepo = result
+        matchfn = scmutil.match(destrepo[None],
+                                [destrepo.wjoin(lfutil.shortname)], {})
+        def prepare(ctx, fns):
+            pass
+        for ctx in cmdutil.walkchangerevs(destrepo, matchfn, {'rev' : None},
+                                          prepare):
+            success, missing = lfcommands.cachelfiles(ui, destrepo, ctx.node())
+            totalsuccess += len(success)
+            totalmissing += len(missing)
+        ui.status(_("%d additional largefiles cached\n") % totalsuccess)
+        if totalmissing > 0:
+            ui.status(_("%d largefiles failed to download\n") % totalmissing)
+    return totalmissing != 0
+
 def overriderebase(orig, ui, repo, **opts):
     repo._isrebasing = True
     try: